revert reka-ui update; fix DST cellMath;

This commit is contained in:
Gregor Vostrak
2026-05-29 17:03:52 +02:00
parent 0aa0f0bd77
commit 8eab0485c9
3 changed files with 14 additions and 10 deletions

View File

@@ -28,10 +28,14 @@ interface Interval {
function localDayBounds(date: string, tz: string): { dayStart: Dayjs; dayEnd: Dayjs } {
const dayjs = getDayJsInstance();
const localDayStart = dayjs.tz(`${date} 00:00:00`, tz);
// `.add(1, 'day')` on a Dayjs instance advances by a fixed 24h, which is
// wrong on DST-transition days (the local day is 23h or 25h long). Derive
// the next calendar date in UTC (no DST) and take its local midnight, so
// `dayEnd` is always the real next local midnight.
const nextDate = dayjs.utc(date).add(1, 'day').format('YYYY-MM-DD');
return {
dayStart: localDayStart.utc(),
dayEnd: localDayStart.add(1, 'day').utc(),
dayStart: dayjs.tz(`${date} 00:00:00`, tz).utc(),
dayEnd: dayjs.tz(`${nextDate} 00:00:00`, tz).utc(),
};
}