? ? ?
avatar hans2103
hans2103
12 Sep 2018

Is your feature request related to a problem? Please describe.

For my component Example I define the form fields in components/com_example/models/forms/example.xml

<field name="time"
	   type="time"
	   label="COM_EXAMPLE_TIME_LABEL"
/>

This will be rendered like:

<input type="text" name="time" />

I was expecting to see

<input type="time" name="time" />

After searching in Joomla code (libraries/joomla/form/fields and libraries/src/Form) I've found out that type=time does not exist yet in our codebase.

Describe the solution you'd like

It would be great if it is possible to use type=time in Joomla.

<input> elements of type time create input fields designed to let the user easily enter a time (hours and minutes, and optionally seconds).

The control's user interface will vary from browser to browser. Support is good in modern browsers, with Safari being the sole major browser not yet implementing it; in Safari, and any other browsers that don't support <time>, it degrades gracefully to <input type="text">.
text copied from: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/time

First step was to create this issue, next step is to create a PR. :-)

Additional context

More information about input type=time can be found on w3.org
https://www.w3.org/TR/2012/WD-html-markup-20120315/input.time.html

avatar hans2103 hans2103 - open - 12 Sep 2018
avatar joomla-cms-bot joomla-cms-bot - change - 12 Sep 2018
Labels Added: ?
avatar joomla-cms-bot joomla-cms-bot - labeled - 12 Sep 2018
avatar brianteeman
brianteeman - comment - 12 Sep 2018

If it is for J4 we can use the html5 patterns

avatar franz-wohlkoenig franz-wohlkoenig - change - 12 Sep 2018
Status New Information Required
avatar franz-wohlkoenig franz-wohlkoenig - change - 12 Sep 2018
Category Fields
avatar Fedik
Fedik - comment - 12 Sep 2018

for note: it also require to do fallback script,
because it has bad support by a browsers https://caniuse.com/#feat=input-datetime

avatar hans2103
hans2103 - comment - 13 Sep 2018

@Fedik no coded fallback needed. As mentioned in the quote from mozilla.org it will gracefully degrades to <input type="text"> on Safari and other browsers that don't support <time>.
When I look at caniuse I see 86.66 % Global support. I cannot say that it means bad support

avatar Fedik
Fedik - comment - 13 Sep 2018

As mentioned in the quote from mozilla.org it will gracefully degrades to on Safari and other browsers that don't support

that you will try to explain for further issue reports: "the time field do not display time input", or "time input ignore min/max attribute" ?

but personally I do not mind, I just point on potential issue

avatar brianteeman brianteeman - change - 30 Oct 2018
Labels Added: ?
avatar brianteeman brianteeman - labeled - 30 Oct 2018
avatar franz-wohlkoenig
franz-wohlkoenig - comment - 5 Mar 2019

New Features go only in j4 as i know, so this should get a J4-Issue-Label.

avatar franz-wohlkoenig
franz-wohlkoenig - comment - 16 Mar 2019

@infograf768 can you please add j4-Label?

avatar infograf768 infograf768 - change - 16 Mar 2019
Labels Added: ?
avatar infograf768 infograf768 - labeled - 16 Mar 2019
avatar franz-wohlkoenig franz-wohlkoenig - change - 29 Mar 2019
Category Fields Feature Request Fields
avatar franz-wohlkoenig franz-wohlkoenig - change - 5 Apr 2019
Labels Added: J3 Issue
avatar franz-wohlkoenig franz-wohlkoenig - labeled - 5 Apr 2019
avatar Quy Quy - change - 6 Jul 2019
Labels Added: ?
Removed: J3 Issue ?
avatar Quy Quy - unlabeled - 6 Jul 2019
avatar VladikB
VladikB - comment - 5 Sep 2019

I am working on this. Which files should be changed to add a new field type?

avatar Bakual
Bakual - comment - 5 Sep 2019

@VladikB You would have to add a new file named TimeField.php here: https://github.com/joomla/joomla-cms/tree/4.0-dev/libraries/src/Form/Field
You can have a look at the other fields to see how they work.

avatar VladikB
VladikB - comment - 5 Sep 2019

Okay, thanks, got it. And I how do I get the min, max and step attributes to work and checkt them out?

avatar zero-24
zero-24 - comment - 5 Sep 2019

Take a look here: https://github.com/joomla/joomla-cms/blob/4.0-dev/libraries/src/Form/Field/NumberField.php there we also support min, max and step :)

avatar franz-wohlkoenig franz-wohlkoenig - change - 6 Sep 2019
Status Information Required Closed
Closed_Date 0000-00-00 00:00:00 2019-09-06 15:11:11
Closed_By franz-wohlkoenig
avatar franz-wohlkoenig
franz-wohlkoenig - comment - 6 Sep 2019

Closed as having Pull Request #26184

avatar franz-wohlkoenig franz-wohlkoenig - close - 6 Sep 2019

Add a Comment

Login with GitHub to post a comment