Bug Tracker

Opened 7 years ago

Closed 6 years ago

#3866 closed enhancement (invalid)

[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:
Blocked by: Blocking:

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 (2)

comment:1 Changed 6 years ago by dmethvin

  • Owner set to joern

comment:2 Changed 6 years ago by john

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

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

Note: See TracTickets for help on using tickets.