Readds leap year checks (#2)

This commit is contained in:
voloved
2024-10-27 14:04:56 -04:00
committed by GitHub
parent c0514ad39a
commit d05a851d94
7 changed files with 15 additions and 25 deletions

View File

@@ -51,7 +51,7 @@ static void _handle_alarm_button(watch_date_time_t date_time, uint8_t current_pa
date_time.unit.month = (date_time.unit.month % 12) + 1;
break;
case 3: { // day
date_time.unit.day = date_time.unit.day + 1;
date_time.unit.day = (date_time.unit.day % watch_utility_days_in_month(date_time.unit.month, date_time.unit.year + WATCH_RTC_REFERENCE_YEAR)) + 1;
break;
case 4: // hour
date_time.unit.hour = (date_time.unit.hour + 1) % 24;
@@ -64,8 +64,6 @@ static void _handle_alarm_button(watch_date_time_t date_time, uint8_t current_pa
break;
}
}
if (date_time.unit.day > days_in_month(date_time.unit.month, date_time.unit.year + WATCH_RTC_REFERENCE_YEAR))
date_time.unit.day = 1;
movement_set_local_date_time(date_time);
}