Modify ↓
Ticket #4781 (closed enhancement: invalid)
new validate method
| Reported by: | mikeybates | Owned by: | joern |
|---|---|---|---|
| Priority: | major | Milestone: | 1.4 |
| Component: | plugin | Version: | 1.3.2 |
| Keywords: | Cc: | ||
| Blocking: | Blocked by: |
Description
please consider this as a replacement for the dateISO validation. The new regular expression comes from here: http://regexlib.com/REDetails.aspx?regexp_id=2092 and checks for ISO date format. The old method would allow things like 2009-31-31 and 2009-02-31
dateISO: function(value, element) {
return this.optional(element) /(\d{4}(?:(?:(?:\-)?(?:00[1-9]|0[1-9][0-9]|[1-2][0-9][0-9]|3[0-5][0-9]|36[0-6]))?|(?:(?:\-)?(?:1[0-2]|0[1-9]))?|(?:(?:\-)?(?:1[0-2]|0[1-9])(?:\-)?(?:0[1-9]|[12][0-9]|3[01]))?|(?:(?:\-)?W(?:0[1-9]|[1-4][0-9]5[0-3]))?|(?:(?:\-)?W(?:0[1-9]|[1-4][0-9]5[0-3])(?:\-)?[1-7])?)?)$/.test(value);
}
Change History
Please follow the bug reporting guidlines and use jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.
Note: See
TracTickets for help on using
tickets.
