Opened 11 years ago

Closed 9 years ago

Last modified 9 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 10 years ago by Scott González

Milestone: 1.9.01.11.0

comment:2 Changed 10 years ago by mikesherov

Priority: minorundetermined
Status: newopen

comment:4 Changed 10 years ago by mikesherov

Priority: undeterminedminor

comment:5 Changed 10 years ago by tj.vantoll

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

comment:6 Changed 10 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 10 years ago by Scott González

@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 10 years ago by tj.vantoll

#9419 is a duplicate of this ticket.

comment:9 in reply to:  6 Changed 10 years ago by Oscar.One

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 9 years ago by rod333

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

comment:11 Changed 9 years ago by Scott González

Milestone: 1.11.0none

comment:12 Changed 9 years ago by Rodrigo Menezes

Resolution: fixed
Status: openclosed

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

Fixes #8353 Closes gh-1248

Changeset: 573037423822fa04a1888e3bcc52243b9324c5e2

comment:13 Changed 9 years ago by tj.vantoll

Milestone: none1.11.1
Note: See TracTickets for help on using tickets.