User tests: Successful: Unsuccessful:
As per issue #4479 calendar.js and calendar-uncompressed.js overwrite the standard Javascript setFullYear(year,month,day) function with setFullYear(year).
This means scripts that use javascript's setFullYear function on a page that has the standard datetimepicker loaded may not function correctly as parameters other than year are ignored.
Before applying this patch make sure the calendar.js is being loaded.
Jhtml::_('behavior.calendar');
to your active template index.php file.// define date var:
var date = new Date();
// check the date:
console.log('Original: ' + date.toLocaleDateString());
// try change the date
date.setFullYear(2014,11,25);
// check result
console.log('Changed: ' + date.toLocaleDateString());
The changed will be the same as the Original as only the year will have been updated.
Now test the actual patch.
All I have done is remove the offending setFullYear function from the calendar.js and calendar-uncompressed.js. Is this safe? The date pickers in the back end still worked correctly after I made this change, so I don't think it breaks anything obvious.
I checked Jalili calendar addon and they didn't actually define setFullYear themselves. Rather it defined _calSetFullYear
so possibly this isn't going to break anything. Can someone with more historical knowledge advise?
Cheers,
Eric.
Labels |
Added:
?
|
Category | ⇒ | JavaScript |
works good for me
Rel_Number | ⇒ | 4479 | |
Relation Type | ⇒ | Related to |
@test OK
Returns Christmas day after the patch
Status | Pending | ⇒ | Ready to Commit |
moving to RTC thanks for testing!
Labels |
Added:
?
|
Status | Ready to Commit | ⇒ | Closed |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2015-01-16 22:22:01 |
Labels |
Removed:
?
|
When using a custom calendar, the core ones are not used.
For Jalali we have
Therefore, your PR would have no impact on Jalali. The bug could still exist though for them, but we have lived with it for years...