Skip to content

Commit

Permalink
handle null case
Browse files Browse the repository at this point in the history
  • Loading branch information
apburnie committed Jun 22, 2022
1 parent 06a565d commit 8644b80
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion explorer/client/src/utils/timeUtils.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
const stdToTwo = (value: number) => (value < 10 ? `0${value}` : `${value}`);

export const convertNumberToDate = (epochTimeSecs: number) => {
export const convertNumberToDate = (epochTimeSecs: number | null): string => {
if (!epochTimeSecs) return 'Not Available';
//API returns epoch time in seconds, Date expects milliseconds:
const date = new Date(epochTimeSecs * 1000);

Expand Down

0 comments on commit 8644b80

Please sign in to comment.