ChaosQA · Guides

Date and time testing: time zones, DST, midnight

Updated November 13, 2026

Most date and time bugs stay hidden when the tester and the server share one time zone and the test runs in the middle of an ordinary day. This guide lists the conditions that bring them out, with dates for 2027 you can use as test data.

For the rules of a single date input (today or later, impossible dates, formats) see date field test cases. This page covers what happens to a date or a time after it is entered.

Set up before you test

Write down three things about the system: which time zone the server works in, which one each test user is in, and what the stored value is (a moment with an offset, or a bare date and a wall-clock time). The third one decides which of the cases below apply. If nobody on the team knows, the request body in the browser's Network tab shows what the page sends.

Ways to move the clock without waiting for midnight:

Which day is "today"?

A user in Los Angeles opens a form at 23:30 on March 1, 2027. In UTC that moment is 07:30 on March 2. A server that works in UTC already counts March 2 as today, so a rule such as "not in the past" gives different answers on the page and on the server. In winter the two dates differ for 8 hours of every day in Los Angeles, from 16:00 to midnight. In Tokyo they differ for 9 hours, from midnight to 09:00, and there the server is a day behind.

TestExpectedWhat it catches
User's zone behind UTC, local evening, pick today's local dateThe page and the server agreeThe server rejects "today" because its own day has already changed
User's zone ahead of UTC, local morning, pick today's local dateThe sameThe server accepts yesterday, or shows the record under the previous day
Save a date, read it back in a zone behind UTCThe same dateA date stored as midnight UTC and shown in local time moves one day back
Two users in different zones open the same recordEach sees the same moment in local time, or one clearly labelled zoneA time shown with no zone that each reader takes for their own

The third row comes from one line of code. A date with no time, such as 2027-03-14, is read by JavaScript as midnight UTC. In New York that moment is 19:00 on March 13, so a birthday or a deadline is displayed a day early for everyone west of Greenwich and correctly for everyone east of it. A team in Europe or Asia will not see it on their own machines.

Daylight saving time

Twice a year a day in a zone with daylight saving time is 23 or 25 hours long. The 2027 dates:

ZoneClocks go forwardClocks go back
New York (America/New_York)March 14: 02:00 becomes 03:00November 7: 02:00 becomes 01:00
Berlin (Europe/Berlin)March 28: 02:00 becomes 03:00October 31: 03:00 becomes 02:00

Between March 14 and March 28 New York and Berlin are 5 hours apart instead of the usual 6. Schedule a meeting between the two inside those two weeks and compare the time each side sees.

Test (New York, 2027)ExpectedWhat it catches
Create something at 02:30 on March 14Rejected, or moved to 03:30 with a noticeA time that does not exist is stored and later displayed as something else
Create something at 01:30 on November 7The app asks which 01:30, or documents which one it takesThe time occurs twice; reminders fire an hour early or late
Duration from 01:00 to 03:00 on March 141 hourSubtracting clock readings gives 2
Duration from 01:00 to 03:00 on November 7, starting at the first 01:003 hoursThe same subtraction gives 2
Daily event at 09:00, created March 13, viewed March 1409:00"Next day" computed as plus 24 hours lands on 10:00
Daily totals or a per-day limit on March 14 and November 7The day covers 23 and 25 hoursA day assumed to be 24 hours drops an hour or counts it twice

Add one zone with no daylight saving time (Tokyo, or Phoenix inside the United States) to check that the app does not shift its times along with the others.

Offsets that are not whole hours

India is at UTC+5:30 and Nepal at UTC+5:45. Code that stores the offset as a whole number of hours shows users there a time 30 or 45 minutes off. Kiritimati is at UTC+14 and Honolulu at UTC−10: the clocks show the same time and the calendar date differs by one. A zone picker limited to −12…+12 cannot represent the first of them.

Date arithmetic

OperationQuestion to askWhat code often does
January 31, 2027 plus one monthFebruary 28, or an error?JavaScript's setMonth returns March 3
February 29, 2028 plus one yearFebruary 28, 2029?March 1, 2029
Monthly subscription started on the 31stWhich day in a 30-day month, and does it return to the 31st afterwards?Drifts to the 28th and stays there
Age or "N days left"Counted in calendar days of which zone?Milliseconds divided by 86,400,000, off by one near midnight and on daylight saving days

The expected result in the first three rows is a product decision. If the specification does not answer the question, the missing answer goes into the report along with what the code does now.

Ranges, filters and sorting

Formats in requests and responses

A time with no offset, such as 2027-03-14T09:00:00, does not say whose 09:00 it is. Send the same moment three ways (with Z, with an offset such as -05:00, and with nothing) and compare what is stored. Read the value back: if the API accepts an offset and returns the time without one, the client can no longer tell which moment was stored.

Edge values to send where the format allows them: 24:00, 00:00 as an end time, 12:00 AM and 12:00 PM in a 12-hour field (the first is midnight), seconds and milliseconds when the rule speaks only of minutes, and a date in another calendar order.

The device clock

Set the clock on the test device ten minutes fast, then ten minutes slow. Countdown timers and session timeouts that rely on the device show wrong values or log the user out early. Anything with a deadline, such as a sale end or a password reset link, should be decided by the server's clock: move the device clock past the deadline and try the action. Expected: the server's answer does not change.

Try it on a live API. RoomBox is a practice REST API for booking meeting rooms. Every booking has a date, a start time and an end time, and the rules cover past dates, how far ahead a booking can be, opening hours and overlaps. Each session has bugs planted in some of these rules.
Open the API exercise

More guides: date field test cases · REST API test cases · all guides