Function buildJalaliYear

  • Calculates the Jalali (Persian) year equivalent to a given Gregorian year.

    The calculation is based on whether the Persian New Year (Nowruz, March 21st) has already occurred relative to the reference date.

    Parameters

    • gregorianYear: number

      The Gregorian year to convert.

    • referenceDate: Date = ...

      The reference date to determine if the Jalali year has started (default: current date).

    Returns number

    The Jalali year corresponding to the provided Gregorian year.

    buildJalaliYear(2025); // returns 1404
    buildJalaliYear(2025, new Date('2025-02-15')); // returns 1403