Amidora

Amidora · Library

How can a calendar date conversion be checked by converting it back?

Check a conversion by reversing it: 2024-03-24 gives 14 Adar II 5784 and converts back exactly, while 14 Adar 5784 is refused because 5784 has no plain Adar.

Why reversing the result works

The converter turns a civil date into a Hebrew year, a month identifier and a day, and can turn those three values back into a civil date. If the second conversion returns the date you started with, no field was lost on the way. The check is strongest around leap years, where the month identifier carries information that a plain month name may not.

Both directions use the same convention: the civil date is taken at noon UTC and formatted in the Hebrew calendar. Mixing in a timestamp shown in another time zone breaks the comparison.

Worked example

The civil date 16 September 2023 converts to 1 Tishrei 5784. Reversing that complete Hebrew date gives 2023-09-16. No sunset time is calculated in either direction.

Gregorian civil date after reversing the Hebrew date
2023-09-16

Doing the check

  1. Convert the civil date and write down the full result: year, month and day.
  2. Enter exactly those values in the Hebrew-to-civil direction.
  3. Compare the returned civil date with the original.
  4. If the reverse step is refused, compare the month identifier with the year before changing the day.

A leap-year roundtrip

2024-03-24 converts to 14 Adar II 5784, and 5784 · adar-ii · 14 converts back to 2024-03-24. If the result were saved as 14 Adar 5784, the reverse step would be refused, because a leap year has no plain Adar. The same date of the month a year later, 2025-03-14, converts to 14 Adar 5785, and entering 14 Adar I 5785 is refused for the opposite reason.

2024-03-24 → back
2024-03-24
5784 · adar · 14
refused
2025-03-14 → back
2025-03-14
5785 · adar-i · 14
refused

Mistakes

Limits

A roundtrip shows arithmetic consistency only. The ECMA-402 DateTimeFormat and Hebcal documents listed below describe the calendar used; neither direction calculates sunset or decides an anniversary.

Primary sources and related work