What are you working on Wednesday

3 years ago by shellsharks to c/cybersecurity

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

load all comments
Rooster 3 points 3 years ago

Adding timezone support to the website. JavaScript dates suck.

path: 0 619986, hotness: undefined, score: 3, children: 2
httpjames 1 point 3 years 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()

path: 0 619986 628861, hotness: undefined, score: 1, children: 1
Rooster 1 point 3 years 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.

path: 0 619986 628861 629913, hotness: undefined, score: 1, children: 0
cybersecurity
cybersecurity

@infosec.pub

login for more options
6524
1330
582

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

Community Rules

  • Be kind
  • Limit promotional activities
  • Non-cybersecurity posts should be redirected to other communities within infosec.pub.

Enjoy!

go to feed...