The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums Other Changing the Default Base Step for HTML5 Date Inputs

  • This topic is empty.
Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
  • #42522

    Hello All,

    I was messing around with the new HTML5 input elements, in particular the [date element]( “”). I constructed the element like so:

    The default base for date elements is the epoch or 1970-01-01 in this case. However, most browsers will change the default base either to the max or the min element if they are valid date strings.

    This is where it gets tricky, because the spec doesn’t specify when max or min should be used, at least that I can find.

    In the latest version of Opera, the above field could have a valid value of “1970-01-02”, because Opera changes the default step to 1970-01-04 and 1970-01-02 is -2 days away, which is an even modulo of the step (-2 % 2 == 0). In Chrome it is **NOT** a valid date, because the default base remains “1970-01-01” and that leaves us +3 days away, which is an odd modulo of the step (3 % 2 == 1).

    Which browser is in the right? I’m leaning towards Opera. It seems to be that the max attribute should be used unless a min attribute is provided, in which that should be used as the default step. If neither are present, use 1970-01-01.

    Any ideas or thoughts? I’ve added this to the spec [bug tracker]( “Bug Tracker”)
    so hopefully they’ll be able to provide some clarity.


    Answered my own question, looks like Chrome is the one in the right: [Step Attribute]( “”)

    Only the min attribute can change the default step, not the max.

Viewing 2 posts - 1 through 2 (of 2 total)
  • The forum ‘Other’ is closed to new topics and replies.