Open Bug 1432575 Opened 7 years ago Updated 2 years ago

Input format property for date input (feature request)

Categories

(Core :: Layout: Form Controls, enhancement)

57 Branch
enhancement

Tracking

()

UNCONFIRMED

People

(Reporter: chris, Unassigned)

Details

User Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:57.0) Gecko/20100101 Firefox/57.0 Build ID: 20180104101725 Steps to reproduce: This is really a feature request ! How about an inputformat property for the date input control which would allow the developer to override the locale of the user browser / OS. eg: <input type="date" inputformat="dd-mm-yyyy"> I often want to force a locale upon the end user to bypass the mess of the language settings on their computer. I developed my own date control in javascript but would love to be able to roll out your native control ! Thank you !
Severity: normal → enhancement
Component: Untriaged → Layout: Form Controls
Product: Firefox → Core
Looks like the W3C are thinking about this as well: https://www.w3.org/International/wiki/Locale-based_forms

IMHO, it would be great if the format would default to something fitting to the "lang" of the document (or the element, derived via inheritance), is this the bug for that and for implementing this, or the spec mentioned in comment #1, or should there be a separate one?

I might want the date input date format to change so that, for the same English language page, an English speaker in the USA with USA locale info would get a USA formatted date control whereas an English speaker in the UK would get a UK formatted date control.

How would you know in which language to serve your document except by using browser locale info ?

IMHO: It should fallback in this order:

  1. Explicit property that can be set for the control
  2. Explicit, cascading property that can be set for a containing element or the whole DOM
  3. language & locale settings from browser

Scenario : We outsource our data input for scanned documents to various Asian countries, the dates on scanned documents appear as dd/mm/yyyy so we would like the user to enter the date as dd/mm/yyyy, however the users computer have different locale to the format on the documents. We would like the to set the input format according to the original scanned document despite what the user has in the locale, to reduce the data entry errors. Currently the <INPUT type="date" /> control is unusable for our needs. :-(

Maybe this could go alongside something like this ?
https://bugzilla.mozilla.org/show_bug.cgi?id=1428553#c6

Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.