chinese-lunar-date API - v1.0.5
    Preparing search index...

    Function newYear

    Low-level pure functions for calendar conversion. Most users should prefer the ChineseDate value object API. These functions are useful when you need fine-grained control or want to build custom logic on top of the core algorithms.

    • Get Chinese New Year (春节) JDE for a Gregorian year

      Computes the JDE of the first day of the lunar year (正月初一). The algorithm determines if the preceding year has a leap month (闰岁) and adjusts the new year date accordingly.

      Results are cached for performance.

      Parameters

      • config: CalendarConfig

        Calendar configuration

      • gyear: number

        Gregorian year

      Returns number

      JDE of Chinese New Year

      const jde = newYear(CHINESE_CONFIG, 2024)
      // Convert to Gregorian date to get the calendar date
      const gc = new julian.CalendarGregorian().fromJDE(jde + 0.5)
      // gc.year=2024, gc.month=2, gc.day=10