I'm creating a date field with a pop-up calendar and I'm attempting to use the format 'j M Y' (which looks like "23 Jul 2008"). However, the jQuery pop-up calendar does not seem to respect the 'M' part of that. If I have the field set to today as the default value, upon clicking on the field, the calendar appears, but… well, check out the screen shot. Upon clicking on Today, the dates for the current month appear and the widget works as normal; however, the text that appears in the text field has a format like "23 07 2008" (the month appears as a padded int). When the form is submitted, however, it reports that such a date is invalid.
This is happening in both Webkit and Gecko. I'm on PHP 4, if that matters (my company's D-list web host still hasn't upgraded). I tried both beta 3 and the dev release as of the time of this posting; no difference.
Comment | File | Size | Author |
---|---|---|---|
Picture 29.png | 8.06 KB | Garrett Albright |
Comments
Comment #1
Garrett Albright CreditAttribution: Garrett Albright commentedIf it's helpful, here's the code I'm using to create the form element. Please don't mind the weird way I'm storing the #default_value -- there's a method to that madness, really.
Comment #2
KarenS CreditAttribution: KarenS commentedThe jcalendar widget can't use that format. It uses only a very small set of formats, like Y-m-d, m/d/Y, d.m.Y. I don't have any control over that, that's the way it works. If you select a format in the UI you'll see that you're limited to those formats and aren't allowed to create a custom format for it.
Comment #3
Garrett Albright CreditAttribution: Garrett Albright commentedI see. I guess JavaScript needs a library which can emulate PHP's date() function… if only I had all the time in the world.
Comment #4
KarenS CreditAttribution: KarenS commentedNot so much what javascript can do as that the author of the jQuery calendar widget didn't allow for any other format. It may be a translation issue since the allowed values are all things that don't require translation.
Comment #5
KarenS CreditAttribution: KarenS commentedWell, good news! I just updated the D6 version to the latest jquery datepicker code and it now allows more format options. You can now use 'M'. This won't work in the older jQuery code that I have to use in the D5 version, but will work in D6.
Comment #6
Garrett Albright CreditAttribution: Garrett Albright commentedExcellent. When I get back into the office on Monday, I'll give it a try.
Comment #7
Garrett Albright CreditAttribution: Garrett Albright commentedExcellent, the new calendar works perfectly with that format. (Well, there's some cosmetic issues, but those might be my fault.) Thank you.
Comment #8
Anonymous (not verified) CreditAttribution: Anonymous commentedAutomatically closed -- issue fixed for two weeks with no activity.