Closed thomaslanger closed 5 years ago
The data-attributs in the html-Code are ok. the bug must bee in the calendar.js
is max year bigger than min year?
minyear is not specified because i don't need a min year, only a max year older then the current. In the joomla documentation it is a optional value.
<field name="birthday" type="calendar" label="BIRTHDAY_LABEL" maxyear="-16" />
name="birthday" type="calendar" label="COM_FNETCM_BIRTHDAY_LABEL" maxyear="-16"
More info required? Which? Could someone reproduce the bug?
I can reproduce this
I have the same issue....
My maxdate is set to "-7", and when i click the date picker it only shows the currentyear -7 in the header... The actuall caledar is rendered for the current month, and I have to click the left nav arrow 7 time before i even get to the year, and then it finaly starts to change.
And to go even further... I can click the dates (in current month) and the date will be set regardless of maxyear being set
Found and solved the problem....
If you take a look at /media/system/js/fields/calendar.js at lines 863-869 you can see the date.getOtherFullYear(this.params.dateType, year) call with a second parameter being a year.
Now if you take a look at the getOtherFullYear() function defined in /media/system/js/fields/calendar-locales/date/jalali/date-helper.js you will see that the function excepts only 1 paramterer...
/* Returns the year for the current date. / Date.prototype.getOtherFullYear = function (dateType) { if (dateType != 'gregorian') { / Modify to match the current calendar when overriding / return this.getJalaliFullYear(); } else { return this.getFullYear(); } };
Fix
The bugfix covers minyear bug aswell, since both are handled on the same place..
@dgrammatiko comment as js-guru?
Seems reasonable
@pinta83 can you do a Pull Request?
Will do it today if I catch the time, if not - tommorow morrning ;)
Closed as having Pull Request #26119
Steps to reproduce the issue
Add a calendar field to a form with param maxyear="-18" to set the highest year in caleandar to year 2000 In Browser click on the calendat button to choose a day
Expected result
If i click on a day in the calendar, the selected date should shown in the input field.
Actual result
After selected a date, year 2000 is shown, you get a date with current year.
Try to choose a date in year 1999. Year 2000 is shown but you hav to cklick 19 times to set the year to 1999.
The Callendar JS seems to work not with the year given by "current year" and maxyear. It works calculates only with "current year".
System information (as much as possible)
Joomla 3.8.6