A developer recounts a bug where a billing report showed bills from the wrong day due to a timezone mismatch: the frontend sent plain calendar dates (e.g. '2026-01-01') without timezone context, and the backend converted them directly to JavaScript Date objects while MongoDB stored timestamps in UTC. The core lesson is that a calendar date is not the same as a timestamp - a date needs a timezone to be meaningful, and query boundaries should be computed in the user's local timezone before converting to UTC. Also covers using half-open [start, end) ranges to avoid excluding the last day of a range, and a mental model separating calendar dates, timestamps, and local date/time.
Post #2328
12.9K

Dates Are Not Data, They Are Context · Nikhil Gautam
- ❤ 15
- 👍 7
- 😁 3
- 👎 1