logoalt Hacker News

nosianulast Thursday at 7:41 AM1 replyview on HN

???

What does that have to do with my comment?

The OP explicitly wrote

> prompt> use javascript to convert a unix timestamp to a date in 'YYYY-MM-DD' format using Temporal


Replies

MobiusHorizonslast Thursday at 3:39 PM

> answer> Temporal.Instant.fromEpochSeconds(timestamp).toPlainDate()

The answer ends in `toPlainDate()` which returns an object with year, month and day properties. ie it does not output the requested format.

This is in addition to the issue that `fromEpochSeconds(timestamp)` really should probably be `fromEpochMilliseconds(timestamp * 1000)`