Better HN
topnewbestaskshowjobs
Log inSign up

Javiliano

1 karma · joined Aug 24, 2024 (2y ago) · 1 submissions

Submissions

comment 2y ago · link · parent

From the article:

"Let's consider an example: suppose I want to record the moment I make a payment with my card. Many people might be tempted to do something like this:

const paymentDate = new Date('2024-07-20T10:30:00');".

What? I don't think anybody would define a date like this to record some moment. Most developers would simply use new Date() without any parameters, thereby creating a timezone-safe absolute underlying timestamp value. This value then is of course stringified relative to the timezone of the caller when retrieving it, but that's expected.

The new Temporal api might be nice but it doesn't need flawed examples to make its case.