To Jalali icon

To Jalali

Converts Gregorian dates to Persian (Jalali/Shamsi) calendar

Overview

This node converts Gregorian calendar dates into the Persian (Jalali/Shamsi) calendar format. It supports inputting dates either as a complete date string or by specifying year, month, and day separately. The node then outputs the corresponding Jalali date in various customizable formats.

Common scenarios for this node include:

  • Converting timestamps from systems using the Gregorian calendar to Persian calendar dates for localization.
  • Formatting dates for Persian-speaking users in applications, reports, or notifications.
  • Adding Persian calendar date fields alongside existing Gregorian dates in data workflows.

Practical example:

  • Input a full ISO date string like "2025-05-29T14:20:37" and output the equivalent Jalali date formatted as "1404/03/08".
  • Input separate year=2025, month=5, day=29 and get the Persian month name and weekday added as extra fields.

Properties

Name Meaning
Input Type Choose how to input the date:
- Complete Date: Full date string or ISO format.
- Separate Values: Enter year, month, and day separately.
Date Value The full date string to convert (required if Input Type is Complete Date). Examples: ISO date, "May 29th 2025", etc.
Year Gregorian year number (e.g., 2025). Used if Input Type is Separate Values.
Month Gregorian month number (1-12). Used if Input Type is Separate Values.
Day Day of the month (1-31). Used if Input Type is Separate Values.
Output Format Format of the output Jalali date. Options include:
- Custom Format (user-defined pattern)
- Day Month
- Day Month Year
- Full Date and Time
- Month and Year
- Persian Text (weekday and text)
- Short Date
- Short Month and Year
- Weekday and Date
- Year Month Day
- Year/Month/Day (default)
Custom Format Custom date format string using "j" prefix for Jalali parts (e.g., jYYYY for year). Only shown if Output Format is Custom.
Additional Options Collection of optional flags:
- Convert Numbers to Persian: Convert digits to Persian numerals.
- Add Numeric Values: Add year, month, and day as separate numeric fields.
- Add Month Name: Add Persian month name field.
- Add Weekday: Add Persian weekday name field.

Output

The node outputs JSON objects with the following structure:

  • jalaliDate: The main converted date string in the selected format.
  • Optionally, if enabled:
    • jalaliYear, jalaliMonth, jalaliDay: Numeric Jalali date components.
    • jalaliMonthName: Persian name of the Jalali month.
    • jalaliWeekday: Persian name of the weekday.
  • If input was separate values without a full date, partial Jalali date fields may be present such as jalaliYearMonth, jalaliYearMonthText, jalaliMonthDay, jalaliMonthDayText.
  • In case of errors (if continue on fail is enabled), an error field with the error message is included.

The node does not output binary data.

Dependencies

  • Uses the moment-jalaali library for date parsing and Jalali calendar conversion.
  • Requires standard n8n environment with access to this library bundled.
  • No external API keys or services are needed.

Troubleshooting

  • No date value provided: When using Complete Date input type, ensure the date string is not empty.
  • Invalid date format: The node expects standard date formats (ISO, common readable formats). If parsing fails, try using a different format or the Separate Values input type.
  • Invalid date values: When entering year/month/day separately, at least one must be non-zero and form a valid date.
  • Error messages: Errors thrown will indicate missing inputs or invalid formats. Enabling "Continue On Fail" allows processing other items even if some fail.
  • Persian numbers option: If enabled, all digits in output are converted to Persian numerals; disable if you want standard Arabic numerals.

Links and References

Discussion