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

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: #19926
@pinta83

This comment has been minimized.

Copy link
Contributor Author

commented Sep 1, 2019

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

@franz-wohlkoenig

This comment has been minimized.

Copy link
Member

commented Sep 1, 2019

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

@pinta83

This comment has been minimized.

Copy link
Contributor Author

commented Sep 1, 2019

@franz-wohlkoenig Done.. sry ;)

@Quy

This comment has been minimized.

Copy link
Contributor

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

This comment has been minimized.

Copy link
Contributor Author

commented Sep 1, 2019

@Quy Done..

pinta83 added 3 commits Sep 2, 2019
@pinta83

This comment has been minimized.

Copy link
Contributor Author

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);;

This comment has been minimized.

Copy link
@C-Lodder

C-Lodder Sep 3, 2019

Member

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

This comment has been minimized.

Copy link
@pinta83

pinta83 Sep 3, 2019

Author Contributor

Fixed

pinta83 added 2 commits Sep 3, 2019
@richard67

This comment has been minimized.

Copy link
Contributor

commented Sep 4, 2019

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

This comment has been minimized.

Copy link
Member

commented Sep 5, 2019

@dgrammatiko
can you have a look please?

@infograf768

This comment has been minimized.

Copy link
Member

commented Sep 5, 2019

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.

@franz-wohlkoenig

This comment has been minimized.

Copy link
Member

commented Sep 5, 2019

Status "Ready To Commit".

@joomla-cms-bot joomla-cms-bot added the RTC label Sep 5, 2019
@zero-24 zero-24 added this to the Joomla! 3.9.12 milestone Sep 5, 2019
@HLeithner

This comment has been minimized.

Copy link
Member

commented Sep 17, 2019

Thanks for fixing the calendar.

@HLeithner HLeithner merged commit f976816 into joomla:staging Sep 17, 2019
4 checks passed
4 checks passed
Hound No violations found. Woof!
continuous-integration/appveyor/pr AppVeyor build succeeded
Details
continuous-integration/drone/pr Build is passing
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
@joomla-cms-bot joomla-cms-bot removed the RTC label Sep 17, 2019
@pinta83 pinta83 deleted the pinta83:patch-1 branch Sep 17, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
10 participants
You can’t perform that action at this time.