15. feb 2001
dez 19ter-15. '01
januar - dezember '04
etc. it's german date formats ;).
It is of course not easily to be seen by users that they can use pretty complex pattern - but since it was a web application that was no problem with some hints next to the input field.
My conclusion would be, that I could see, how this type of date (-range) input could work out well for a blog archive or article search instead of displaying calendars or using 3 text input field as in your simple example.
(what does email notification in your comments form mean at all? *checking*) :p

gani said on June 13, 2005

This is nice, but one question: Why doesn't it return f=february, s=september etc. for months that have singular starting letters? That makes more sense than an error message in those cases.

Clay said on June 13, 2005

I'm just being an ass, but I like to spell out the number of the month. How come your system does support that?

Not really, but I do second a trim() function. I have a soft space bar which gets pressed at all the wrong times.

Jurgen said on June 14, 2005

A month array has just 12 options, why not just show all of them in a select list?

Jonathan Snook said on June 15, 2005

gani: I actually debated as to whether I should just default to displaying the month if only one possible month was an option. I decided against it because I felt that if only one character was entered, it might have been by accident. Just a hunch, though.

Jurgen: 12 options is still a lot when you use just a keyboard to navigate. The next time you find a dop down on a site, try using the keyboard to select an option.

Jonathan said on June 16, 2005

Interesting idea... I've seen similar. I can think of no case where adding 4.12 KB to a page would be worth this functionality, save on an Intranet application. I mean, that's a lot of page weight when you could *easily* do the same thing in server side code, and knock a few seconds off your form's load time.

Wayne said on July 31, 2005

function numSort(a,b) {
a = parseInt(a);
b = parseInt(b);
if(a > b) return 1;
if(b > a) return -1;
return 0;

Is simplified to:

function numSort(a,b)
a = parseInt(a);
b = parseInt(b);
return (a > b) - (b > a);

Jonathan Snook said on July 31, 2005

Wayne: That's fantastic! Thanks for the tip.

Laurence Dawson said on August 14, 2005

beautiful script

Mathieu 'P01' HENRI said on October 11, 2005

Why not simply :

function numSort( a, b )
return parseInt( a )-parseInt( b )


stan said on October 18, 2005

dropdown with suggestions is key. nice.

Sorry, comments are closed for this post. If you have any further questions or comments, feel free to send them to me directly.