Fix time format-desc to match Fail2ban's format

This commit is contained in:
2026-01-14 22:38:20 +01:00
parent 44da16977c
commit 3e5f3dbec6
7 changed files with 15 additions and 14 deletions

View File

@@ -2,11 +2,12 @@
function validateTimeFormat(value, fieldName) {
if (!value || !value.trim()) return { valid: true }; // Empty is OK
const timePattern = /^\d+[smhdwmy]$/i;
// Support: s (seconds), m (minutes), h (hours), d (days), w (weeks), mo (months), y (years)
const timePattern = /^\d+([smhdwy]|mo)$/i;
if (!timePattern.test(value.trim())) {
return {
valid: false,
message: 'Invalid time format. Use format like: 1h, 30m, 2d, 1w, 1m, 1y'
message: 'Invalid time format. Use format: 1m = 1 minute, 1h = 1 hour, 1d = 1 day, 1w = 1 week, 1mo = 1 month, 1y = 1 year'
};
}
return { valid: true };