[gnome-contacts] Ensure correct handling of February 2000 in birthday editor
- From: Niels De Graef <nielsdg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-contacts] Ensure correct handling of February 2000 in birthday editor
- Date: Sun, 3 Oct 2021 16:31:34 +0000 (UTC)
commit 5350ec53ae7241b372a54bbfb8a8d0e224bab6fd
Author: Charles Keepax <ckeepax gmail com>
Date: Tue Sep 21 21:32:19 2021 +0100
Ensure correct handling of February 2000 in birthday editor
There is a third rule for leap year handling which is that years
divisible by 400 are leap years. Normally this isn't a huge issue since
it only happens every 400 years, but the year 2000 was one of those
years which is well within the reasonable range of current birthdays and
the current system will not accept the 29th of February 2000 as a valid
date.
src/contacts-editor-property.vala | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
---
diff --git a/src/contacts-editor-property.vala b/src/contacts-editor-property.vala
index 14fa933f..d03cde3b 100644
--- a/src/contacts-editor-property.vala
+++ b/src/contacts-editor-property.vala
@@ -104,8 +104,9 @@ public class Contacts.BirthdayEditor : Gtk.Dialog {
if (month_combo.get_active () in month_of_31) {
day_spin.set_range (1, 30);
} else if (month_combo.get_active () == 1) {
- if (year_spin.get_value_as_int () % 4 == 0 &&
- year_spin.get_value_as_int () % 100 != 0) {
+ if (year_spin.get_value_as_int () % 400 == 0 ||
+ (year_spin.get_value_as_int () % 4 == 0 &&
+ year_spin.get_value_as_int () % 100 != 0)) {
day_spin.set_range (1, 29);
} else {
day_spin.set_range (1, 28);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]