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

    Function parseCompact

    Date formatting with pattern tokens. See PATTERNS for presets and the format function docs for the full token reference table.

    • Parse a compact format string back to LunarDateValue

      The compact format uses / as separator and encodes leap as 0/1.

      Parameters

      • str: string

        Compact format string (e.g., "78/34/7/0/28")

      Returns LunarDateValue | null

      LunarDateValue, or null if the string is malformed

      parseCompact('78/34/5/0/6')   // { cycle: 78, year: 34, month: 5, leap: false, day: 6 }
      parseCompact('78/34/2/1/15') // { cycle: 78, year: 34, month: 2, leap: true, day: 15 }
      parseCompact('invalid') // null