? Success
Related to # 4479

User tests: Successful: Unsuccessful:

avatar purplebeanie
purplebeanie
8 Oct 2014

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.

Testing instructions

Before applying this patch make sure the calendar.js is being loaded.

  1. Easiest way to do this is to add Jhtml::_('behavior.calendar'); to your active template index.php file.
  2. Open your site and then use Chrome developer tools to run the following at the JS console. (thanks @Fedik for picking up my previous mistake)
// 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.

  1. Apply the patch and refresh the page.
  2. Using the Javascript console re-run the code from before. This time the changed date should be Christmas day.

Question? Will anything break?

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.

avatar purplebeanie purplebeanie - open - 8 Oct 2014
avatar jissues-bot jissues-bot - change - 8 Oct 2014
Labels Added: ?
avatar infograf768
infograf768 - comment - 8 Oct 2014

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...

avatar brianteeman brianteeman - change - 8 Oct 2014
Category JavaScript
avatar Fedik
Fedik - comment - 8 Oct 2014

works good for me :smile:

avatar brianteeman brianteeman - change - 17 Oct 2014
Rel_Number 4479
Relation Type Related to
avatar Fedik Fedik - test_item - 2 Nov 2014 - Tested successfully
avatar anibalsanchez
anibalsanchez - comment - 14 Jan 2015

@test OK

Returns Christmas day after the patch


This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/4480.
avatar anibalsanchez anibalsanchez - test_item - 14 Jan 2015 - Tested successfully
avatar zero-24 zero-24 - change - 14 Jan 2015
Status Pending Ready to Commit
avatar zero-24
zero-24 - comment - 14 Jan 2015

moving to RTC thanks for testing!


This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/4480.
avatar brianteeman brianteeman - change - 16 Jan 2015
Labels Added: ?
avatar roland-d roland-d - close - 16 Jan 2015
avatar zero-24 zero-24 - close - 16 Jan 2015
avatar roland-d roland-d - change - 16 Jan 2015
Status Ready to Commit Closed
Closed_Date 0000-00-00 00:00:00 2015-01-16 22:22:01
avatar zero-24 zero-24 - change - 14 Oct 2015
Labels Removed: ?

Add a Comment

Login with GitHub to post a comment