fix date range formatting in date pills
This commit is contained in:
@ -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"
|
||||
)}`;
|
||||
|
Reference in New Issue
Block a user