2 ms·
I’m pretty sure toPlainDate() returns an object not a string.
by MobiusHorizons 1y ago
I’m pretty sure toPlainDate() returns an object not a string.
- nosianu 1y ago??? 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
- MobiusHorizons 1y ago> 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)`