Skip to main content

Search and Top Navigation

#15094 open bug ()

Opened November 10, 2016 10:23AM UTC

Last modified April 20, 2018 08:21AM UTC

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/

Attachments (0)
Change History (2)

Changed November 10, 2016 06:49PM UTC by scottgonzalez comment:1

status: newopen

Changed April 20, 2018 08:21AM UTC by troje888 comment:2

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.