meet icon indicating copy to clipboard operation
meet copied to clipboard

Range error with varied local time string

Open peterphilips opened this issue 2 years ago • 1 comments

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,

    })}` } '''

peterphilips avatar Jun 28 '23 05:06 peterphilips

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. :-)

timfee avatar Jun 28 '23 18:06 timfee