Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix for minyear and maxyear in the calendar.js #26119

Merged
merged 9 commits into from Sep 17, 2019

Conversation

pinta83
Copy link
Contributor

@pinta83 pinta83 commented Sep 1, 2019

/media/system/js/fields/calendar.js at lines 861 and 864 call
date.getOtherFullYear(this.params.dateType, year);

But this function defined in
/media/system/js/fields/calendar-locales/date/jalali/date-helper.js
does not have a second parameter - year, so it can not be changed...

Here's a fix for this issue...

Pull Request for Issue #19926 .

Summary of Changes

Changes 2 lines of code so the picker would work as inteded

Testing Instructions

Create a datepicker input field with attribute maxyear set to -5

Expected result

When the field gets rendered the expected result of the initially displayed year - is the current year -5 years as defined.

Actual result

The year title is ok, but the calendar displayed does not reflect the shown year, but the current month is displayed. When you click the previous year button, you have to click 5 times until it gets to the right year, and then starts working as expected. It also lets you pick the date outside of range. This fixes all these issuse, as the wrong calendar month never gets displayed.

Documentation Changes Required

None

/media/system/js/fields/calendar.js at lines 861 and 864 call
date.getOtherFullYear(this.params.dateType, year);

But this function defined in
/media/system/js/fields/calendar-locales/date/jalali/date-helper.js
does not have a second parameter - year, so it can not be changed...

Here's a fix for this issue...

Fixes issue: joomla#19926
@pinta83
Copy link
Contributor Author

pinta83 commented Sep 1, 2019

Have in mind that the minified version (media/system/js/fields/calendar.min.js - NOT PROVIDED) should be updated aswell

@ghost ghost mentioned this pull request Sep 1, 2019
@ghost
Copy link

ghost commented Sep 1, 2019

@pinta83 please fill the Template (Summary of Changes
Testing Instructions
Expected result
Actual result
Documentation Changes Required)

@pinta83
Copy link
Contributor Author

pinta83 commented Sep 1, 2019

@franz-wohlkoenig Done.. sry ;)

@Quy
Copy link
Contributor

Quy commented Sep 1, 2019

Please use the following tool to compile/include the minified version.
https://skalman.github.io/UglifyJS-online/

Updated version of the patched calendar.js
@pinta83
Copy link
Contributor Author

pinta83 commented Sep 1, 2019

@Quy Done..

@pinta83
Copy link
Contributor Author

pinta83 commented Sep 2, 2019

Fixed, tested and updated

} else if (year > this.params.maxYear) {
year = this.params.maxYear;
date.getOtherFullYear(this.params.dateType, year);
date.setOtherFullYear(this.params.dateType, year);;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You have a double semi-colon at the end of this

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed

@richard67
Copy link
Member

I have tested this item ✅ successfully on 922baab

Hint for other testers: Instead of creating a field, you can modify field "created" in file "administrator/components/com_contact/models/forms/contact.xml" by adding property maxyear="-19" (orn other values). Then create a contact and play with the created date calendar field as described in the testing instructions and the issue.

After having applied the patch e.g. with patchtester, you might have to clear your browser cache in order to use the changed js (or minified js if debug is switched off).


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/26119.

@infograf768
Copy link
Member

@dgrammatiko
can you have a look please?

@infograf768
Copy link
Member

I have tested this item ✅ successfully on 922baab


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/26119.

@ghost
Copy link

ghost commented Sep 5, 2019

Status "Ready To Commit".

@joomla-cms-bot joomla-cms-bot added the RTC This Pull Request is Ready To Commit label Sep 5, 2019
@zero-24 zero-24 added this to the Joomla! 3.9.12 milestone Sep 5, 2019
@HLeithner
Copy link
Member

Thanks for fixing the calendar.

@HLeithner HLeithner merged commit f976816 into joomla:staging Sep 17, 2019
@joomla-cms-bot joomla-cms-bot removed the RTC This Pull Request is Ready To Commit label Sep 17, 2019
@pinta83 pinta83 deleted the patch-1 branch September 17, 2019 16:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

9 participants