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

Jukka K. Korpela jkorpela at cs.tut.fi
Tue Feb 18 23:12:46 PST 2014


2014-02-19 2:30, Michael[tm] Smith wrote:

> The following info seems relevant -
>
>    http://www.thepunctuationguide.com/comma.html#numbers
>    "Most authorities, including The Associated Press Stylebook and The Chicago
>    Manual of Style, recommend a comma after the first digit of a four-digit
>    number. The exceptions include years, page numbers, and street addresses."

Similar rules apply to other languages as well. Generally, we should 
expect implementations to apply documented locale-specific rules (for 
some locale determined somehow). There are different grouping rules, 
though; not all locales use groups of three digits. Anyway, we should 
expect a 4-digit number to be grouped, with some group separator, rather 
often.

> To me that appears to be a strong argument that formatting of years is in
> fact clearly an exception, and that's compelling enough to warrant having a
> type for them separate from the normal number type (in which four-digit
> numbers would instead have a separator, to follow existing longstanding
> conventions).

And what about page numbers and street addresses (and other exceptions)? 
If we have <input type=year>, then it would be rather odd to use it for 
reading a page number.

Most importantly, though, this would introduce yet another value for the 
type attribute for something that can well be handled with existing 
tools: <input pattern=\d{4}>. It is improbable that any year selection 
widget would be useful. Years are normally best entered by typing them.

On the other hand, as this is about input, not output, a simple 
additional rule (which has other usability benefits, too) would solve 
the issue, too: User agents may allow locale-specific group separators 
in a number (e.g., “1,500” when the locale is English), but they shall 
accept a number without group separators, too (e.g., “1500”, in any locale).

Yucca





More information about the whatwg mailing list