Skip to content

Commit

Permalink
luci-base: use correct regex for time validation
Browse files Browse the repository at this point in the history
Before this change, values further in time than 23:59:59 was allowed, such as 24:00:00 and 23:60:00. Leap seconds is accounted for so 60 is allowed in the seconds parameter.

Signed-off-by: Daniel Nilsson <daniel.nilsson94@outlook.com>
  • Loading branch information
dannil authored and systemcrash committed Mar 7, 2024
1 parent 464c659 commit c68ec2f
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -563,7 +563,7 @@ var ValidatorFactory = baseclass.extend({
},

timehhmmss: function() {
return this.assert(this.value.match(/^[0-6][0-9]:[0-6][0-9]:[0-6][0-9]$/),
return this.assert(this.value.match(/^(?:[01]\d|2[0-3]):[0-5]\d:(?:[0-5]\d|60)$/),
_('valid time (HH:MM:SS)'));
},

Expand Down

0 comments on commit c68ec2f

Please sign in to comment.