commit | f29bf1f9342b7991dcbfd828c65614c33f964b42 | [log] [tgz] |
---|---|---|
author | Neil Fuller <nfuller@google.com> | Wed Apr 17 15:57:04 2019 +0100 |
committer | Neil Fuller <nfuller@google.com> | Wed Apr 17 18:09:20 2019 +0100 |
tree | e626936d2c10487db6cd1439bf6d30b50699ab72 | |
parent | b38a37cb1ca2fba2c65a744d774bb382e10cd886 [diff] |
Fix incorrect leap year logic Fixing an issue for 2100. Bug: 28784177 Test: build only Change-Id: I7fc324445c79c881994cfdded9685c156efe5538
diff --git a/src/com/android/datetimepicker/Utils.java b/src/com/android/datetimepicker/Utils.java index 6c0adbe..cf3df7c 100644 --- a/src/com/android/datetimepicker/Utils.java +++ b/src/com/android/datetimepicker/Utils.java
@@ -77,7 +77,7 @@ case Calendar.NOVEMBER: return 30; case Calendar.FEBRUARY: - return (year % 4 == 0) ? 29 : 28; + return (year % 4 == 0 && (year % 100 != 0 || year % 400 == 0)) ? 29 : 28; default: throw new IllegalArgumentException("Invalid Month"); }