• Checks if a given lunar date is valid. A lunar date consists of a year, month, and day, and optionally a leap month flag. This function ensures that the lunar date is an object with valid year, month, and day values, and that the date falls within the valid lunar calendar range.

    Parameters

    • lunar: unknown

      The lunar date to check. It should be an object with properties year, month, day, and optionally isLeapMonth.

    Returns lunar is LunarDate

    True if the lunar date is valid, otherwise false.

    // => true
    isValidLunar({ year: 2024, month: 1, day: 1 })
    // => true
    isValidLunar({ year: 2024, month: 1, day: 1, isLeapMonth: false })
    // => false
    isValidLunar({ year: 2025, month: 1 })
    // => false
    isValidLunar({ year: 2100, month: 12, day: 2 })