Opened 7 years ago

Closed 7 years ago

#9660 closed bug (notabug)

$.datepicker.formatDate() gives the wrong day of the month

Reported by: moazzamk Owned by: moazzamk
Priority: minor Milestone: none
Component: ui.datepicker Version: 1.10.3
Keywords: Cc:
Blocked by: Blocking:

Description

$.datepicker.formatDate() gives the wrong date for the input string '2013-11-15' but gives back the right date when there is a space after 15. I tried it with different date formats. Some return the right date and some don't. Please see the attached screenshot for examples

Change History (3)

comment:1 Changed 7 years ago by Scott González

Owner: set to moazzamk
Status: newpending

$.datepicker.formatDate()doesn't take strings as input, so I'm not sure what you're trying to report. Please do not send us screenshots, create a reduced test case on jsbin or jsFiddle, as requested in the big red box.

comment:2 Changed 7 years ago by moazzamk

Status: pendingnew

Yeah, it won't let me upload a screenshot. Try these things in chrome (or Firefox):

$.datepicker.formatDate('dd M, yy', new Date('2013-11-15')); Gives 14 Nov, 2013 $.datepicker.formatDate('dd M, yy', new Date('2013-11-15 ')); Gives 15 Nov, 2013 in Chrome and NaN in Firefox $.datepicker.formatDate('dd M, yy', new Date('2013-11-15T00:00:00')); Gives 15 Nov, 2013 in Firefox and 14 Nov, 2013 in Chrome

After further investigation, I found out that the problem is with the Date object. It returns the wrong date with getDate(). So it's not a problem with formatDate(). It would be nice if $.datepicker.formatDate() accepted a string and formatted the date correctly but I guess that is a feature request and not a bug.

comment:3 Changed 7 years ago by Scott González

Resolution: notabug
Status: newclosed
Note: See TracTickets for help on using tickets.