Skip to content

Commit

Permalink
fix(cdk): redundant assert log if hours are greater than 23 (#8449)
Browse files Browse the repository at this point in the history
Co-authored-by: a.beltsov <[email protected]>
  • Loading branch information
Chiorufarewerin and a.beltsov authored Aug 12, 2024
1 parent 9572412 commit ef7e6f1
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion projects/cdk/date-time/time.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,16 @@ export class TuiTime implements TuiTimeLike {
) {
ngDevMode &&
tuiAssert.assert(
TuiTime.isValidTime(hours, minutes, seconds, ms),
// Currently `TuiTime` could have hours more than 23
// in order to not break current behaviour of `isValidTime` the logic is duplicated
Number.isInteger(hours) &&
tuiInRange(hours, 0, Infinity) &&
Number.isInteger(minutes) &&
tuiInRange(minutes, 0, MINUTES_IN_HOUR) &&
Number.isInteger(seconds) &&
tuiInRange(seconds, 0, SECONDS_IN_MINUTE) &&
Number.isInteger(ms) &&
tuiInRange(ms, 0, 1000),
'Time must be real, but got:',
hours,
minutes,
Expand Down

0 comments on commit ef7e6f1

Please sign in to comment.