Amidora

Amidora · Library

When a calendar date is invalid or outside the supported range

Tell the converter's three refusals apart: a written date outside YYYY-MM-DD in 1600–2399, a day that does not exist, and a Hebrew date missing from the chosen year.

How the converter checks an input

The civil side applies two tests. First the text must match a four-digit year from 1600 to 2399 followed by a two-digit month and a two-digit day. Format and range are one pattern, so 2026-1-01 fails with the same civil_date_range_1600_2399 message as 1599-12-31. Second, the date is built at noon UTC and must read back as the same text; 2023-02-29 would become 1 March, so it fails as invalid_civil_date.

The Hebrew side first checks that the year is a whole number from 5360 to 6160, that the month is one of 14 identifiers and that the day is 1 to 30. Only then does it look the date up among the civil dates of that Hebrew year. A date missing from that list, such as a thirtieth day the month does not have, returns nonexistent_hebrew_date_or_outside_civil_range.

Gregorian input examples

InputAccepted by this converterReturned date or reason
2024-02-29true2024-02-29
2023-02-29falseinvalid_civil_date
1600-01-01true1600-01-01
2399-12-31true2399-12-31
1599-12-31falsecivil_date_range_1600_2399
2400-01-01falsecivil_date_range_1600_2399
2026-13-01falseinvalid_civil_date
2026-01-32falseinvalid_civil_date
2026-1-01falsecivil_date_range_1600_2399

The written input must use YYYY-MM-DD. The valid leap-day example is 2024-02-29; the same month and day in 2023 is rejected. The supported civil endpoints are 1600-01-01 and 2399-12-31. A date outside those endpoints is not evidence that the date itself is impossible in the Gregorian calendar.

Hebrew month and day examples

YearMonth IDDayAcceptedCivil result or reason
5784adar-i1true2024-02-10
5784adar-ii1true2024-03-11
5784adar1falsenonexistent_hebrew_date_or_outside_civil_range
5785adar-ii1falsenonexistent_hebrew_date_or_outside_civil_range
5784kislev30falsenonexistent_hebrew_date_or_outside_civil_range
5785kislev30true2024-12-31
5359tishrei1falseinvalid_hebrew_date_or_range
6161tishrei1falseinvalid_hebrew_date_or_range

A month name must fit the selected year. The examples distinguish Adar I and Adar II in 5784 from an unavailable Adar II in 5785. They also compare day 30 of Kislev in those two years. A 1–30 day control alone cannot establish that every chosen month has a thirtieth day.

Triage in order

  1. Read the reason code before editing anything.
  2. For a range message on the civil side, check the format first: four-digit year, two-digit month and day.
  3. For invalid_civil_date, check the day against the month and, for 29 February, the year.
  4. For a Hebrew input, check that the month identifier exists in that year, including Adar, Adar I and Adar II.
  5. Keep an input that is genuinely outside the supported range as unsupported.

Two thirtieth days and two edge years

Cheshvan 30 does not exist in 5784, so that input is refused, while Cheshvan 30 in 5785 converts to 2024-12-01. The edge years behave differently from what the year range suggests. The civil range starts on 1600-01-01, which is 14 Tevet 5360, so 1 Tishrei 5360 lies before it and is refused even though 5360 passes the year check. At the other end, 2399-12-31 is 1 Tevet 6160, so 29 Elul 6160 is refused too.

5784 · cheshvan · 30
refused
5785 · cheshvan · 30
2024-12-01
1600-01-01
14 Tevet 5360
2399-12-31
1 Tevet 6160

Mistakes

Boundary of the check

These are date-only conversions with no sunset boundary. The ECMA-402 DateTimeFormat and Hebcal documents listed below describe the Hebrew calendar arithmetic used for the lookup; a reason code is not a religious conclusion.

Tools

Library