Quantcast
Channel: AjaxControlToolkit Work Item Rss Feed
Viewing all articles
Browse latest Browse all 4356

Commented Issue: CalendarExtender: Bug when selecting December shifts to January. [27108]

$
0
0
Hi all!
I'm using the AJAX Calendar Extender on a web application, and discovered an odd bug while testing it. I have extensive validations all over the page, and some are focused on the date where the calendar is applied. Many situations, I have StartDate and end EndDate of 2 or 3 days.
i.e.:
DateFormat = "dd/MM/yyyy"
StartDate = 14/12/2010
EndDate = 15/12/2010

In this scenario, the user will navigate to the years (as we're in 2012), select 2010-2019, then 2010. then he will choose Dec, and then pick a date between StartDate and EndDate, however due to this bug, he can't.
Upon clicking on Dec, the control shifts to Jan/2010, where no dates are available (Below StartDate). Repeating the process will get you to Jan/2010.

I've tested on a clean control, and on the sample page (http://www.asp.net/ajaxLibrary/AjaxControlToolkitSampleSite/Calendar/Calendar.aspx), where no StartDate or EndDate are specified, and the same problem occurs. The only workaround to effectivelly choose December is to return to that year months, select Nov, then go back to months and then select Dec, and then it is displayed.

I have already downloaded the latest toolkit version for .NET Framework 4.0.

Hope you can figure out a solution for this bug.
Comments: I found that this bug still exists in the June 2012 release. The javascript in this calendar control is using UTC date functions (like UTC()) in some places and local date functions (like getMonth()) in other places. In this specific example, it is using getMonth() on a UTC date, so if you are in a -X timezone, such as EST, the bug will appear. For example, clicking "2012" sets visibleDate to 12/31/2011 19:00. If you incorrectly use getMonth() on this date you will get 11, so if you click "Dec" it will find that 11==11 so it will just use the current visible date (12/31/2011 19:00) from the previous click and navigate to January month in the calendar. // bug code if (target.month == visibleDate.getMonth()) { this._switchMode("days"); } else { this._visibleDate = target.date; this._switchMode("days"); } // fix if (target.month == visibleDate.getUTCMonth()) { this._switchMode("days"); } else { this._visibleDate = target.date; this._switchMode("days"); }

Viewing all articles
Browse latest Browse all 4356

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>