Files
windmill/frontend/src/lib/components/dateTimeInput.ts
T
AlexRV12andRuben Fiszel 4186ffff84 fix: spell the schedule pause time the way the picker writes it (#11875)
* fix: make the schedule editor's saved baseline reactive

* fix: spell the schedule pause time the way the picker writes it

* fix: read a zone-less naive date-time as wall-clock time

---------

Co-authored-by: Ruben Fiszel <ruben@windmill.dev>
2026-10-19 23:19:38 +02:00

6 lines
357 B
TypeScript

/** A naive value's digits are its time: `Date` would read a zone-less date-time as local time */
export function parseDateTime(value: string, timezone: 'naive' | 'local'): Date {
const zoneless = /^\d{4}-\d{2}-\d{2}[T ]\d{2}:\d{2}(:\d{2}(\.\d+)?)?$/.test(value)
return new Date(timezone === 'naive' && zoneless ? value.replace(' ', 'T') + 'Z' : value)
}