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
| Input | Accepted by this converter | Returned date or reason |
|---|---|---|
| 2024-02-29 | true | 2024-02-29 |
| 2023-02-29 | false | invalid_civil_date |
| 1600-01-01 | true | 1600-01-01 |
| 2399-12-31 | true | 2399-12-31 |
| 1599-12-31 | false | civil_date_range_1600_2399 |
| 2400-01-01 | false | civil_date_range_1600_2399 |
| 2026-13-01 | false | invalid_civil_date |
| 2026-01-32 | false | invalid_civil_date |
| 2026-1-01 | false | civil_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
| Year | Month ID | Day | Accepted | Civil result or reason |
|---|---|---|---|---|
| 5784 | adar-i | 1 | true | 2024-02-10 |
| 5784 | adar-ii | 1 | true | 2024-03-11 |
| 5784 | adar | 1 | false | nonexistent_hebrew_date_or_outside_civil_range |
| 5785 | adar-ii | 1 | false | nonexistent_hebrew_date_or_outside_civil_range |
| 5784 | kislev | 30 | false | nonexistent_hebrew_date_or_outside_civil_range |
| 5785 | kislev | 30 | true | 2024-12-31 |
| 5359 | tishrei | 1 | false | invalid_hebrew_date_or_range |
| 6161 | tishrei | 1 | false | invalid_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
- Read the reason code before editing anything.
- For a range message on the civil side, check the format first: four-digit year, two-digit month and day.
- For invalid_civil_date, check the day against the month and, for 29 February, the year.
- For a Hebrew input, check that the month identifier exists in that year, including Adar, Adar I and Adar II.
- 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
- Reading a range message as proof that a date never existed.
- Typing a one-digit month and then moving the date into range.
- Replacing Adar II with Adar in a year that has no Adar II, without checking the source date.
- Assuming a year between 5360 and 6160 is fully convertible.
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.