? ? Pending

User tests: Successful: Unsuccessful:

avatar VladikB
VladikB
6 Sep 2019

Pull Request for Issue #22140 .

Summary of Changes

I created new files to rectify the missing of input type="time" with a typical time field. Since IE and Safari don't support this input type, on these browsers it goes to input type="text"

Testing Instructions

a) 1. Go to administrator\components\com_users\forms. Edit the first field of user.xml file to

name="name"
type="time"
label="COM_USERS_USER_FIELD_NAME_LABEL"
required="true"
validate="time"
size="30"
  1. Go to Joomla-Backend -> Users ->Manage -> Click on Your User -> try to change it

b) 1. Go to administrator\components\com_users\forms. Edit the first field of user.xml file to

name="name"
type="time"
label="COM_USERS_USER_FIELD_NAME_LABEL"
required="true"
validate="time"
size="30"
min="08:00"
max="15:00"
  1. Go to Joomla-Backend -> Users ->Manage -> Click on Your User-> try to change it

c) 1. Go to administrator\components\com_users\forms. Edit the first field of user.xml file to

name="name"
type="time"
label="COM_USERS_USER_FIELD_NAME_LABEL"
required="true"
validate="time"
size="30"
step="3"
  1. Go to Joomla-Backend -> Users ->Manage -> Click on Your User-> try to change it

Expected result

a) The Name field is a time field with hh:mm
b) The Name field is a time field with hh:mm that goes from 08:00 to 15:00
c) The Name field is a time field with hh:mm:ss and seconds can be changed in step of three seconds

Documentation Changes Required

If this works, I am going to write a documentation since it is a new field type.

avatar VladikB VladikB - open - 6 Sep 2019
avatar VladikB VladikB - change - 6 Sep 2019
Status New Pending
avatar joomla-cms-bot joomla-cms-bot - change - 6 Sep 2019
Category Layout Libraries
avatar franz-wohlkoenig franz-wohlkoenig - change - 6 Sep 2019
Title
4.0-dev Implement time field
[4.0] Implement time field
avatar franz-wohlkoenig franz-wohlkoenig - edited - 6 Sep 2019
avatar VladikB VladikB - change - 6 Sep 2019
Labels Added: ?
avatar roland-d
roland-d - comment - 6 Sep 2019

@VladikB Please fix the codestyle issues:

image

avatar hans2103
hans2103 - comment - 6 Sep 2019

I have tested this item successfully with Chrome browser
It works as described.

avatar coolcat-creations
coolcat-creations - comment - 8 Sep 2019

Nice Feature, thank you!!!

avatar dgrammatiko
dgrammatiko - comment - 8 Sep 2019

Sorry to ruin the party but this cannot be accepted because it's not supported by the minimum browser compatibility for J4: https://caniuse.com/#feat=input-datetime

avatar roland-d
roland-d - comment - 9 Sep 2019

@dgrammatiko The problem being that a text field is not supported?

avatar dgrammatiko
dgrammatiko - comment - 9 Sep 2019

@roland-d no the problem is that you cannot rely on the fallback type of text wihout some client side validation. Also I think that there should be also a server side validation (input filter).

avatar VladikB
VladikB - comment - 9 Sep 2019

"Since IE and Safari don't support this input type, on these browsers it goes to input type="text""

avatar VladikB VladikB - change - 9 Sep 2019
The description was changed
avatar VladikB VladikB - edited - 9 Sep 2019
avatar dgrammatiko
dgrammatiko - comment - 9 Sep 2019

"Since IE and Safari don't support this input type, on these browsers it goes to input type="text""

So I can then type: This sucks! and it will be valid time because there is no client side or server side validation. In other words you're proposing something that in it's current form is broken.
Great, ship it!

avatar dgrammatiko
dgrammatiko - comment - 9 Sep 2019
avatar coolcat-creations
coolcat-creations - comment - 9 Sep 2019

Would be so great, if we would appreciate new contributions and find ways to make it work instead of shouting at each other and beeing such aggressive.

avatar dgrammatiko
dgrammatiko - comment - 9 Sep 2019

@coolcat-creations so, explaining that something is not acceptable in the current state is aggressive?

avatar coolcat-creations
coolcat-creations - comment - 9 Sep 2019

It's not what you say, but how you say it @dgrammatiko
"This sucks!" and "Great, ship it!" ... We are here to create a great product with each other, not to be mad ;-)

avatar brianteeman
brianteeman - comment - 9 Sep 2019

You should find everything you need to know about the time input and any issues you need to watch out for here https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/time

avatar joomla-cms-bot joomla-cms-bot - change - 11 Sep 2019
Category Layout Libraries Administration Language & Strings Layout Libraries
avatar VladikB
VladikB - comment - 11 Sep 2019

@brianteeman Can You please check the language strings?

avatar VladikB
VladikB - comment - 11 Sep 2019

@wilsonge Is the added time rule OK like that?

avatar VladikB VladikB - change - 11 Sep 2019
Labels Added: ?
avatar brianteeman
brianteeman - comment - 11 Sep 2019

@brianteeman Can You please check the language strings?

Do we even need language strings? Don't the browsers have their own native strings for this?

avatar VladikB
VladikB - comment - 11 Sep 2019

@brianteeman Can You please check the language strings?

Do we even need language strings? Don't the browsers have their own native strings for this?

I have no idea

avatar brianteeman
brianteeman - comment - 11 Sep 2019

create a time field and see what happens when validation is on

avatar VladikB
VladikB - comment - 11 Sep 2019

The language strings are primary for the browsers that don't support input type=time. So that if You enter a random text or a false time it won't be accepted and gives the message back.
In browsers that support time You just can't input wrong data.

avatar brianteeman
brianteeman - comment - 11 Sep 2019

Sorry if I wasnt clear.

Use a browser which supports time and copy the error messages from there to be used in the other browsers

avatar roland-d
roland-d - comment - 11 Sep 2019

There is something going sideways here. The language changes are not in relation to what browsers show but these are the message after the server-side validation is done. In case a validation fails, one of these messages are shown.

avatar brianteeman
brianteeman - comment - 11 Sep 2019

OK here you go and sorry for the confusion and please make sure they are the same frontend and admin

JLIB_FORM_FIELD_INVALID_MIN_TIME="The time you entered is before the minimum time."
JLIB_FORM_FIELD_INVALID_MAX_TIME="The time you entered is after the maximum time."
JLIB_FORM_FIELD_INVALID_TIME_INPUT="Invalid time format. Please use hh:mm."
JLIB_FORM_FIELD_INVALID_TIME_INPUT_SECONDS="Invalid time format. Please use hh:mm:ss"
avatar joomla-cms-bot joomla-cms-bot - change - 11 Sep 2019
Category Layout Libraries Administration Language & Strings Administration com_users Language & Strings Layout Libraries
avatar joomla-cms-bot joomla-cms-bot - change - 11 Sep 2019
Category Layout Libraries Administration Language & Strings com_users Administration Language & Strings Layout Libraries
avatar joomla-cms-bot joomla-cms-bot - change - 11 Sep 2019
Category Layout Libraries Administration Language & Strings Administration com_users Language & Strings Layout Libraries
avatar joomla-cms-bot joomla-cms-bot - change - 11 Sep 2019
Category Layout Libraries Administration Language & Strings com_users Administration Language & Strings Layout Libraries
avatar infograf768
infograf768 - comment - 11 Sep 2019

Tested with the simple example proposed by OP

This is not very useful for language/countries where AM/PM is not used as one has to add these values in the field. One can't enter 13:30 for example, but 01:30 PM
So, not only it is restricted to some browsers but it is also restricted to people familiar with AM/PM

Screen Shot 2019-09-11 at 18 35 16

EDIT: If it based on system locale, then we may be in bad shape when using a different language in the browser or OS (did not test).

See: https://www.timeanddate.com/time/am-and-pm.html

Where Is the 12-Hour Format Used?

Most countries around the world today use the 24-hour system. However, the 12-hour format, including am and pm, is officially used in a number of countries, including the United States, Canada (except Québec), Australia, New Zealand, and the Philippines.

The fact that it is changed to a text field in Safari for example let's enter anything in that field. No error. No indication of the real format to use, etc.

avatar brianteeman
brianteeman - comment - 11 Sep 2019

So, not only it is restricted to some browsers but it is also restricted to people familiar with AM/PM

The browsers take the time format from the operating system locale

The fact that it is changed to a text field in Safari for example let's enter anything in that field. No error. No indication of the real format to use, etc.

Thats easily resolved by adding a pattern in the xml of the field definition. The time input wont use it but the fallback text input will

       pattern="[0-9]{2}:[0-9]{2}">

https://codepen.io/brianteeman/pen/xxKjPgz

avatar roland-d roland-d - change - 11 Sep 2019
The description was changed
avatar roland-d roland-d - edited - 11 Sep 2019
avatar roland-d
roland-d - comment - 11 Sep 2019

No error. No indication of the real format to use, etc.
@infograf768 The test instructions were missing the latest change, so I updated them. Add the validate="time" and you will get error messages depending on your error.

avatar infograf768
infograf768 - comment - 12 Sep 2019

The browsers take the time format from the operating system locale

Not so obvious. Here on Macintosh, these are my settings:

Screen Shot 2019-09-12 at 08 26 51

I checked my system locale here. It is

imac-2:~ mac$ defaults read NSGlobalDomain AppleLocale
en_FR

Therefore I should get a 24 h for the time field.
It simply does not.

avatar roland-d
roland-d - comment - 12 Sep 2019

@infograf768 Which browser are you using? I want to see what I get here.

avatar infograf768
infograf768 - comment - 12 Sep 2019

I found the only way to get a 24h time field
I have to set up my Mac as (French first):
Screen Shot 2019-09-12 at 08 52 36

Which I don't like as I am used to an English Interface for more than 30 years...

Note: I use Firefox, but it is unrelated.

avatar roland-d
roland-d - comment - 12 Sep 2019

These are my settings, being Dutch I like it in English as well.
image

This is what I see in Firefox:
image

avatar infograf768
infograf768 - comment - 12 Sep 2019

Lucky you... I use Sierra 12.10.6

Concerning validation. I added validate="time" in the xml for user name.
I do get a warning indeed in Safari, but it flashes so fast I can't even read it.

error_timefield

avatar roland-d
roland-d - comment - 12 Sep 2019

@infograf768 That flashing message is unrelated to this PR. The message is just added the message queue of Joomla.

However for me nothing flashes, all Joomla generated messages stay on screen until I close the message.

avatar infograf768
infograf768 - comment - 12 Sep 2019

@roland-d

However for me nothing flashes, all Joomla generated messages stay on screen until I close the message.

Lucky you. I tested other messages in Safari and they do stay on screen until I close, but not this one.

avatar infograf768
infograf768 - comment - 12 Sep 2019

@VladikB
I understand how it behaves in Firefox.
My issue here is with the locale.

avatar roland-d
roland-d - comment - 12 Sep 2019

@infograf768 I was testing in Firefox. Doing the same test in Safari, there the message flashes indeed. However it doesn't fully disappear:
image

There are more issues in Safari. When I go to the System dashboard it loads like this:
image

a second later it looks like this:
image

I would say we move the Safari rendering to another discussion as this is not related to the time field.

As for the locale issue, I don't see how we can do something about that because it is browser that acts upon the time input field. To rule anything Joomla out, what shows up if you create a plain html file with just this field? Attached is a zip file with the HTML file with just the input.

time.zip

avatar brianteeman
brianteeman - comment - 12 Sep 2019

Or test with the codepen I posted yesterday https://codepen.io/brianteeman/pen/xxKjPgz

avatar infograf768
infograf768 - comment - 12 Sep 2019

@roland-d
Joomla is not at stake.
I still get the field with AM/PM with your html in Firefox as it really depends on my Mac settings.

Concerning Safari, I confirm your findings for some of the quickicons modules and agree it may have to be solved separately.

@brianteeman
Looks like your solution would help entering something which makes sense in the field in Safari, forcing 24h. Evidently the Label needs to be very informative, which may be confusing when the browser displays the time field as one, for example, would not be able to enter 17:00 in your proposal, but 05:00 PM

Screen Shot 2019-09-12 at 10 10 29

Note: When one gets the AM/PM field display in Firefox it shows like this:

Screen Shot 2019-09-12 at 10 06 37

It is not obvious that the last 2 -- mean entering AM or PM

avatar roland-d
roland-d - comment - 12 Sep 2019

The problem of all the dashes can simply be dealt with by providing a default value.

avatar infograf768
infograf768 - comment - 12 Sep 2019

The problem of all the dashes can simply be dealt with by providing a default value.

Would not you need one when the time field is using AM/PM, one when using 24h + one when the time field is a text field? ;)

avatar roland-d
roland-d - comment - 12 Sep 2019

I think you only need 1 default value.

avatar wilsonge
wilsonge - comment - 13 Sep 2019

This will do as a starting point. I don't think we need the polyfill and the validation looks good. As this is a browser native field I don't think there is much we can be doing to work around the differences - even if there are issues. We can consider trying to normalise in the future i guess. But i don't see this being much different to things like when we added the number field etc way back.

avatar wilsonge wilsonge - change - 13 Sep 2019
Status Pending Fixed in Code Base
Closed_Date 0000-00-00 00:00:00 2019-09-13 14:06:57
Closed_By wilsonge
avatar wilsonge wilsonge - close - 13 Sep 2019
avatar wilsonge wilsonge - merge - 13 Sep 2019
avatar wilsonge
wilsonge - comment - 13 Sep 2019

@infograf768 i agree btw that before this is used in core we need to evaluate the lack of consistency. However I think allowing people to use native browser fields is a good idea

Add a Comment

Login with GitHub to post a comment