| 04:26 | <MikeSmith> | Domenic: yes, sorry for not having gotten to it yet |
| 04:27 | <MikeSmith> | since December 14 launch of mdn/content, have not had much free cycles |
| 04:29 | <MikeSmith> | to regenerate mdn-spec-links, I still need to rewrite my MDN-consuming code to consume the different (better) JSON format that’s now exposed |
| 04:31 | <MikeSmith> | in the mean time, been working today on https://github.com/mdn/content/pull/893 |
| 04:31 | <MikeSmith> | updating https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/getTimezoneOffset |
| 04:32 | <MikeSmith> | and, at the risk of embarrassing myself, I have to admit I don’t think I understand date.getTimezoneOffset() |
| 04:35 | <MikeSmith> | I *thought* I did — I thought it was simple: regardless of what Date instance the getTimezoneOffset() method is called from, the result isn’t calculated based on the value of the particular Date instance, but is instead always just the difference between UTC time and local time |
| 04:36 | <MikeSmith> | but https://github.com/mdn/content/pull/893/files#r551959459 suggests that ain’t so |
| 04:37 | <MikeSmith> | however, from reading https://tc39.es/ecma262/#sec-date.prototype.gettimezoneoffset I find no indication how the behavior could be anything other than one what I described — that is, it’s not calculated by looking at he instance |
| 04:39 | <MikeSmith> | but I had anyway already been wondering, if that’s so, why then is getTimezoneOffset() an instance method rather than being a static method of Date? |
| 05:41 | <Domenic> | MikeSmith: LocalTime(t), and in particular LocalTZA(t), is a function of t, I guess? And t = the time value of the particular instance |
| 05:42 | <Domenic> | https://tc39.es/ecma262/#sec-local-time-zone-adjustment seems to have an example |
| 05:42 | <MikeSmith> | Domenic: yeah, I have since read through the spec to get to some of that |
| 05:42 | <MikeSmith> | https://tc39.es/ecma262/#sec-local-time-zone-adjustment |
| 05:43 | <MikeSmith> | > When tlocal represents local time repeating multiple times at a negative time zone transition (e.g. when the daylight saving time ends or the time zone offset is decreased due to a time zone rule change) or skipped local time at a positive time zone transitions (e.g. when the daylight saving time starts or the time zone offset is increased due to a time zone rule change), tlocal must be interpreted |
| 05:43 | <MikeSmith> | using the time zone offset before the transition. |
| 05:43 | <MikeSmith> | this “time zone transition” stuff |
| 05:43 | <MikeSmith> | https://tc39.es/ecma262/#sec-time-values-and-time-range |
| 05:43 | <MikeSmith> | > A time value that is a multiple of 24 × 60 × 60 × 1000 = 86,400,000 (i.e., is equal to 86,400,000 × d for some integer d) represents the instant at the start of the UTC day that follows the epoch by d whole UTC days (preceding the epoch for negative d). Every other finite time value t is defined relative to the greatest preceding time value s that is such a multiple, and represents the instant |
| 05:43 | <MikeSmith> | that occurs within the same UTC day as s but follows it by t − s milliseconds. |
| 05:43 | <MikeSmith> | ... |
| 05:46 | <MikeSmith> | so I think that means, if a Date instance’s value is a multiple of 86,400,000, then calling getTimezoneOffset() from that instance will give the time zone offset prior to DST transition |
| 05:47 | <MikeSmith> | Right? |
| 05:48 | <Domenic> | That much, I cannot answer at 1am, sorry :) |
| 05:48 | <Domenic> | I can try to help out tomorrow! |
| 05:48 | <MikeSmith> | hai :) |
| 06:50 | <MikeSmith> | Domenic: (when you’re back) found https://esdiscuss.org/topic/override-localtza |
| 06:50 | <MikeSmith> | > I understand that an implementation of ECMAScript is expected to determine the local time zone adjustment [1]. |
| 06:50 | <MikeSmith> | > This is really convenient -- most of the time. However, it would be great to override this for a given Date object. |
| 07:00 | <MikeSmith> | OK from testing I’ve managed to glean that it depends on whether the date of the instance is/was during DST |
| 07:01 | <MikeSmith> | basically |
| 07:04 | <MikeSmith> | only “basically” because I guess there is probably some more complicated checking of the https://www.iana.org/time-zones tzdb |
| 07:09 | <MikeSmith> | (end monologue; apologies to channel; /me heads off to try to document this in MDN) |