Merge "Fix incorrect leap year logic" am: ca13216bd1

am: ef56b49dfd

Change-Id: I815ad6a124dc7e9cc7a9ac3e9163f849711b537c
This commit is contained in:
Neil Fuller
2019-04-17 08:28:11 -07:00
committed by android-build-merger

View File

@@ -581,7 +581,7 @@ class DatePickerCalendarDelegate extends DatePicker.AbstractDatePickerDelegate {
return DatePicker.class.getName();
}
public static int getDaysInMonth(int month, int year) {
private static int getDaysInMonth(int month, int year) {
switch (month) {
case Calendar.JANUARY:
case Calendar.MARCH:
@@ -597,7 +597,7 @@ class DatePickerCalendarDelegate extends DatePicker.AbstractDatePickerDelegate {
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");
}