cloudflare.cf.timezone is too unreliable and causes issues like #108 and #107, among others.
We should instead do the following:
Get the user's timezone in client-JavaScript via Intl.DateTimeFormat().resolvedOptions().timeZone (or something else)
Persist the timezone in a cookie
On the server, if the timezone cookie exists, use it, otherwise fall back to a sensible default (e.g. UTC)
There's some trickyness here because Counterscale is server-rendered (with some client-rendered components). Which means we may not have the timezone on first render, unless we intentionally force the user through an empty page that captures the timezone then redirects.
cloudflare.cf.timezone
is too unreliable and causes issues like #108 and #107, among others.We should instead do the following:
Intl.DateTimeFormat().resolvedOptions().timeZone
(or something else)There's some trickyness here because Counterscale is server-rendered (with some client-rendered components). Which means we may not have the timezone on first render, unless we intentionally force the user through an empty page that captures the timezone then redirects.