[whatwg] format strings

Dean Edwards wrote:

>
> numbers
> --------
> because javascript/ecmascript only respects US/english style numbers it 
> is unreasonable to ask the spec to allow/validate european style numbers 
> (e.g. 1.000.000,00) but it should at least provide a mechanism for 
> displaying numbers in this format (it's only polite).

The spec only allows/validates US/English style numbers as the field
*value*, but the UI (and hence display) of the number should respect
the locale.

> dates
> -----
> i don't want my english style date converted to a US style date when 
> submitted to the server (especially if i'm booking a plane). after 
> tabbing out of a date field, if my date entry is formatted (e.g. 30 Jul 
> 2004) then i *know* i've entered the right information.

Similarly, for dates, the value is always given in ISO format. The
*display* can be anything, but the script and the server won't know
and won't care.

(Ian, I think you need to clarify this in the spec. It talks about
  "submission" formats, but not about the format in which the value
  must be stored in the DOM.)

> currencies
> ----------
> a large proportion of forms data is about money (true). again the 
> feedback thing: is "50", fifty dollars or fifty cents? data formatting 
> provides immediate feedback.
> i also humbly suggest adding another input type - "currency".
...
> this is a real nuisance in web applications because there is currently 
> no way to separate the presentation and content of forms data. this 
> issue needs to be addressed. a lot of javascript code is wasted on 
> formatting data for the end-user, which on submission, is then 
> "unformatted" for the server. some servers are just to darn lazy to do 
> it for you...
...
> now can someone suggest some suitable date and number formatting 
> patterns please?

I'd say that for dates, you need a few keyword values.
For numbers, you need to be able to say "append/prepend this unit".
(Currencies are covered under the "number" input type.)

In neither case is a full-fledged format string necessary.

~fantasai

-- 
http://fantasai.inkedblade.net/contact

Received on Tuesday, 13 July 2004 01:33:32 UTC