luci-app-nlbwmon: validate date input

Fixes: #6188
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
This commit is contained in:
Jo-Philipp Wich 2023-01-13 21:26:52 +01:00
parent 25983b9fa5
commit 7c7ac8bf0d

View file

@ -102,6 +102,9 @@ return view.extend({
return m ? m[1] : null;
};
o.validate = function(section_id, value) {
return /^[0-9]{4}-[0-9]{2}-[0-9]{2}$/.exec(value) ? true : _('Require a valid date in the form "YYYY-MM-DD"');
};
o.write = writePeriod;
o.depends('_period', 'absolute');