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

Calendar form field maxyear/minyear 0 does not limit to this year #19831

Closed
quantumwebco opened this issue Mar 4, 2018 · 9 comments
Closed

Comments

@quantumwebco
Copy link

quantumwebco commented Mar 4, 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.

@dgrammatiko
Copy link
Contributor

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!

@quantumwebco
Copy link
Author

quantumwebco commented Mar 5, 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?

@brianteeman
Copy link
Contributor

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

@C-Lodder
Copy link
Member

C-Lodder commented Mar 5, 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

@quantumwebco
Copy link
Author

quantumwebco commented Mar 5, 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.

@C-Lodder
Copy link
Member

C-Lodder commented Mar 5, 2018

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

@dgrammatiko
Copy link
Contributor

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

@joomla-cms-bot
Copy link

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

@Quy
Copy link
Contributor

Quy commented Mar 5, 2018

See PR #19846


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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants