Function gregorianToJalali

  • Converts a Gregorian date string (YYYY-MM-DD) to a Jalali (Persian) date string (YYYY-MM-DD).

    Uses the toJalaali function from the jalaali-js library to perform the conversion.

    Parameters

    • gregorianDate: string

      The Gregorian date string in the format YYYY-MM-DD.

    Returns string

    The corresponding Jalali date string in the format YYYY-MM-DD.

    const result = gregorianToJalali("2025-09-22");
    console.log(result); // "1404-06-31"
    const result = gregorianToJalali("2023-03-21");
    console.log(result); // "1402-01-01"