?
avatar quantumwebco
quantumwebco
4 Mar 2018

Steps to reproduce the issue

In form xml use
<field class="inputbox" description="Date" filltable="false" filter="server_utc" hint="Select a date" label="Date" name="date" showtime="false" singleheader="false" minyear="0" maxyear="0" timeformat="12" todaybutton="false" type="calendar" weeknumbers="false" />

Expected result

User should not be able to select a date from a year higher or lower than current year but should be able to select a date from the current year only.

Actual result

User can freely select any date

System information (as much as possible)

PHP Built On Linux euk-86367.eukservers.com 3.10.0-514.6.2.el7.x86_64 #1 SMP Thu Feb 23 03:04:39 UTC 2017 x86_64
Database Version 5.5.5-10.2.9-MariaDB-log
Database Collation utf8mb4_general_ci
Database Connection Collation utf8mb4_general_ci
PHP Version 7.1.10
Web Server Apache
WebServer to PHP Interface fpm-fcgi
Joomla! Version Joomla! 3.8.5 Stable [ Amani ] 6-February-2018 15:00 GMT
Joomla! Platform Version Joomla Platform 13.1.0 Stable [ Curiosity ] 24-Apr-2013 00:00 GMT
User Agent Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/64.0.3282.186 Safari/537.36

Additional comments

Using -1 and 1 respectively allows a user to only select from one year previous or next current year. Logic dictates that 0 should not allow the user to select previous or next but only a date from the current year.

avatar quantumwebco quantumwebco - open - 4 Mar 2018
avatar joomla-cms-bot joomla-cms-bot - change - 4 Mar 2018
Labels Added: ?
avatar joomla-cms-bot joomla-cms-bot - labeled - 4 Mar 2018
avatar quantumwebco quantumwebco - change - 4 Mar 2018
The description was changed
avatar quantumwebco quantumwebco - edited - 4 Mar 2018
avatar dgt41
dgt41 - comment - 4 Mar 2018

I'm afraid that's not the way this works. So the min and max are set by the current language. If you set the attributes these need to be either an negative, zero or a positive number, which are related to the current year (eg min="-10" means that the calendar will not allow years before (2018-10 =) 2008.
If you want freely selecting year calendar the current language should give you a range about 100 years (should cover most use cases), so don't set the min/max values!

avatar franz-wohlkoenig franz-wohlkoenig - change - 4 Mar 2018
Status New Discussion
avatar franz-wohlkoenig franz-wohlkoenig - change - 4 Mar 2018
Category JavaScript
avatar quantumwebco
quantumwebco - comment - 5 Mar 2018

@dgt41 You haven't understood at all. By setting min or max to zero the user should not be able to select anything but the current year, they should ONLY be allowed to select this current year. However, if you set min and max to zero they can freely select any year. How do you limit the date picker to only allow current year? I do NOT want free selecting year but only the current year. Do you understand now what I am trying to do?

avatar brianteeman
brianteeman - comment - 5 Mar 2018

@dgt41 then the documentation is not correct?

minyear (optional): set a signed integer for a number of years (-10, -2, 0, 7, 12, ...) to define the relative lower limit for the year selection. The user could not select a year before your limit (starting with 3.7.0)
maxyear (optional): set a signed integer for a number of years (-10, -2, 0, 7, 12, ...) to define the relative upper limit for the year selection. The user could not select a year after your limit (starting with 3.7.0)

avatar C-Lodder
C-Lodder - comment - 5 Mar 2018

To only be allowed to select a date from the current year, both the minyear and maxyear values need to be set to -1

avatar quantumwebco
quantumwebco - comment - 5 Mar 2018

@C-Lodder That is wrong. If both are set to -1 user is only allowed to select a date from the previous year. E.g. if set both to -1 only dates in 2017 are allowed. Also that is not what the documentation says. So both the documentation is wrong and the calendar doesn't work as expected. The documentation states that both should be set to 0 to limit to current year. That does't work. There is no way to limit user to current year.

avatar quantumwebco quantumwebco - change - 5 Mar 2018
The description was changed
avatar quantumwebco quantumwebco - edited - 5 Mar 2018
avatar quantumwebco quantumwebco - change - 5 Mar 2018
The description was changed
avatar quantumwebco quantumwebco - edited - 5 Mar 2018
avatar C-Lodder
C-Lodder - comment - 5 Mar 2018

Ah crap, my bad. Still think we're in 2017 for some reason.

avatar dgt41
dgt41 - comment - 5 Mar 2018

@dgt41 then the documentation is not correct?

I don't think that I wrote something different in my comment. The only thing I added was that by default the min/max are set on the current language (about 100 years rang if I remember correctly)

avatar Quy Quy - change - 5 Mar 2018
Status Discussion Closed
Closed_Date 0000-00-00 00:00:00 2018-03-05 22:16:17
Closed_By Quy
avatar joomla-cms-bot joomla-cms-bot - change - 5 Mar 2018
Closed_By Quy joomla-cms-bot
avatar joomla-cms-bot joomla-cms-bot - close - 5 Mar 2018
avatar Quy
Quy - comment - 5 Mar 2018

See PR #19846


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

avatar joomla-cms-bot
joomla-cms-bot - comment - 5 Mar 2018

Set to "closed" on behalf of @Quy by The JTracker Application at issues.joomla.org/joomla-cms/19831

Add a Comment

Login with GitHub to post a comment