Skip to main content

Search and Top Navigation

#9660 closed bug (notabug)

Opened November 15, 2013 05:04PM UTC

Closed November 15, 2013 05:35PM UTC

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

Attachments (0)
Change History (3)

Changed November 15, 2013 05:13PM UTC by scottgonzalez comment:1

owner: → 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.

Changed November 15, 2013 05:34PM UTC by moazzamk comment:2

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.

Changed November 15, 2013 05:35PM UTC by scottgonzalez comment:3

resolution: → notabug
status: newclosed