Wednesday, July 28, 2010

Could I just type a date, please?

For some reason, I've been running into sites with broken date entry fields.

It doesn't seem like a hard problem. In the States, at least, the standard format for dates is "mm/dd/yyyy", so a decent date entry field would behave something like this:
  • If I type in, say, "7/27/2010", the date entered will be July 27, 2010
  • Um, that's about it. The left and right arrow keys move amongst the numbers, maybe the up and down arrows increase/decrease the field where the cursor is.
The problem is, an annoying number of sites use something that does even more for you: If you type in enough to fill in a field, it moves you to the next field -- which is actually fine -- but it doesn't remember that it did that. "Fill up the field" and "/" both move you to the next field. If you get to the end, it wraps around to the beginning.

So if I type 7/27/2010
  • 7 goes in the month field. Good.
  • / moves me to the day field. Good.
  • 27 fills in the day field and moves me to the year field. Fair enough.
  • / wraps me around to the month field. Wha?
  • 20 fills in the month field again, except 20 isn't a valid month. Urgh.
  • 10 fills in the day field again. Foo.
  • I end up with "20/10/" and no year. Bleh.
Of course, all I have to do is remember not to use / if it's the 10th or later and October or later. Right.

Or this widget could just not use / to move fields if it just moved because of a full field.


earl said...

And then there are some sites ( that want yyyy/mm/dd.

Oh, why not.

David Hull said...

yyyy-mm-dd (hh:mm:ss.nnnnnn) is actually a pretty useful format. Amount other things, it sorts well, particularly if you pad everything out with zeroes. However, it's not what most of the world's population is used to, so probably not a good choice for a public web site.