Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
AmruthPillai committed Nov 23, 2022
1 parent 3106f94 commit b697f73
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions client/utils/date.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,10 @@ export const formatDateString = (date: string | DateRange, formatStr: string): s

if (!dayjs(date.start).isValid()) return null;

if (dayjs(date.start).isSame(date.end)) {
return dayjs(date.start).format(formatStr);
}

if (!isEmpty(date.end) && dayjs(date.end).isValid()) {
return `${dayjs(date.start).format(formatStr)} - ${dayjs(date.end).format(formatStr)}`;
}
Expand Down

0 comments on commit b697f73

Please sign in to comment.