[whatwg] Proposal: datesubmissionformat (repost)

Lachlan Hunt lachlan.hunt at iinet.net.au
Wed Jul 21 18:18:46 PDT 2004

Malcolm Rowe wrote:
> Date:
> <input type="text" maxlength="10" name="edit[visit_date]" size="8" 
> value="">
> Enter date of visit as dd/mm/yyyy

> So, what can the site author do? In my mind, they could do one of three 
> things:
> * They could change to <input type=date>, and change the server-side 
> processing to allow either type of date to be provided.
> * They could change to <input type=date>, and add client-side scripting 
> to convert one value into another (and probably provide some client-side 
> validation for non-WF2 UAs at the same time).
> * They could do nothing, and leave the page as-is.

Why couldn't they just change the hint to a different format?

   <label>Enter date of visit as YYYY-MM-DD:
          <input type="date" ... ></label>

> Critically, I am not proposing a general-purpose format specifier; the 
> allowed values for this attribute would be drawn from a short list of 
> 'common' date formats. The ones I had in mind were "iso" (for ISO8601, 
> the default, yyyy-mm-dd), "d/m/y" (UK format, dd/mm/yyyy), "m/d/y" (US 
> format, mm/dd/yyyy), and probably a 'European' format "d.m.y" (dd.mm.yyyy).

   If there was going to be a date format attribute, then I would insist 
that it accepts strings using the same letter convention as in the 
ISO8601 spec.

eg. YYYY-MM-DD, YYYY-Www-D, YYYY-DDD, hh:mm:ss.sZ or combined as 
YYYY-MM-DDThh:mm:ss.sZ (where Z represents the timezone that can be 
entered as either a literal "Z" or ±hh:mm.  Using the same letters, they 
could be ordered however the author liked (though ISO format would be 
recommended) eg. DD/MM/YYYY, MM/DD/YYYY.

   Even if these were predefined formats rather than any arbitary 
format, this would make it easier to understnand and more logical than 
just a single letter for each, though I think attempting to restrict it 
to a list of predefined formats wouldn't work anyway, because authors 
don't always read the specs, so many would just guess and think they 
could enter it however they like.

Lachlan Hunt

lachlan.hunt at lachy.id.au

More information about the whatwg mailing list