fix(06): WR-04 use local-date helper in calendarStore instead of UTC toISOString slice
This commit is contained in:
@@ -24,6 +24,7 @@
|
||||
*/
|
||||
|
||||
import { create } from 'zustand'
|
||||
import { localDateISO } from '../lib/eventDateTime.js'
|
||||
|
||||
// ── Types ──────────────────────────────────────────────────────────────────
|
||||
|
||||
@@ -126,15 +127,19 @@ function initialCalendarRange(): { start: string; end: string } {
|
||||
start.setDate(start.getDate() - 7)
|
||||
const end = new Date(today.getFullYear(), today.getMonth() + 1, 0)
|
||||
end.setDate(end.getDate() + 7)
|
||||
// WR-04: localDateISO uses local calendar accessors — NEVER toISOString().slice(0,10),
|
||||
// which returns the UTC date and (for the project's negative-offset zones after ~20:00
|
||||
// local) seeds the window/selectedDate on the wrong day.
|
||||
return {
|
||||
start: start.toISOString().slice(0, 10),
|
||||
end: end.toISOString().slice(0, 10),
|
||||
start: localDateISO(start),
|
||||
end: localDateISO(end),
|
||||
}
|
||||
}
|
||||
|
||||
/** Today as an ISO date string (YYYY-MM-DD). Exported for use in EventForm (IN-03). */
|
||||
export function todayIso(): string {
|
||||
return new Date().toISOString().slice(0, 10)
|
||||
// WR-04: local-date accessor, not the banned UTC slice.
|
||||
return localDateISO(new Date())
|
||||
}
|
||||
|
||||
// ── Store ──────────────────────────────────────────────────────────────────
|
||||
|
||||
Reference in New Issue
Block a user