diff --git a/web/src/lib/date.ts b/web/src/lib/date.ts index 22048a1..04081ee 100644 --- a/web/src/lib/date.ts +++ b/web/src/lib/date.ts @@ -68,7 +68,9 @@ export function isConsecutiveDays(a: Date, b: Date): boolean { export function groupConsecutiveDates(dates: string[]): string[][] { const groupedDates: string[][] = []; - const uniqueDays = unique(dates.map(date => format(startOfDay(toLocalTime(date)), 'yyyy-MM-dd'))) + const uniqueDays = unique( + dates.map((date) => format(startOfDay(toLocalTime(date)), "yyyy-MM-dd")) + ).sort(); let group: string[] = []; for (let i = 0; i < uniqueDays.length; i++) { @@ -101,7 +103,7 @@ export function formatDateRange(dates: string[]): string { if (firstDate.getMonth() === lastDate.getMonth()) { // same month - return `${firstDate.getDay()}.—${lastDate.getDay()}. ${formatDate( + return `${firstDate.getDate()}.—${lastDate.getDate()}. ${formatDate( firstDate, "MMMM" )}`;