Skip to content

Commit 560d781

Browse files
committed
Log duplicated days
Signed-off-by: gpbl <[email protected]>
1 parent 4937869 commit 560d781

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/helpers/getDates.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,8 +101,9 @@ export function getDates(
101101
export function hasDuplicateDay(dates: Date[], dateLib: DateLib): boolean {
102102
const seen = new Set<string>();
103103
for (const day of dates) {
104-
const start = dateLib.startOfDay(day);
105-
const key = `${dateLib.getYear(start)}-${dateLib.getMonth(start)}-${start.getDate()}`;
104+
// Key by the calendar components of the original date to avoid timezone
105+
// and sub-hour offsets shifting us into the previous/next day.
106+
const key = `${dateLib.getYear(day)}-${dateLib.getMonth(day)}-${day.getDate()}`;
106107
if (seen.has(key)) {
107108
return true;
108109
}

0 commit comments

Comments
 (0)