Skip to content

Commit

Permalink
[MaterialTimePicker] Limit 24h input validation to 23
Browse files Browse the repository at this point in the history
Resolves #3149

PiperOrigin-RevId: 501869529
  • Loading branch information
paulfthomas authored and raajkumars committed Jan 17, 2023
1 parent 7f0db1a commit 7f1def6
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ public TimeModel(int hour, int minute, @ActiveSelection int selection, @TimeForm
this.format = format;
period = getPeriod(hour);
minuteInputValidator = new MaxInputValidator(59);
hourInputValidator = new MaxInputValidator(format == CLOCK_24H ? 24 : 12);
hourInputValidator = new MaxInputValidator(format == CLOCK_24H ? 23 : 12);
}

protected TimeModel(Parcel in) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public void with12HFormat_hasCorrectValidators() {
public void with24HFormat_hasCorrectValidators() {
TimeModel timeModel = new TimeModel(CLOCK_24H);

assertThat(timeModel.getHourInputValidator().getMax()).isEqualTo(24);
assertThat(timeModel.getHourInputValidator().getMax()).isEqualTo(23);
assertThat(timeModel.getMinuteInputValidator().getMax()).isEqualTo(59);
}

Expand Down

0 comments on commit 7f1def6

Please sign in to comment.