You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Date in JavaScript doesn't have a concept of timezones really, it only uses local time and allows to get local and/or UTC string out of it if needed. This makes displaying time from non-local timezone very tricky.
So for example if you're in London, and would like to show clocks from UTC and UTC+1, you would use:
new Date() for your current time (UTC)
Something like new Date(new Date().toISOString().slice(0, -1) + '-01:00') for UTC+1. Why? We're looking for a date which, when read as our local time, will return a time an hour later than our current one.
If I have multiple clocks and using the basic usage code, what's the best approach to mutate the state to show a different timezone for each clock?
E.g
Clock 1: UTC-6
Clock 2: UTC-5
Clock 3: UTC-2
Thanks!
The text was updated successfully, but these errors were encountered: