Bug Tracker

Modify

Ticket #3866 (closed enhancement: invalid)

Opened 5 years ago

Last modified 4 years ago

[validate] dateDE validation with sanity checks

Reported by: Peter Grefenstein Owned by: joern
Priority: minor Milestone: 1.3
Component: plugin Version: 1.2.6
Keywords: validate dateDE Cc:
Blocking: Blocked by:

Description

I suggest to extend the dateDE method with sanity check.

dateDE: function(value, element) {

if (/\d\d?\.\d\d?\.\d\d(\d\d)?$/.test(value)) {

var dateElements = value.split("."); if(dateElements[2].length == 2 )

dateElements[2] = 20 + dateElements[2];

var newDate = new Date(dateElements[2], dateElements[1]-1, dateElements[0]); if ( !/Invalid|NaN/.test(newDate) && (newDate.getDate() == dateElements[0]) && (newDate.getMonth() == dateElements[1]-1) && (newDate.getFullYear() == dateElements[2])) {

return this.optional(element)
true;

}

} return false;

},

Change History

comment:1 Changed 5 years ago by dmethvin

  • Owner set to joern

comment:2 Changed 4 years ago by john

  • Status changed from new to closed
  • Resolution set to invalid

Please file plugin bugs with the appropriate author on their bug tracker.

Please follow the  bug reporting guidlines and use  jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.

View

Add a comment

Modify Ticket

Action
as closed
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.