Skip to content

Conversation

@SanchoCC
Copy link

Fixed the birthday selection box for February. Currently (as shown in the GIF), leap years are determined incorrectly: leap years don’t have the 29th day, while non-leap years do. If you try to select that date, nothing happens because the logic in Telegram/SourceFiles/data/data_birthday.cpp is correct and prevents setting an invalid date.
Now everything should display correctly.
2025-07-1014-51-06-ezgif com-crop

@CLAassistant
Copy link

CLAassistant commented Jul 10, 2025

CLA assistant check
All committers have signed the CLA.

@john-preston
Copy link
Member

The check there is ((!year || ((year % 4) && (!(year % 100) || (year % 400)))), I'm not sure your fix is correct, because at least when the year isn't specified at all (!year case) we need 29. It feels the check for case 29 should be something like:

!year || (!(year % 4) && ((year % 100) || !(year % 400)))

@john-preston
Copy link
Member

So that we have 29 if year is: 0, 1920, 1996, 2000, 2004, 2020, and we have 28 if year is: 1900, 1921, 1999, 2100.

@john-preston
Copy link
Member

Current code doesn't make sense at all (and you left it as it was), because this part (year % 4) && (!(year % 100)) can never be true, if year % 4 != 0 you can't have year % 100 == 0.

@john-preston
Copy link
Member

ok, I've added that code

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants