[whatwg] <input type=number> for year input

Nils Dagsson Moskopp nils at dieweltistgarnichtso.net
Tue Feb 18 20:32:57 PST 2014

Ian Hickson <ian at hixie.ch> writes:

> On Tue, 18 Feb 2014, Jonathan Watt wrote:
>> > 
>> > My recommendation would be to just use comma separation
>> It would be the appropriate separator(s) for the locale in use, not 
>> necessarily the comma, but I'm guessing that's what you meant.
> Sure.
>> > for numbers greater than 9999. It doesn't help that much for 
>> > four-digit numbers, and years beyond four digits often _do_ have 
>> > commas, e.g.:
>> > 
>> >     http://en.wikipedia.org/wiki/Year_10,000_problem
>> > 
>> > I agree that it's a bit weird (though not particularly wrong) for 
>> > four-digit years to have commas.
>> Personally I think it's a bit more than a bit weird to have "Year: 
>> 2,014". It seems pretty ugly to me, and four digit years are going to be 
>> the common case.
>> > type=number does seem appropriate for years, though.
>> I wonder if it would be that bad to have a 'year' type to compliment the 
>> 'month' and 'day' types...
> This has come up a few times, but so far the use cases have not been 
> compelling enough. This is probably the most compelling use case, but even 
> here, I don't know that it's that compelling.

The number of a calendar year really does not fit into to the number
model. Year numbering conveys something different than floating point
numbers or even integers. Standardization of values on ISO years /
proleptic gregorian calendar could prevent quite a few errors here.

Some calendars do have an integer offset to the gregorian calendar,
allowing localization. If I understand the Wikipedia pages correctly, to
get the year in the Thai solar calendar one has to add 543 to the ISO
year and for both the Republic of China calendar and North Korean
calendar one has to substract 1911.


Interface-wise, a dialog for <input type=year> without a value might
focus the current year initially – I would consider that a usability
boon. Year selection dialogs do already exist:

> I would be interested in hearing more about the locales where not using 
> separators even for four digits is bad/suboptimal. If it wasn't for those, 
> I would say that just not using separators for four-digit numbers would be 
> an easy and effective solution.

This rule may not be so useful in general: Digit grouping using dots,
commas or spaces can be useful when comparing smaller and larger
numbers. Consider the following grouping of <input type=number>:

[ 210 000 ] [+|-]
[  19 250 ] [+|-]
[   1 500 ] [+|-]

Nils Dagsson Moskopp // erlehmann

More information about the whatwg mailing list