spencermountain / spacetime

A lightweight javascript timezone library
http://spacetime.how/
Other
3.97k stars 184 forks source link

'etc/unknown' timezone should fall back on UTC #367

Closed guillaumelachaud closed 1 year ago

guillaumelachaud commented 1 year ago

On some systems with incorrect (missing) timezone setup, Intl.DateTimeFormat().resolvedOptions().timeZone will return etc/unknown, which in turn will throw an exception when trying to lookup the timezone:

Spacetime: Cannot find timezone named: 'etc/unknown'. Please enter an IANA timezone id.

It feels like etc/unknown should be treated as undefined in safeIntl(), allowing guezzTz() to gracefully fall back on UTC.

Thoughts?

spencermountain commented 1 year ago

whoa! I did not know that. That's helpful to know. Yeah - maybe we should map it back to UTC? Thanks Guillaume.

guillaumelachaud commented 1 year ago

I think it would make sense to map it back to UTC, yes.

I see that you added commit d51a5fe on a separate branch, which name hints at a major rewrite :-). Any plans to add a fix for this in master as well ?

Thanks!

spencermountain commented 1 year ago

sure. released as 7.4.1 cheers