GenerateRandomSearch

Date Edge Case Generator

A random date generator will hand you 14 July roughly always and 29 February roughly never, which is exactly backwards for testing. The dates that break software are a small, known set: the leap day, the last day of a 30-day month, the day the clocks change, the week that belongs to the previous ISO year. This produces those on purpose, with an explanation of what each one breaks, and every date is checked against its own claim before you see it.

What this generator does

Produces dates chosen because they are difficult. The random date generators on this site draw uniformly from a range, which is the right thing for sample data and the wrong thing for a test suite. This draws only from the boundaries — and it re-derives each date's classification from the date itself, so a case filed under 'leap day' that is not 29 February in a leap year cannot reach you.

How to use this tool

  1. Set the range of years to draw from.
  2. Tick the kinds of edge case you care about.
  3. Press generate, then copy the list as CSV into your fixtures.
  4. Add a seed if you want the same set back in CI.

Understanding the controls

From and to year
The span to draw from. Some cases only exist in some years: ISO week 53 turns up roughly every five or six years, and the 32-bit epoch boundary only exists in 2038, so a narrow range genuinely has fewer cases in it.
Which kinds
Fourteen categories, from the leap day to a month containing five full weekends. Untick everything except the one you are chasing to get a focused list.
How many cases
If the range holds fewer than you asked for, you get all of them and the page says so rather than padding with repeats.
Seed
A word reproduces the identical set, which is what you want for a fixture file checked into a repository.

Worked examples

Leap day
2024-02-29 — exists only in a leap year, and adding a year to it has no correct answer.
ISO year mismatch
2021-01-01 belongs to ISO week 53 of 2020, not to 2021.
EU vs US clock change, 2024
31 March and 10 March respectively — three weeks apart.
Five-weekend month
A 31-day month starting on a Friday, which breaks 'four weeks per month' in rotas and payroll.

Common use cases

  • Building a fixture file for date parsing and formatting tests
  • Checking a booking or billing system against the clock changes
  • Finding out whether your week-number logic knows about ISO years
  • Writing regression tests after a date bug has already bitten
  • Teaching a team why 29 February is not the only awkward date

How this generator works

For each year in the range, every edge case that genuinely occurs in it is computed — the leap day only in leap years, ISO week 53 only in the years that have 53 weeks, the epoch boundary only in 2038. Daylight-saving dates are computed from the published changeover rules rather than looked up: the EU changes on the last Sunday in March and October, the US on the second Sunday in March and the first in November, and the tool labels which is which because they are weeks apart. The finished list is then checked case by case against the date itself.

Randomness and fairness

Randomness decides only which of the eligible cases you get and in what order. Which cases exist in a given year is computed, not drawn — 2023 has no leap day however many times you press the button. With a seed the selection comes from a documented non-cryptographic generator, so a fixture file can be reproduced exactly.

For how randomness is produced across the whole site, see how Generate Random works.

Assumptions this tool makes

  • Dates are proleptic Gregorian, which is what every mainstream date library uses.

Limitations and good to know

  • There is no timezone database here. The clock changes offered are the current EU/UK and US rules, stated as such; historical rules, southern-hemisphere zones and places that have changed their rules are not covered.
  • It produces dates, not times. The DST cases identify the day, not the exact instant the offset changes.
  • It knows nothing about your business calendar — fiscal year ends, term dates and public holidays are not edge cases it can guess.
  • Nothing is saved between visits, so use a seed if a fixture file needs to be reproducible.

Common mistakes

Testing only 29 February
It is the famous one, not the common one. The last day of a 30-day month, the ISO year mismatch and the clock changes all break more code in practice.
Assuming the EU and US clocks change together
They are weeks apart, twice a year. Anything that spans both regions has two windows where the offset between them is not what it usually is.
Storing local times across a DST boundary
On the autumn change 01:30 happens twice and is genuinely ambiguous. That is a data-modelling problem, not a formatting one.

Practical tips

  • Seed the generator and commit the CSV, so a failing case is reproducible rather than a mystery.
  • Include 2038 in the range if anything in your stack still touches a 32-bit timestamp.
  • Run the whole set through your parser first — the failures usually come in groups.

Privacy and your data

Everything is computed in your browser from the years and options you set. There is nothing to upload, nothing is stored between visits, and none of your settings are written into the page address. Analytics records that the tool ran and how many cases it produced.

Frequently asked questions

Why not just use random dates?
Because a uniform draw over ten years gives you a leap day about once in 1,460 tries and the exact day of a clock change about as often. The failures cluster on the boundaries, so the test data should too.
Are the daylight-saving dates reliable?
They are computed from the current EU/UK and US rules, and each is labelled with the region it applies to. They are not a substitute for a timezone database, and the page says so — historical and southern-hemisphere rules differ.
What is an ISO year mismatch?
The ISO week-numbering year is the year of the Thursday in that week, so 1 January can belong to week 52 or 53 of the previous year. Code that takes the calendar year and the ISO week number and puts them together gets a date up to a year out.
Can I get the same list twice?
Enter a seed. The same seed and settings always produce the same list, which is what a checked-in fixture file needs.