Support lunar calendar for events
My parents' birthdays are on lunar calendar. Their birthdays change every year on gregorian calendar.
https://en.wikipedia.org/wiki/Lunar_calendar
Might be related to https://github.com/pimutils/khal/issues/774, probably hard do to. PRs welcome and I'm willing to help anyone giving it a try.
First need to find out if the specification and dateutils's rrule support this.
about rule, you can reference here: https://pypi.org/project/LunarCalendar/ or this one: https://github.com/quangvinh86/SolarLunarCalendar
Some findings:
LunarCalendarseems to work fine on Python 2.7 thru 3.9.- The CALSCALE property can indicate that an event uses a different calendar.
- The
RSCALEproperty can be used to indicate which scale (calendar) aRRULEsupports. That's the hard part of RFC7529, and not even the "easy" part has been implemented indateutil: https://github.com/dateutil/dateutil/issues/285 I don't see this happening anytime soon, but if anybody's interested, that'd be the place to start working.
For those interested in birthdays in Lunar calendars, I suggest programatically calculating each year's date, and creating a recurring event with each year's date overridden to the right one. A script that does this should not be very hard. This is basically what RFC7529 suggests:
When generating instances, the following procedure might be used:
Convert the "DTSTART" property value of the master recurring component into the date and time components for the calendar system specified by the "RSCALE" element in the "RRULE" value. This provides the "seed" value for generating subsequent recurrence instances.
Iteratively generate instances using the "RRULE" value applied to the year, month, and day components of the date in the new calendar system.
For each generated instance, convert the dates and times back from the non-Gregorian form into Gregorian and use those values for other properties such as "RECURRENCE-ID".
Consider the following example for an event representing the Chinese New Year:
DTSTART;VALUE=DATE:20130210 RRULE:RSCALE=CHINESE;FREQ=YEARLY SUMMARY:Chinese New Year
To generate instances, first the "DTSTART" value "20130210" is converted into the Chinese calendar system giving "{C}46500101". Next, the year component is incremented by one to give "{C}46510101", and that is then converted back into Gregorian as "20140131". Additional instances are generated by iteratively increasing the year component in the Chinese date and converting back to Gregorian.
This is not hard for recurring events that happen every one year. I suggest an external script to generate those though.
I'm not gonna work on this myself, but hopefully the info helps someone interested.