Input Date type with year containing 6 digits

Notice the snippet just below, that the input of the type date when entering the value year , you can enter 4, 5 or 6 digits to be exact:

<input type="date">

My doubts are exactly:

  • for what purpose can the year have more than 4 digits?
  • if there is any purpose for this, How could it be applied?

I know that by being used the attributes min e max, automatically the year can only receive 4 digits, so why the default value of the year can receive up to 6?

Author: Maniero, 2019-08-09

1 answers

For me it's just a bad pattern. Of course, a year can have values of 5 or 6 digits for some scenarios (not exactly within the Standard (standard) universal), but no one works with it, the browser standard should be what people use most and at the moment it is 4 digits (it was already 2 and could be back) and the ISO 8601 standard clearly says it should be 4 (giving the freedom to be more, which for me is a bad freedom because it does not have a fixed standard, but it adopts the ISO standard. a number that makes more sense).

But note that limiting the minimum and maximum that can be entered nothing changes in Firefox, even if it initializes with an off value. Of course, at the end of typing it will be considered invalid, but it works with 6 digits. Try it:

<input type="date" value="111111-08-09" min="2019-01-01" max="2019-12-31">

Solution for this in FF? It may be that there is something simple (I did not find it, it is full of wrong answers out there), but I think the current solution is to make your own that works right.

In fact was considered a bug in Chrome and so they changed, but they considered that they could not change more radically because the specification does not have to do this and if they do and one day the specification has to do something else they will have something incompatible. Let's wait for the FF to fix this (want to open a Issue?). I don't know about Safari.

And the specification might not change because it might create a mismatch in some browser that did something else, creating a deadlock:). Web is one of the worst inventions of computing precisely for these things, the idea is good, the implementation is terrible. They are concerned about accessibility when not even the basics work right.

 7
Author: Maniero, 2019-08-12 14:04:47