19

Weekly thread to discuss whatever you’re working on, big or small, at work or in your free time.

you are viewing a single comment's thread
view the rest of the comments
[-] Rooster@infosec.pub 3 points 1 year ago

Adding timezone support to the website. JavaScript dates suck.

[-] httpjames@sh.itjust.works 1 points 1 year ago

What time format are you using? 64 bit Unix and date time strings should be easy to parse. Just a simple new Date(x).toLocaleString()

[-] Rooster@infosec.pub 1 points 1 year ago

It's not that simple. Parsing isn't a problem, it's formatting with a timezone that sucks. It's a pinch point in a lot of different ways. Because MomentJS is in maintenance mode and the Temporal library isn't ready yet, I tried to do it in vanilla JS. Date objects don't do a good job of keeping track of timezone. You can only apply the timezone when converting the Date object to a string with .toLocaleString(locale, {timeZone: "America/New_York"}) and the formatting rules available are not capable of producing the desired not-quite-ISO8601Nanos timestamp (I don't want it to be in UTC, I want that layout with a trailing timezone offset). I fell back to moment but moment-timezone doesn't work well with the Jest tests as they're written. I plan to rewrite a lot when the Temporal library is prod ready but that won't be before this sprint is over.

this post was submitted on 28 Jun 2023
19 points (100.0% liked)

cybersecurity

3142 readers
1 users here now

An umbrella community for all things cybersecurity / infosec. News, research, questions, are all welcome!

Community Rules

Enjoy!

founded 1 year ago
MODERATORS