Skip to content

Commit

Permalink
Added support date range
Browse files Browse the repository at this point in the history
  • Loading branch information
JanGalek authored and Milan Felix Šulc committed Jan 9, 2018
1 parent 3f9bc43 commit c53f6ee
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions live-form-validation.js
Original file line number Diff line number Diff line change
Expand Up @@ -963,6 +963,13 @@ Nette.validators = {
return null;
}
}

if (elem.type === 'date') {
arg[0] = (arg[0] === null ? null : new Date(arg[0]).getTime());
arg[1] = (arg[1] === null ? null : new Date(arg[1]).getTime());
val = new Date(val).getTime()
}

return Nette.isArray(arg) ?
((arg[0] === null || parseFloat(val) >= arg[0]) && (arg[1] === null || parseFloat(val) <= arg[1])) : null;
},
Expand Down

0 comments on commit c53f6ee

Please sign in to comment.