mirror of
https://github.com/swissmakers/fail2ban-ui.git
synced 2026-04-11 13:47:05 +02:00
Fix time format-desc to match Fail2ban's format
This commit is contained in:
@@ -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 };
|
||||
|
||||
Reference in New Issue
Block a user