Find the days that are not 24 hours long
This reads the browser's own time-zone rules, so it needs no data file. The edge case: dividing by 24 is wrong on exactly these two days.
A timestamp is one exact instant, but the calendar day it falls on depends on whose clock you read. Parse dates with a stated format, format them on a stated clock, and never let a chart silently shift a ride to the wrong day.
Change the code and press Run (Ctrl+Enter). Predict what will happen first, then break it on purpose and read what changes. Your edits are saved and match the lesson page.
Ready for more? This phase has 5 hands-on exercises with automatic checks.
Practice questions
Write the code in the editor, run it, then open the model answer to compare.
Write localDay(iso, zone) returning YYYY-MM-DD. Use it to count how many of trips-10k.csv's trips start on 15 June on the Pacific/Auckland clock.
Write hoursInLocalDay(dateText, zone) that returns 23, 24 or 25 for a YYYY-MM-DD date by counting the hours.
Explain it without notes
Why can a trip at 00:30 UTC belong to the previous day for some viewers?
How do you get the local day of an instant for Ardenvale without a library?
Why is dividing a daily total by 24 wrong on 30 March 2025?
Preview
Console
Nothing logged yet.Expected console output
Full local days counted: 364
Days that are not 24 hours long: [ [ '2025-03-30', 23 ], [ '2025-10-26', 25 ] ]
2,118 rides on 2025-03-30 is 92.1 per hour, not 88.3