0

I've inherited some code utilising the bootstrap framework.

I'm currently seeing some odd behaviour where no matter what date was last picked, the date picker always seems to open showing the month of July. Is there any particular places in the code I should be looking to see if anything funny is happening? Nothing looks out of the ordinary to me and I cannot see a method call setting it's value within the show() event.

Cheers

Mike

2
Contributors
3
Replies
8
Views
2 Years
Discussion Span
Last Post by Mike Askew
0

Just been digging. Traced it down to the constructor.

this.format = DPGlobal.parseFormat(options.format||this.element.data('date-format')||'mm/dd/yyyy');

and then

this.date = DPGlobal.parseDate(typeof newDate === 'string' ? newDate : (this.isInput ? this.element.prop('value') : this.element.data('date')), this.format);

where

typeof newDate === 'string' ? newDate : (this.isInput ? this.element.prop('value') : this.element.data('date'))

returns "01/01/2010" and then

this.date = DPGlobal.parseDate(typeof newDate === 'string' ? newDate : (this.isInput ? this.element.prop('value') : this.element.data('date')), this.format);

returns "Thu Jul 1 00:00:00 UTC+0100 2010".

I'm presuming something is off in the formatting?

Edit: woo 1k posts xD

Edited by Mike Askew

0

Resolved.

Within the DPGlobal.parseDate method it was looking for a format of mm whereas the format was MM so was defaulting to the current month. :)

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.