We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 4937869 commit 560d781Copy full SHA for 560d781
src/helpers/getDates.ts
@@ -101,8 +101,9 @@ export function getDates(
101
export function hasDuplicateDay(dates: Date[], dateLib: DateLib): boolean {
102
const seen = new Set<string>();
103
for (const day of dates) {
104
- const start = dateLib.startOfDay(day);
105
- const key = `${dateLib.getYear(start)}-${dateLib.getMonth(start)}-${start.getDate()}`;
+ // Key by the calendar components of the original date to avoid timezone
+ // and sub-hour offsets shifting us into the previous/next day.
106
+ const key = `${dateLib.getYear(day)}-${dateLib.getMonth(day)}-${day.getDate()}`;
107
if (seen.has(key)) {
108
return true;
109
}
0 commit comments