Falsehoods programmers believe about dates and birthdays
01/02/2020 is ambiguous, a calendar date has no timezone, and a date of birth can't be in the future. Here's what breaks date inputs.
Try it — type something other forms reject:
Dates are where “obvious” assumptions cause the nastiest, quietest bugs: off-by-one birthdays from timezone shifts, and forms that silently misread 01/02/2020.
The falsehoods
- A date string is unambiguous.
01/02/2020is January 2nd to an American and February 1st to most of the world. - Dates are
MM/DD/YYYY. Most of the planet writesDD/MM. - A calendar date has a timezone. It doesn’t — treating it as one shifts birthdays by a day.
- Any past date is a valid birthday. Forms that allow a future date of birth ship real bugs.
- Nobody is over 120. Centenarians exist; never hard-reject on age.
How humaneforms handles it
The demo runs the real validateDob. It refuses to guess an ambiguous format (it asks for ISO YYYY-MM-DD rather than silently misreading), it’s timezone-safe, it rejects a future birth date, and it only warns — never rejects — on an implausible age. No more off-by-one birthdays.
npm install @humaneforms/react, or get the Pack.