Closed jacobg closed 11 years ago
We already keep a reference to the offset and save currently applied to a TimeZoneTime
. I can use that to implement getTimezoneOffset
.
I'm hesitant to implement any of the other missing toString variants like toLocaleString
because they would be hacky. We must only use UTC values on the wrapped date object to ensure no daylight savings magic and most of those existing functions operate with non UTC values; see the hacky way we implement toDateString
.
It turns out that the native getTimezoneOffset
includes the current daylight savings offset in the returned value. So todays offset is different than one in February (for Chicago, US anyway).
Checkout out the new unit test for this commit for more detail.
PS. Let's make the web better by not linking to w3schools.
Awesome! Thank you!
Documented here or here:
And here is one example implementation in javascript: