Opened 5 years ago

Closed 3 years ago

Last modified 3 years ago

#8353 closed bug (fixed)

Datepicker: parseDate accepts dates with two year digits with format 'mm/dd/yy' which should require four year digits

Reported by: andrewwhitaker Owned by:
Priority: minor Milestone: 1.11.1
Component: ui.datepicker Version: 1.8.20
Keywords: Cc:
Blocked by: Blocking:

Description

var d = "12/12/12";
var parsed = $.datepicker.parseDate("mm/dd/yy", d); // yields 12/12/2012, should not succeed.

Example: http://jsfiddle.net/WWJfn/

An exception should be thrown here instead of the date being parsed successfully.

Change History (13)

comment:1 Changed 4 years ago by scottgonzalez

  • Milestone changed from 1.9.0 to 1.11.0

comment:2 Changed 4 years ago by mikesherov

  • Priority changed from minor to undetermined
  • Status changed from new to open

comment:4 Changed 4 years ago by mikesherov

  • Priority changed from undetermined to minor

comment:5 Changed 4 years ago by tj.vantoll

  • Summary changed from parseDate accepts dates with two year digits with format 'mm/dd/yy' which should require four year digits. to Datepicker: parseDate accepts dates with two year digits with format 'mm/dd/yy' which should require four year digits

Still an issue as of 1.9.2 - http://jsfiddle.net/tj_vantoll/en69t/.

comment:6 follow-up: Changed 4 years ago by PRISMAY

Any chance of getting this fixed sooner than later please? We're using this in a date range control and the user input is getting messed up because we depend on parseDate to return a valid value only when the format matches the input.

If there's a workaround, it would be greatly appreicated. Thank you.

comment:7 Changed 4 years ago by scottgonzalez

@PRISMAY If it's a blocker for you, then it seems it would be beneficial for you to dig in, track down the bug, figure out a fix, and submit a pull request.

comment:8 Changed 4 years ago by tj.vantoll

#9419 is a duplicate of this ticket.

comment:9 in reply to: ↑ 6 Changed 4 years ago by r3dqu33n

Replying to PRISMAY:

Any chance of getting this fixed sooner than later please? We're using this in a date range control and the user input is getting messed up because we depend on parseDate to return a valid value only when the format matches the input.

If there's a workaround, it would be greatly appreicated. Thank you.

Hi, i had a problem like yours and using something like this http://jsfiddle.net/FDAkp/ inside the jquery ui js solved my problem.

Excuse me if i'm doing it the wrong way and drop it.

comment:10 Changed 3 years ago by rod333

Submitted a pull request for this bug: https://github.com/jquery/jquery-ui/pull/1248

comment:11 Changed 3 years ago by scottgonzalez

  • Milestone changed from 1.11.0 to none

comment:12 Changed 3 years ago by Rodrigo Menezes

  • Resolution set to fixed
  • Status changed from open to closed

Datepicker: reject dates with two year digits when expecting 'yy'

Fixes #8353 Closes gh-1248

Changeset: 573037423822fa04a1888e3bcc52243b9324c5e2

comment:13 Changed 3 years ago by tj.vantoll

  • Milestone changed from none to 1.11.1
Note: See TracTickets for help on using tickets.