Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Please support datetime and datetime-local type for input #26

Open
libook opened this issue Jul 14, 2016 · 2 comments
Open

Please support datetime and datetime-local type for input #26

libook opened this issue Jul 14, 2016 · 2 comments

Comments

@libook
Copy link

libook commented Jul 14, 2016

Please support datetime and datetime-local type for input

@ermouth
Copy link
Owner

ermouth commented Jul 14, 2016

Well, this support is reasonable in theory, but in practice... how do you see it?

input[type=datetime] is not supported by browsers, so how can I test it? Also this type of INPUT controls removed from HTML5 standard.

Although input[type=datetime-local] is supported by Opera and Chrome, and is in HTML 5.1 draft, implementation is awful.

For example, go here http://www.w3schools.com/html/tryit.asp?filename=tryhtml_input_datetime-local, set date and time, select control in devtool Elements view, and then check actual value of the control using $0.valueAsNumber.

You will be surprised, that control actually does not take in account your locale and sets value in GMT.

Any suggestions?

@libook
Copy link
Author

libook commented Aug 2, 2016

Sorry for late response.


The type 'datetime' has been removed from the HTML standard, so never mind it.

Although the type 'datetime-local' is new, it works fine on my browsers, even though on windows.
So maybe it is the time for adding it?


You will be surprised, that control actually does not take in account your locale and sets value in GMT.

I didn't understand this paragraph.


The input element with a type attribute whose value is "datetime-local" represents a control for setting the element’s value to a string representing a local date and time (with no timezone information).

Source

According to my understanding, the type 'datetime-local' means 'Nothing to do with time zone'.
So the input element with 'datetime-local' type will not do any processing with time zone.
In other words, If I input the time which is from my watch, the value of the input will be the same with my inputting.

For example,
if I input '2016/01/02 05:22 pm', the 'valueAsNumber' will be 1451755320000 and the 'value' will be "2016-01-02T17:22".
The timestamp 1451755320000 is just 2016-01-02 17:22 with no time zone information.

If I want to process datetime with time zone, I must do time zone converting between the value of input element and my Date object.

Apologize if I misunderstand your comment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants