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" />
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.
User can freely select any date
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 |
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.
Labels |
Added:
?
|
Status | New | ⇒ | Discussion |
Category | ⇒ | JavaScript |
@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?
@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)
To only be allowed to select a date from the current year, both the minyear
and maxyear
values need to be set to -1
@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.
Ah crap, my bad. Still think we're in 2017 for some reason.
Status | Discussion | ⇒ | Closed |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2018-03-05 22:16:17 |
Closed_By | ⇒ | Quy |
Closed_By | Quy | ⇒ | joomla-cms-bot |
See PR #19846
Set to "closed" on behalf of @Quy by The JTracker Application at issues.joomla.org/joomla-cms/19831
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!