Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support lunar calendar #79

Closed
hausen1012 opened this issue Mar 25, 2024 · 4 comments
Closed

Support lunar calendar #79

hausen1012 opened this issue Mar 25, 2024 · 4 comments
Labels
enhancement New feature or request

Comments

@hausen1012
Copy link

Thank you for providing such a useful open source project. I would like to mention my requirement, but I am not sure if it is feasible

Is your feature request related to a problem? Please describe.

In China, most people celebrate their birthdays according to the lunar calendar. When I set a family member's birthday, I need to convert it to the solar calendar. Then, the corresponding solar calendar dates for each year's lunar calendar are different.

So, I hope that when choosing a date, you can choose either a lunar date or a solar date.

Describe the solution you'd like

When adding a lunar date, it is automatically converted to a solar date. After the task runs, the next conversion is automatically performed.

@hausen1012 hausen1012 added the enhancement New feature or request label Mar 25, 2024
@Casvt
Copy link
Owner

Casvt commented Mar 25, 2024

I don't know a lot about the lunar calendar (I'm west-European) so could you confirm something for me?

  1. If I have a lunar date, I can not simply add a year and it will be the same day a year later. The same days one year apart will have different dates.
  2. I can not convert the lunar date to it's solar date, add a year, then convert it back to a lunar date.
  3. Based on bullet 1 and 2, we can say that the calculations needed to properly find the date of the same day but a year later, are totally different from how you do them for the solar calendar.

Because if so, we're out of luck. There is a python library for converting between solar and lunar. However, there is no python library for adding intervals (= finding the date of the birthday next year) like we use for the solar calendar in MIND.

@hausen1012
Copy link
Author

hausen1012 commented Mar 25, 2024

Thank you for your reply. I am happy to discuss this issue with you.

  1. Regarding the lunar calendar, generally speaking, it is possible to simply add one year without changing the date. However, there may be leap months in the lunar calendar, which means there may be two identical months in a year.

  2. It seems that the conversion between the lunar and solar calendars can be calculated, and I learned about it through this link, Python公历转换农历及简易万年历 . Surprisingly, I found that this calculation seemed to be very accurate, and even after checking the correspondence for 2070, it was correct.

I can indeed solve the problem of transitioning between the lunar and solar calendars in this way, but the troublesome point is that there may be leap months, but I don't think this is a critical issue because the most important one is the first month. And even if there is a leap month, there won't be two birthdays in a year.

Finally, I would like to say that I'm sorry, my English is not good. These contents were translated through translation software. If you have any questions, please feel free to communicate with me at any time.

@Casvt
Copy link
Owner

Casvt commented Mar 25, 2024

Thanks for the clarifications. MIND tries to be as accurate and consistent as possible with it's timings and interval calculations. It either has to be correct always or not do it at all. So in order to implement a lunar calendar, it would need to be implemented in such way that it will always work correctly, no matter which year it is, if it is a leap year or not, if it is a certain holiday (if I understand the calendar correctly), etc.

I'm not even close to properly understanding the lunar calendar. If I'm going to implement it, I want to let an external library do all the complicated calculations and let it handle all the special cases (like leap years and having two identical months in a year). It does not seem like there is such a library currently (which I find very surprising by the way) so I think it ends here.

The link you shared supplies code for converting between lunar and solar. This doesn't seem like it will suffice, seeing that it won't really help with properly calculating dates at an interval (for the solar calendar, MIND uses a separate library for calculating intervals exactly for this reason). What I mean with that is that knowing what a certain lunar date is as a solar date won't really help with determining what the lunar date is next year.

I don't have the knowledge myself to implement repeating reminders for a lunar calendar, so unless a library comes out that does it for me, I cannot help you.


P.S. I don't know what translation software you're using, but the English that comes out is excellent.

@Casvt Casvt closed this as not planned Won't fix, can't repro, duplicate, stale Mar 25, 2024
@hausen1012
Copy link
Author

You are right, there are also holidays in the lunar calendar. Perhaps the leap month I mentioned to you may have misled you, but in fact, it can be ignored because it is not important, just an objective existence.

In fact, to calculate the next cycle in the lunar calendar, only the year needs to be modified, without the need to modify other parts.

Regarding the part of the lunar calendar, the most important interval is actually the year. Here, the use of the lunar calendar mainly involves recording birthdays and our traditional festivals.

My idea is to perhaps add a module that distinguishes it from timed reminders, recurring reminders, and weekday reminders. This module can only select lunar dates and only has timed reminders and annual recurring reminders, as I mentioned earlier, other time intervals are not important.

Perhaps this may be a bit difficult for you to understand, but in fact, if you only need to remind by year, you only need to make the year+1 and then calculate a Gregorian date. So, using the method in the link I provided above is actually very simple.

If this plan can be implemented, I think it's really cool. But no matter what, the current version is already very user-friendly, thank you very much!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants