Joomla 3.6.5
<field name="avg_year" type="calendar" default="NOW" label="Year" description="" class="input-small" required="true" format="%Y" showtime="false" todaybutton="false" translateformat="false" />
Labels |
Added:
?
|
Title |
|
Status | New | ⇒ | Closed |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2018-03-26 08:12:58 |
Closed_By | ⇒ | brianteeman |
Status | Closed | ⇒ | New |
Closed_Date | 2018-03-26 08:12:58 | ⇒ | |
Closed_By | brianteeman | ⇒ | |
Build | staging | ⇒ | 3.6.5 |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | |
Build | 3.6.5 | ⇒ | staging |
Set to "open" on behalf of @franz-wohlkoenig by The JTracker Application at issues.joomla.org/joomla-cms/19993
Category | ⇒ | Fields |
Status | New | ⇒ | Information Required |
in DB table #__extensions
field "params" is "{"avg_year":"2018"}"
i will try to reproduce on 3.8.6 on other site
in Joomla 3.8.6 another behaviour: Joomla always set field to "2018" from "2017" before saving form and params DB field is {"avg_year":"2018"}
when i clicking "Save" button - input field with value "2017" always replacing automatically to 2018 before form sended to server and saved value DB is "2018"
so error still in latest version too. But with other behaviour
when config.xml field param format="%Y-%m" in Joomla 3.6.5 - saved value is correctly
but it is not what i want
and other error in 3.6.5 happens when i set format="%m-%Y"
DateTime::__construct(): Failed to parse time string (01-2018) at position 0 (0): Unexpected character
Any tests in 3.6.5 are irrelevant as you should only be using 3.8.6 and that is the only version supported
Labels |
Added:
J3 Issue
|
Why would you even use a full calendar if you only want the year?
yes it seems that this code was not changed
i see that m (month) keeps its initial value -1 when you have format "%Y"
the parsing code continues
and eventually you get to have "return today";
Date.parseFieldDate = function(str, fmt, dateType) {
....
var today = new Date();
var y = 0;
var m = -1;
var d = 0;
...
if (y != 0 && m != -1 && d != 0)
return new Date(y, m, d, hr, min, sec);
...
if (m != -1 && d != 0)
return new Date(y, m, d, hr, min, sec);
return today;
Why would you even use a full calendar if you only want the year?
indeed calendar field does not seem appropriate choice if you only want to select a year
Why would you even use a full calendar if you only want the year?
because i want. It is normal select year, month with only mouse. Why android using CalendarView? :) everyone can enter date in TextView :) because it is friendly UI. But calendar in Joomla it is pain.
Look at this http://t1m0n.name/air-datepicker/docs/index.html
it is datepicker on steroids :) in compare to joomla calendar
Even if the code's busted, this is a case where you're using an inefficient tool for the job. If you really only are offering a year selection and not a full date, you're better off creating a list field with a custom year range than trying to use a calendar to select a year.
Look at this http://t1m0n.name/air-datepicker/docs/index.html
it is datepicker on steroids :) in compare to joomla calendar
Nice, but limited to Gregorian calendar. Joomla also includes jalali.
A drop down for year only selection will also be better ux, fast and easy, understandable
oh mans. i have some trouble with speaking english. Ok, i will try to explain:
anyway i hope my exploring with Year format helps somebody
hardcoded values in dropdown list - is not very good.
you can use this
https://docs.joomla.org/Number_form_field_type
about hardcoding, how is it different than specifying minyear maxyear in calendar filed ?
with hard-coding you mean you want different limits per which case ? different limit per language ?
thanks for solution
i mean what if i will hardcode dropdown in XML:
2016
2017
2018
and after 2-3 years i will need to add in XML:
2019
2020
2021
:(
Yes, i see the problem, indeed you need the minyear , maxyear options that the calendar supports
... then extending number form element type of Joomla and customizing it is the way to go
and regardless of fixing the issue you reported here, the above is probably the best UX choice (for the form)
in a previous answer, i mentioned where the issue is,
if someone is interested into spend time to fix it
#19993 (comment)
about Jalali and Gregorian - oh, i never saw this. Anybody using this? :) it is just question :)
We have 2 languages using Jalali: Persian and Dari Persian
Just create a custom element type based on select list which has a starting year and goes 4 years into the future from today. Fairly simple to do, the core calendar isn’t really designed for your usage case, the core cannot think of every use age scenario.
Status | Information Required | ⇒ | Discussion |
Status | Discussion | ⇒ | Closed |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2018-04-22 14:29:12 |
Closed_By | ⇒ | Quy |
Closed_By | Quy | ⇒ | joomla-cms-bot |
Set to "closed" on behalf of @Quy by The JTracker Application at issues.joomla.org/joomla-cms/19993
Closing for reasons stated above.
Can you please update to latest Version?