Skip to content

Commit

Permalink
fix(cdk): redundant assert log if hours are greater than 23
Browse files Browse the repository at this point in the history
  • Loading branch information
a.beltsov committed Aug 9, 2024
1 parent e4a3cdb commit 1abe66b
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 1abe66b

Please sign in to comment.