Range error with varied local time string
Hi, I've noticed if changing the owner timezone to another country i.e. something like Australia, (in config.ts -> OWNER_TIMEZONE), I get an error: error lib\availability\helpers.ts (68:20) @ toLocaleTimeString
-
error Error [RangeError]: Value longGeneric out of range for Date.prototype.toLocaleTimeString options property timeZoneName at Date.toLocaleTimeString (
) I've noticed this problem goes away by removing the timezonename: "longGeneric" clause in request.ts interval to human string fx -> ''' function intervalToHumanString({ start, end, timeZone, }: DateTimeIntervalWithTimezone): string { return
${formatLocalDate(start, { month: "long", day: "numeric", hour: "numeric", minute: "numeric", weekday: "long", timeZone, })} – ${formatLocalTime(end, { hour: "numeric", minute: "numeric", timeZone, timeZoneName: "longGeneric", })}} ''' when removing timezonename: "longGeneric" i no longer have this problem i.e. ''' function intervalToHumanString({ start, end, timeZone, }: DateTimeIntervalWithTimezone): string { return `${formatLocalDate(start, { month: "long", day: "numeric", hour: "numeric", minute: "numeric", weekday: "long", timeZone, })} – ${formatLocalTime(end, { hour: "numeric", minute: "numeric", timeZone,})}` } '''
Thank you for that find.
Sometimes (at least for some US timezones), the longGeneric response produced a more human-readable string. Sorry that my US-centricity gave you a headache, but appreciate you reporting the find. Will incorporate the fix. :-)