I have worked with these before but have forgotten what I’ve learned, probably because I didn’t learn it correctly to begin with. The Date object

Dates in Javascript

submited by
Style Pass
2025-01-22 21:30:08

I have worked with these before but have forgotten what I’ve learned, probably because I didn’t learn it correctly to begin with.

The Date object in JS may be replaced, or rather, joined by, an object called Temporal which is meant to fix a lot of issues that Date supposedly has. Date can’t be replaced or changed much though, since so much of the web uses it.

Okay so. Dates are just a timestamp number. Or you know, they are a whole class, but, at the core of the date itself like some big onion, they have a timestamp which is the milliseconds since Unix Epoch.

Note how in the ISO 8601 date format, the month comes before the day. I feel like that’s the most opinionated thing about it (and yes Americans are wrong to order it differently - I’m not saying it’s a bad opinion).

getTimezoneOffset() - this method returns the difference between the UTC and local time in minutes. I think this depends on the operating system to know what the offset is though.

Leave a Comment