Skip to main content

Search and Top Navigation

#8353 closed bug (fixed)

Opened May 25, 2012 03:38PM UTC

Closed July 14, 2014 01:35PM UTC

Last modified July 14, 2014 01:36PM UTC

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.

Attachments (0)
Change History (13)

Changed October 11, 2012 02:45PM UTC by scottgonzalez comment:1

milestone: 1.9.01.11.0

Changed October 19, 2012 08:23PM UTC by mikesherov comment:2

priority: minorundetermined
status: newopen

Changed October 19, 2012 08:23PM UTC by mikesherov comment:3

Changed October 19, 2012 09:00PM UTC by mikesherov comment:4

priority: undeterminedminor

Changed November 30, 2012 05:09PM UTC by tj.vantoll comment:5

summary: parseDate accepts dates with two year digits with format 'mm/dd/yy' which should require four year digits.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/.

Changed April 09, 2013 09:25PM UTC by PRISMAY comment:6

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.

Changed April 09, 2013 10:11PM UTC by scottgonzalez comment:7

@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.

Changed July 11, 2013 02:03AM UTC by tj.vantoll comment:8

#9419 is a duplicate of this ticket.

Changed August 27, 2013 05:37PM UTC by r3dqu33n comment:9

Replying to [comment:6 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.

Changed May 16, 2014 12:42AM UTC by rod333 comment:10

Submitted a pull request for this bug:

https://github.com/jquery/jquery-ui/pull/1248

Changed June 24, 2014 11:44PM UTC by scottgonzalez comment:11

milestone: 1.11.0none

Changed July 14, 2014 01:35PM UTC by Rodrigo Menezes comment:12

resolution: → fixed
status: openclosed

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

Fixes #8353

Closes gh-1248

Changeset: 573037423822fa04a1888e3bcc52243b9324c5e2

Changed July 14, 2014 01:36PM UTC by tj.vantoll comment:13

milestone: none1.11.1