@hebcal/hdate
    Preparing search index...

    Function yahrzeit

    • Calculates yahrzeit, the anniversary of a death, and returns it as an HDate.

      Same calculation as getYahrzeitHD, 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 yahrzeit is not calculated the same way as a birthday: when the original date is missing from hyear it moves earlier rather than later. See getYahrzeitHD for the full algorithm and its edge cases (Marcheshvan 30, Kislev 30, Adar I / Adar II).

      hyear must be strictly after the year of death. A yahrzeit is an anniversary of a death, so the first one is the earliest that exists — the day of the death itself is not a yahrzeit, and there is no meaningful "zeroth" one to return. This is the one place where birthdayOrAnniversary legitimately accepts a year that this function rejects: a birth date is a real day in its own right.

      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 death

      Returns HDate | undefined

      anniversary occurring in hyear, or undefined when hyear is on or before the year of death

      import {yahrzeit} from '@hebcal/hdate';
      const dt = new Date(2014, 2, 2); // '2014-03-02' == '30 Adar I 5774'
      yahrzeit(5780, dt)?.toString(); // '30 Sh\'vat 5780'
      yahrzeit(5780, dt)?.renderGematriya(); // 'ל׳ שְׁבָט תש״פ'
      yahrzeit(5774, dt); // undefined (year of death)