Skip to content

Commit

Permalink
fix: check for type before formatting a date (intuitem#996)
Browse files Browse the repository at this point in the history
  • Loading branch information
ab-smith authored Oct 29, 2024
2 parents add9519 + c9f47be commit 542fbee
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions frontend/src/lib/utils/datetime.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
export function formatDateOrDateTime(isoString: string, locale = 'en-US'): string {
if (typeof isoString !== 'string') {
return isoString;
}
const hasTime = isoString.includes('T');

const date = new Date(isoString);
Expand Down

0 comments on commit 542fbee

Please sign in to comment.