@hebcal/hdate
    Preparing search index...

    Function birthdayOrAnniversary

    • Calculates a birthday or anniversary (non-yahrzeit) and returns it as an HDate.

      Same calculation as getBirthdayHD, but the result comes back as an HDate instance rather than a plain {yy, mm, dd} object, so it can be rendered (render, renderGematriya) or used for further Hebrew calendar arithmetic directly.

      Note that a birthday is not calculated the same way as a yahrzeit: when the original date is missing from hyear it is postponed rather than moved earlier. See getBirthdayHD for the full algorithm and its edge cases.

      hyear may be the original year, in which case the original date is returned unchanged: someone's birth date is a meaningful day in its own right, not merely the zeroth anniversary of itself. A death has no equivalent — a yahrzeit begins at the first anniversary — which is why yahrzeit rejects the year of death.

      The date argument is never modified, so a single original date can be reused to generate a run of years.

      Parameters

      • hyear: number

        Hebrew year in which to find the anniversary

      • date: AnniversaryDate

        Gregorian or Hebrew date of the original event

      Returns HDate | undefined

      anniversary occurring in hyear, or undefined when hyear precedes the original year

      import {birthdayOrAnniversary} from '@hebcal/hdate';
      const dt = new Date(2014, 2, 2); // '2014-03-02' == '30 Adar I 5774'
      birthdayOrAnniversary(5780, dt)?.toString(); // '1 Nisan 5780'
      birthdayOrAnniversary(5774, dt)?.toString(); // '30 Adar I 5774'
      birthdayOrAnniversary(5773, dt); // undefined