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

Display leap day anniversaries every year on calendars #1318

Merged
merged 1 commit into from Jul 27, 2023

Conversation

SNoiraud
Copy link
Member

@SNoiraud SNoiraud commented Dec 26, 2021

Fixes #12511

Birthday on February 29th only taken into account every 4 years
in the calendars

Added an option in the preferences display tab
If checked, we display the birthday on march 1 for non-leap years
If not checked, we display the birthday on february 28 for non-leap years
When we have a leap year, display the date on february 29

@SNoiraud SNoiraud added this to the v5.2 milestone Dec 26, 2021
@emyoulation
Copy link
Contributor

Ummm. Kinda curious if it handles leap centuries... since we just had one in 2000.

@SNoiraud
Copy link
Member Author

Kinda curious if it handles leap centuries... since we just had one in 2000.

I use the isleap method from the calendar library. I expect the standard function is correct about centuries and multiple of 400 years.

gramps/plugins/drawreport/calendarreport.py Outdated Show resolved Hide resolved
gramps/gui/configure.py Show resolved Hide resolved
@Nick-Hall Nick-Hall added string Requires string changes Conflicts labels Jul 14, 2023
@Nick-Hall
Copy link
Member

@SNoiraud The duplicate code needs to be put in a utility function. There is also a conflict to resolve.

@Nick-Hall
Copy link
Member

@SNoiraud I suggest a new anniversary(year) date method, to return the day and month of the anniversary of a date in a given year.

For example: Date(1904,2,29).anniversary(1910) would return (28, 2), (1, 3) or (29, 2) depending on the preference settings.

I have added a commit with the function and associated unit tests. Run them with:

GRAMPS_RESOURCES=. python -m unittest gramps.gen.lib.test.date_test.AnniversaryDateTest

Let me know if this is OK.

Added a new anniversary method to dates which returns a day and
month on which to display leap day anniversaries on non-leap
years.

Added an option in the preferences display tab which allows the
user to specify on which day the anniversary should be displayed.
The options are: 28th Feb, 1st Mar or only on 29th Feb.

Fixes #12511
@Nick-Hall
Copy link
Member

Rebased.

@Nick-Hall Nick-Hall changed the title Birthday on February 29 displayed every 4 years Display leap day anniversaries every year on calendars Jul 27, 2023
@Nick-Hall Nick-Hall merged commit f59e4d2 into gramps-project:master Jul 27, 2023
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement string Requires string changes
Projects
None yet
4 participants