Create a form using the calender field like this:
<field name="end"
type="calendar"
label="COM_TIME_SLOTS_END"
format="%H:%M"
showtime="true"
translateformat="false"
timeformat="24"
singleheader="false"
todaybutton="false"
filltable="false"
minyear="0"
maxyear="0"
/>
Notice that the format is set to %H:%M because I only want hours and minutes.
Save the form with the set time and then load the form again. You will see that the time in the input field is set to the current time and not the time stored earlier.
The input does have the correct value as you can see in the value and date-alt-value field:
Time is shown as stored
Current local time is shown.
Joomla | 3.8.12
Database Type | mysql
Database Version | 5.6.37-82.2-log
Database Collation | utf8_general_ci
Database Connection Collation | utf8mb4_general_ci
PHP Version | 7.2.9
Web Server | Apache/2.4.34 (Unix) PHP/7.2.9
Labels |
Added:
?
|
Status | New | ⇒ | Discussion |
Category | ⇒ | Fields JavaScript |
Now I have to ask the obvious question. What is being gained by using the calendar field (which my mind always associates with dates, as in a datepicker, as in a date
input type) to set a timestamp versus either using the native time
input type or some kind of JavaScript enhancement of a time selector?
@brianteeman I tried that as well but it still uses the wrong time.
@mbabker The not so obvious answer is that I did not know about the Time field until after reporting this. Although Joomla doesn't support this Time field. That is why we created issue #22140
Now I am using a text field with a pattern, that does the job for now. Regardless of that, I am still convinced this is a bug. Whether it should be solved is the next question. Feel free to close the issue.
Well if the calendar field is supposed to work as a date/time selector or only a date selector or only a time selector, then it probably is a bug if it can't work as a time selector only.
I don't think it ever worked as a time-only selector. And imho it isn't supposed to work like that.
It's either date-only or date/time.
It's certainly better to add a "time" input field which works with the HTML5 time input field.
Closing as expected behavior.
Status | Discussion | ⇒ | Closed |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2018-09-12 15:23:58 |
Closed_By | ⇒ | roland-d |
I may be confused but there is an attribute user_utc which if i remember correctly is related to this