Lunar Calendar Convert
Introduction
The Lunar Calendar Convert module is a tool for converting solar dates to lunar dates in Odoo. This module provides utility functions to perform date conversions accurately.
Features
- Convert solar dates to lunar dates
- Time zone support (default is UTC+7)
- Date validation
- Accurate leap month calculation
Usage
To use this module, you can call the convertSolar2Lunar
function from anywhere in your Odoo code:
from odoo import tools # Convert solar date to lunar date lunar_date = tools.convertSolar2Lunar(dd, mm, yy, timeZone=7)
Parameters:
dd
: Solar day (1-31)mm
: Solar month (1-12)yy
: Solar yeartimeZone
: Time zone (default is 7 - UTC+7)
Return Value:
The function returns a string in the format: "YYYY-MM-DD"
- YYYY: Lunar year
- MM: Lunar month (01-12)
- DD: Lunar day (01-30)
Note: The function will return
False
if the input date is invalid.
Example
# Convert February 15, 2024 to lunar date lunar_date = tools.convertSolar2Lunar(15, 2, 2024) # Result: "2024-01-06" (6th day of the first lunar month in Year of the Dragon)
Please log in to comment on this module