@hebcal/hdate
    Preparing search index...

    Function getBirthdayHD

    • Calculates a birthday or anniversary (non-yahrzeit) and returns it as a SimpleHebrewDate ({yy, mm, dd}). hyear must be on or after original date of anniversary. Returns undefined when requested year preceeds the original year.

      Hebcal uses the algorithm defined in "Calendrical Calculations" by Edward M. Reingold and Nachum Dershowitz.

      This is not the same calculation as a yahrzeit. When the original date is missing from the target year, a birthday is postponed to the first of the following month, whereas a yahrzeit moves earlier to the last day of the preceding month. Passing the same original date to both functions can therefore return dates almost a month apart.

      Unlike getYahrzeitHD, hyear may equal the original year, in which case the original date is returned unchanged. A birth date is a meaningful day in its own right — it is the day the person was born, not merely the zeroth anniversary of it. A death has no comparable day: a yahrzeit only begins to exist on the first anniversary, which is why getYahrzeitHD rejects the year of death.

      The birthday of someone born in Adar of an ordinary year or Adar II of a leap year is also always in the last month of the year, be that Adar or Adar II. The birthday in an ordinary year of someone born during the first 29 days of Adar I in a leap year is on the corresponding day of Adar; in a leap year, the birthday occurs in Adar I, as expected.

      Someone born on the thirtieth day of Marcheshvan, Kislev, or Adar I has his birthday postponed until the first of the following month in years where that day does not occur. [Calendrical Calculations p. 111]

      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 SimpleHebrewDate | undefined

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

      birthdayOrAnniversary for the same result as an HDate instance

      import {getBirthdayHD} from '@hebcal/hdate';
      const dt = new Date(2014, 2, 2); // 30 Adar I 5774
      getBirthdayHD(5780, dt); // {yy: 5780, mm: 1, dd: 1} (1 Nisan)