Function buildYears

  • Builds a descending list of Persian years (with their approximate Gregorian equivalents).

    • The current Persian year is calculated based on the Gregorian date and Nowruz (March 21).
    • The list goes back to minimumYearInList and can extend into the future with tillYearsFromNow.

    Parameters

    • minimumYearInList: number = 1350

      The earliest Persian year to include in the list. Defaults to 1350.

    • tillYearsFromNow: number = 0

      Number of additional years to include beyond the current Persian year. Defaults to 0.

    Returns ManufactureYear[]

    An array of ManufactureYear objects containing Persian and Gregorian year mappings.

    const years = buildYears();
    console.log(years[0]);
    // { text: "1404 - 2025", value: "1404", gregorianValue: "2025" }
    const years = buildYears(1390, 2);
    console.log(years[0]);
    // { text: "1406 - 2027", value: "1406", gregorianValue: "2027" }