Which date should you test?
Half of date testing is moving the clock. The other half is knowing where to move it to. An online calculator will tell you what ninety days from today is. It will not tell you that the answer is a bank holiday, or that it is the last day of the quarter.
04/08/2008 pasted in,
and both readings shown rather than one guessed.Business days, with real holidays
"Ten business days out" is not arithmetic - it depends on which country's calendar you are counting in. Same start date, same ten days, two different answers:
$ chrono calc --base 2027-09-01T00:00:00 --shift +10bd --calendar us-banking result: 2027-09-16T00:00:00 $ chrono calc --base 2027-09-01T00:00:00 --shift +10bd --calendar pl result: 2027-09-15T00:00:00
One day apart, and the calculator will tell you why if you ask it about the date in between:
$ chrono calc --base 2027-09-06T00:00:00 --calendar us-banking metadata: weekday Monday business day no (us-banking) holiday Labor Day what this date tests: public holiday
The United States and Poland ship as reference calendars, chosen because between them they exercise every rule type there is: fixed dates, nth-weekday-of-month, dates calculated from Easter, and the American rule where a holiday landing on a Saturday is observed on the preceding Friday. Adding a country is a data file, not a code change.
Every format at once
The application under test wants the date in whatever form it expects. Rather than making you convert, the calculator prints them all - and a custom mask for the ones that fit nothing standard.
$ chrono calc --preset year-2038 --zone +00:00 Chrono Mock - date calculator preset: year-2038 - 2038 boundary explains: Does the app survive the 32-bit Unix time boundary (2038-01-19T03:14:07Z)? result: 2038-01-19T03:14:07 formats: ISO date 2038-01-19 ISO datetime 2038-01-19T03:14:07+00:00 US 01/19/2038 PL 19.01.2038 epoch (s) 2147483647 epoch (ms) 2147483647000 FILETIME 137919572470000000 RFC 1123 Tue, 19 Jan 2038 03:14:07 GMT ... what this date tests: at or past the 2038-01-19T03:14:07Z 32-bit time_t limit (Y2038)
That epoch value is not a coincidence - 2147483647 is exactly the largest
number a signed 32-bit integer holds, which is the entire reason the date matters.
Reading a date backwards
The other direction is just as useful: paste a date out of a log and find out what it
is. When the format is ambiguous - and 04/08 is ambiguous across half the
world - both readings are shown rather than one being guessed, because
guessing is where the original bug report came from.
$ chrono calc --analyze 04/08/2027 Chrono Mock - date analysis input: 04/08/2027 (ambiguous - month/day order differs by locale) US MM/DD/YYYY: 2027-04-08 (Thursday) PL DD/MM/YYYY: 2027-08-04 (Wednesday)
Four months apart, on different weekdays. An ISO date is unambiguous and is read as one, and something that is not a date at all is refused rather than guessed at.
Built from steps, not from a sentence
A moment is a starting point plus steps, and the intermediate result is shown after each one, so an expression that produces a surprising answer shows you where it turned. Five kinds of step: shift by a unit, set the time of day, snap to a period boundary, move to the nearest business day, and re-express in another time zone.
# The last second before a year rolls over chrono calc --base today --snap eoy # Ninety business days out, in the American banking calendar chrono calc --base today --shift +90bd --calendar us-banking # Eighteen years and a day back, for an age check chrono calc --base today --shift -18y --shift -1d
Any calculated date goes straight into a substitution session, and
--json emits the same result in machine form.
The dates worth testing →