W3C home > Mailing lists > Public > whatwg@whatwg.org > February 2014

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

From: Jonathan Watt <jwatt@jwatt.org>
Date: Tue, 18 Feb 2014 23:37:24 +0000
Message-ID: <5303EEB4.7020000@jwatt.org>
To: whatwg@lists.whatwg.org
On 18/02/2014 23:17, Ian Hickson wrote:
> On Tue, 18 Feb 2014, Jonathan Watt wrote:
>>
>> When implementing <input type=number> for Mozilla I decided to display
>> the value to the user using the grouping separator (generally the
>> thousands separator) of the users locale. So, for example, if the
>> input's value is 1234 and the user's locale is English, it is displayed
>> to the user as "1,234".
>>
>> This is causing a problem for at least media wiki, because they use
>> <input type=number> for year input. For example:
>>
>>    https://en.wikipedia.org/w/index.php?title=IRIX&action=history
>>    https://en.wikipedia.org/wiki/Special:Contributions/newbies
>>
>> The question is, should I change Mozilla's implementation to stop
>> displaying the internal value using grouping separators, or is it wrong
>> to use <input type=number> for year input. I'm erring on the former, but
>> I'd like to solicit others' thoughts on this matter.
>>
>> I should also note that I can still allow the implementation to accept
>> input from the user that contains grouping separators, even if when the
>> internal value is set/changed the visual result will be updated to a
>> string that does not contain grouping separators.
>
> 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.

> 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...
Received on Tuesday, 18 February 2014 23:37:51 UTC

This archive was generated by hypermail 2.4.0 : Wednesday, 22 January 2020 17:00:16 UTC