Hacker News new | ask | show | jobs
by MobiusHorizons 287 days ago
I’m pretty sure toPlainDate() returns an object not a string.
1 comments

???

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

> 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)`