Skip to content
This repository has been archived by the owner on Jul 30, 2019. It is now read-only.

datetime-local needs a health warning for floating to incremental time conversion (was I18N-ISSUE-89) #474

Closed
aphillips opened this issue Jun 8, 2016 · 3 comments

Comments

@aphillips
Copy link

The HTML5.0 issue was originally closed when the type datetime-local was removed from the Spec. When that input type was revived recently, the resulting text does refer to floating time values. However, the original thread included an ask for a "health warning" related to the fact that the values in this type are implicitly converted to incremental time values with a time zone of UTC. Here are the conversion paragraphs in the current draft:

The algorithm to convert a string to a number, given a string input, is as follows: If parsing a date and time from input results in an error, then return an error; otherwise, return the number of milliseconds elapsed from midnight on the morning of 1970-01-01 (the time represented by the value "1970-01-01T00:00:00.0") to the parsed floating date and time, ignoring leap seconds.

The algorithm to convert a number to a string, given a number input, is as follows: Return a valid normalized floating date and time string that represents the date and time that is input milliseconds after midnight on the morning of 1970-01-01 (the time represented by the value "1970-01-01T00:00:00.0").

A health warning should make mention of this. Otherwise users might be surprised when they enter a "local" wall time and it is later returned as a different date or time value because of the difference between local wall time and UTC.

@stevefaulkner
Copy link
Contributor

stevefaulkner commented Feb 3, 2017

@aphillips can you provide some proposed text for the warning? and I will add it to the spec

@stevefaulkner
Copy link
Contributor

@aphillips ping

@aphillips
Copy link
Author

Sorry for the delay in responding: I'm traveling currently. I'd propose:

Applications need to use care when working with datetime-local values, since most date time objects (in languages such as JavaScript or server-side languages such as Java) use incremental time values tied to the UTC time zone. Implicit conversion of a floating time value to an incremental time can cause the actual value used to be different from user expectations. For more information, see: [timezone]

[timezone] https://www.w3.org/TR/timezone/#floating

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

No branches or pull requests

5 participants