The DHTML calendar picker currently used defines a method setFullYear(year) that overrides the default JS setFullYear(year,month,day). http://www.w3schools.com/jsref/jsref_setfullyear.asp. Any scripts that use setFullYear on a page where calendar.js is being loaded and are expecting month and day parameters to be set will misbehave as only the year will be set and not the other fields.
This is defined on line 1793 of the uncompressed version (ie. calendar-uncompressed.js)
I've only tried this on J3.3.6.
Make sure calendar.js is being loaded. Probably the easiest way is to add JHtml::_('behavior.calendar');
to your template index file.
Open your site in a browser and then open Chrome developer tools. Go to the console and type:
date = new Date();
date = new Date.setFullYear(2014,11,25);
//month is 0 indexed so needs to be 11
The expected result would be:
Thu Dec 25 2014 10:26:15 GMT+1000 (EST)
The actual result is:
Wed Oct 08 2014 10:26:15 GMT+1000 (EST)
Only the year is actually being set.
If someone can verify this is a genuine bug I will work patch later this week or on the weekend.
Cheers,
Eric.
@purplebeanie the patch is welcome
Status | New | ⇒ | Closed |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2014-10-08 09:20:11 |
Labels |
Added:
?
|
I can confirm it.
But your code for demonstration a bit wrong
date = new Date.setFullYear(2014,11,25);
is not valid call...Here is more simple (I hope ), run next in the browser console (copy whole code -> paste -> push Enter):
Result:
Expected result: