Bug Tracker

Ticket #3866 (closed enhancement: invalid)

Opened 6 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.

Note: See TracTickets for help on using tickets.