Merge pull request #1371 from nealterrell/patch-1

Include the 100/400 year check for leap years in MagTag Year Progress demo
This commit is contained in:
Limor "Ladyada" Fried 2020-12-15 17:09:16 -05:00 committed by GitHub
commit e32b99320a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -14,7 +14,7 @@ import rtc
def days_in_year(date_obj):
# check for leap year
if date_obj.tm_year % 4 == 0:
if (date_obj.tm_year % 100 != 0 or date_obj.tm_year % 400 == 0) and date_obj.tm_year % 4 == 0:
return 366
return 365