|
|
|
|
|
by PokerFacowaty
395 days ago
|
|
I recently spent 2 hours on finding the bug, precisely because JS can't comprehend dates/times without a Unix timestamp underneath. I'd take a date from Postgres as e.x. "2025-05-24" and the first time somewhere deep in the package I was using, when JS encountered that, it needed to add a time (midnight, that's sane) and timezone (local time :) ). I was trying to use UTC everywhere and since the read dates had midnight of UTC+2 as the time, they were all a day behind in UTC. Special shoutouts to the author of node-postgres saying the PG's date type is better not used for dates in this case.[1] I love programming. [1] https://node-postgres.com/features/types#date--timestamp--ti... |
|
Is it sane? Is midnight at the start of a day, or the end of it? I'd think noon would be less ambiguous, and significantly less prone to these timezone issues (although this may not be a benefit).