Kung Fu Kung Fu

Fujian White Crane Kung Fu

Zope Zope

What I have and am doing with Zope

Photos Photos

Photoalbum, both old and new.

Receptsamlingen Receptsamlingen

In Swedish only. About my "Collection of Recipes" website.

Contact me Contact me

My contact details and how to contact me.

  Mobile version of this page Mobile version of this page


 

Nice date input

inputting, dates, datetime

17th of October 2003

Inspired and copied from http://simon.incutio.com/code/js/date-parser/ and http://javascript.internet.com/calendars/fuushikaden-pop-up-calendar.html

This I think is a very neat way of inputting dates on a web form. The server side code must thus be able to parse both 13 december 2003 and 13/12/2003 but that shouldn't be too hard with the DateTime module.

Look at the demo

If you have a browser with which this doesn't work let me know by posting a comment here.

UPDATE this demo had a little bug in the output that I have now fixed.


Comment

Sönke - 6th February 2004  [«« Reply to this]
Hi Peter,
what about i18n? I'm from germany and need to fill in something like '13 März 2004'.
Is this possible?

Greets, Sönke
Peter - 6th February 2004   [«« Reply to this]
Not sure. You can translate the strings in the javascript for the dateparse.
For the popup calendar I guess that's the same too.
I.e. search for "Mars" and replace it with "März".
Anonymous - 1st April 2004  [«« Reply to this]
very nice. I notice that If I put my birthdate as 7/8/1969 (US month/date) it interprets it as date/month (7th of august instead of 8th of july) but I like it! Mind if I download the javascript and start using it?
Jim - 1st April 2004  [«« Reply to this]
very nice. I notice that If I put my birthdate as 7/8/1969 (US month/date) it interprets it as date/month (7th of august instead of 8th of july) but I like it! Mind if I download the javascript and start using it?
Peter - 1st April 2004   [«« Reply to this]
That's because you americans are wrong! No, actually I hacked the original script to do the british style before the american style. See the dateparse.js source and look for comments with 'Peter' in them.
Andreas - 19th January 2006  [«« Reply to this]
It's not a matter of who is wrong or not. Wrong attitude!
Sascha Welter - 17th April 2006  [«« Reply to this]
Peter: That javascript seems to be a bit dated, it has bugs that show up once you set a DOCTYPE on the html, something like described here: http://javascript.about.com/library/bliebug.htm
but it's not using document.documentElement or document.body (as mentioned in that article). It works without a DOCTYPE (as in your demo) or with a DOCTYPE for HTML 3.2, but it sets the position of the calendar wrong with any more modern DOCTYPE string in IE, Safari, and Firefox.

Since I'm not a JavaScript dude, I've not attempted to fix things so far.

Hey, and what's up? You're not on #zope any more?
Sascha Welter - 17th April 2006  [«« Reply to this]
Found an updated version at:
http://www.thalys.com/js/calendar.js?lg=en&country=fr
(Which works fine even with newer browsers using proper DOM.) Calling the popup seems to have a different method signature, and I haven't figured out too much yet, but something like onclick="popUpCalendar(this, this, 'dd-mm-yy','17-04-2001','01-01-2038') seems to work.
 
Name:
Email:
hide my email address.

Your email address will be encoded to prevent email-extraction spiders from reading it so you won't get spammed if you decide to show your email address.