Lunar Calendar VI icon

Lunar Calendar VI

Chuyển đổi giữa âm lịch và dương lịch Việt Nam

Overview

This node converts dates between the Vietnamese lunar calendar (Âm lịch) and the Gregorian solar calendar (Dương lịch). It supports two main operations:

  • Solar to Lunar: Converts a given Gregorian date to its corresponding Vietnamese lunar date.
  • Lunar to Solar: Converts a given Vietnamese lunar date to its corresponding Gregorian date.

Common scenarios for this node include cultural, historical, or traditional applications where lunar dates are significant, such as determining festival dates, planning events according to the lunar calendar, or converting birthdates between calendars.

For example:

  • Converting today’s Gregorian date to the Vietnamese lunar date to check traditional holidays.
  • Converting a specific lunar birthday to the Gregorian calendar for scheduling.

Properties

Name Meaning
Thao tác Operation to perform: "Dương lịch sang Âm lịch" (solarToLunar) or "Âm lịch sang Dương lịch" (lunarToSolar)
Nguồn dữ liệu Data source for conversion when operation is solarToLunar: "Ngày hiện tại" (current date) or "Ngày cụ thể" (specific date)
Ngày Day of the month (used when data source is specific and operation is solarToLunar or lunarToSolar)
Tháng Month number (used when data source is specific and operation is solarToLunar or lunarToSolar)
Năm Year number (used when data source is specific and operation is solarToLunar or lunarToSolar)
Ngày âm lịch Lunar day (used only in lunarToSolar operation)
Tháng âm lịch Lunar month (used only in lunarToSolar operation)
Năm âm lịch Lunar year (used only in lunarToSolar operation)
Tháng nhuận Boolean indicating if the lunar month is a leap month (used only in lunarToSolar operation)

Output

The output JSON contains detailed information about both the solar and lunar dates involved in the conversion. The structure depends on the operation:

  • For solarToLunar:

    {
      "solar": {
        "day": <number>,
        "month": <number>,
        "year": <number>,
        "leap_year": <boolean>
      },
      "lunar": {
        "day": <number>,
        "month": <number>,
        "year": <number>,
        "leap_year": <boolean>,
        "leap_month": <boolean>,
        "year_name": "<string>",   // Traditional Vietnamese year name
        "month_name": "<string>",  // Traditional Vietnamese month name
        "day_name": "<string>"     // Traditional Vietnamese day name
      },
      "julian": <number>           // Julian day number of the lunar date
    }
    
  • For lunarToSolar:

    {
      "lunar": {
        "day": <number>,
        "month": <number>,
        "year": <number>,
        "leap_year": <boolean>,
        "leap_month": <boolean>,
        "year_name": "<string>",
        "month_name": "<string>",
        "day_name": "<string>",
        "julian": <number>
      },
      "solar": {
        "day": <number>,
        "month": <number>,
        "year": <number>,
        "leap_year": <boolean>,
        "date": "<Date object>"  // JavaScript Date object representing the solar date
      }
    }
    

No binary data output is produced by this node.

Dependencies

  • Uses an external library for Vietnamese lunar calendar calculations (@nghiavuive/lunar_date_vi).
  • Requires no special API keys or external services.
  • Runs fully within n8n environment with standard JavaScript Date support.

Troubleshooting

  • Invalid date inputs: Providing invalid day/month/year values may cause errors. Ensure that the input dates are valid calendar dates.
  • Leap month handling: When converting from lunar to solar, specifying whether the lunar month is a leap month is important; incorrect setting can lead to wrong conversions.
  • Error messages: If an error occurs during conversion, the node outputs an error message in the JSON field under error. Common causes include invalid date ranges or unsupported dates.
  • To resolve errors, verify input parameters and ensure they conform to expected calendar rules.

Links and References

Discussion