---
title: "Fixing JavaScript Timezone Issues"
description: "A parking booking app stored Italian users' midnight bookings as 6:00 PM the previous day in a US-hosted Postgres database, because `new Date(selectedDate)` attached the browser's local timezone before the value reached the API."
url: "https://swe.quest/articles/fixing-javascript-timezone-issues-f0da06400f048fb6"
canonical: "https://neon.com/blog/fixing-javascript-timezone-issues"
source: "Neon"
published: "2025-01-31"
difficulty: "medium"
kind: "How-to"
reading_minutes: 2
tags: ["javascript","time-clocks","postgres"]
---

# Fixing JavaScript Timezone Issues

A post on [Neon](https://swe.quest/sources/neon.md), published 2025-01-31, 2 min read, How-to. Original: [https://neon.com/blog/fixing-javascript-timezone-issues](https://neon.com/blog/fixing-javascript-timezone-issues)

## Summary

A parking booking app stored Italian users' midnight bookings as 6:00 PM the previous day in a US-hosted Postgres database, because \`new Date(selectedDate)\` attached the browser's local timezone before the value reached the API. The fix was to build a plain \`YYYY-MM-DD HH:MM:SS\` string with no timezone information and store it directly, so the database keeps exactly the wall-clock time the user picked. The post ends with a short endorsement of Neon's free plan and easy connectivity.

Written by swe.quest, not by the author.

**Difficulty:** Medium: assumes a working developer; shows how it is built or done

## Topics

- [JavaScript](https://swe.quest/tags/javascript.md) (Languages)
- [Time & clocks](https://swe.quest/tags/time-clocks.md) (Distributed systems)
- [PostgreSQL](https://swe.quest/tags/postgres.md) (Data & databases)

## Prerequisites

- JavaScript Date object ([easy posts on JavaScript](https://swe.quest/tags/javascript.md?difficulty=easy))

## Keywords

Neon, JavaScript Date

## Related posts

- [Building On-call: Time, timezones, and scheduling](https://swe.quest/articles/building-on-call-time-timezones-and-scheduling-f978980b35f41e6a.md): incident.io · 2024-07-18 · Medium · 11 min read · Time & clocks, Scheduling, Testing, PostgreSQL, Go
  incident.io's on-call scheduler computes who is on shift from rotations with working hours, round-robin handovers and overrides, and getting it right depends on being precise about local time, offsets, IANA timezones, instants and durations.
- [Bun v0.6.13](https://swe.quest/articles/bun-v0-6-13-5f1989130c08b5c9.md): Bun · 2023-07-04 · Medium · 5 min read · JavaScript, Runtimes & VMs, Testing, Zig
  Bun v0.6.13 adds Date mocking in bun test via setSystemTime, which affects Date.now(), new Date() and Intl.DateTimeFormat without mutating the Date object as Jest does.
- [psql from the browser](https://swe.quest/articles/psql-from-the-browser-f27b7186b8abd76b.md): Neon · 2024-12-11 · Easy · 3 min read · PostgreSQL, Browsers, Developer tools, Open source
  psql.sh is a browser-based emulation of Postgres's psql client, built on Neon's WebSocket proxy and serverless driver because browsers can't open raw TCP connections.
- [Parsing JSON from Postgres in JS? Don’t get the wrong number](https://swe.quest/articles/parsing-json-from-postgres-in-js-don-t-get-the-wrong-number-5e25d42dfaa1da08.md): Neon · 2023-08-24 · Medium · 12 min read · JavaScript, PostgreSQL, Performance engineering, Runtimes & VMs
  JavaScript's JSON.parse() silently corrupts Postgres bigint and numeric values beyond Number.MAX\_SAFE\_INTEGER, so a row id can quietly become a different id.
- [Bringing psql’s \\d to your web browser](https://swe.quest/articles/bringing-psql-s-d-to-your-web-browser-032015b940df37e2.md): Neon · 2024-04-17 · Medium · 6 min read · PostgreSQL, JavaScript, Developer tools
  Neon's web SQL Editor now supports psql backslash introspection commands like \\d, \\l, \\dx and \\sf, which live in psql's C client code rather than the Postgres server.

Browse: [Latest posts](https://swe.quest/index.md) · [Topics](https://swe.quest/tags.md) · [Sources](https://swe.quest/sources.md) · [Topic map](https://swe.quest/map.md) · [Site guide (llms.txt)](https://swe.quest/llms.txt)
