Opened 3 years ago

Last modified 13 months ago

#15094 open bug

Datepicker skips months when selecting days from ShowOtherMonths area and clicking the previous/next links

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

Description

Selecting days from the "ShowOtherMonths range" and then pressing the previous/next links leads to unexpected behavior. The month before the previous or the month after the next month will be shown instead of the previous/next month.

Consider the following jsfiddle to reproduce the bug: http://jsfiddle.net/e8vmwo2u/3/

Change History (2)

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

Status: newopen

comment:2 Changed 13 months ago by troje888

I have managed to find a workaround for this issue. In the calendar "click.xdsoft" for each TD there is a piece of code

currentTime.setFullYear($this.data('year'));
currentTime.setMonth($this.data('month'));
currentTime.setDate($this.data('date'));				  

After the month is set with the setMonth() function the month is incorrect after the setDate() is called. The workaround is moving the setMonth() below the setDate() so it will look like this

currentTime.setFullYear($this.data('year'));
currentTime.setDate($this.data('date'));
currentTime.setMonth($this.data('month'));//<-- month is set after

Hope this will help you out till a permanent solution is found.

Note: See TracTickets for help on using tickets.