Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

Archive

Our old forums are still available as a read-only archive.

Moderators: martimiz, Sean, biapar, Willr, Ingo, simon_w

Changing the date field to US format


Go to End
Reply

9 Posts   4743 Views

Avatar
sonicparke

29 November 2007 at 10:47am 74 Posts

I'm having the hardest time changing the format of the date that is returned when you select it from the calendar in the form date field. I've changed everything I could see in Date.php & DateField.php. My global date format hasn't changed either. I have flushed the DB & admin & site multiple times.

Is it possible to change the format for this? It seems like a relatively simple thing to do.

Avatar
Ingo

29 November 2007 at 1:20pm Forum Moderator, 801 Posts

looks like you're on the right track with subclassing stuff (at least until we've got proper field-localization going). DateField.php and Date.php should be the only relevant classes here - can you step through the saving/loading process and see at which point the date-format changes?

Avatar
sonicparke

30 November 2007 at 4:01am 74 Posts

I guess I can change one thing at a time and see if anything happens. I thought I had already changed everything that made sense and it didn't seem to affect anything. But I'll try it again with a different approach.

Avatar
sonicparke

30 November 2007 at 7:49am 74 Posts

I'm still getting nowhere. I can see where i can change the format for the Nice function. I just can't figure out how to get the Nice function working when it returns the date chosen from the calendar into the text box. I can't seem to figure out where all this happens. I'm assuming I'd find a return $Date somewhere that I could Nice Method to and that would be it.

Is that the right way to do this & if so what file is this in?

Avatar
Ingo

30 November 2007 at 9:00am Forum Moderator, 801 Posts

ah, so we're talking about a CalendarDateField? thats a bit more tricky, you probably need to look at the javascript-logic as well

Avatar
sonicparke

30 November 2007 at 9:17am 74 Posts

OK. I'll look for that.

Avatar
sonicparke

3 December 2007 at 4:02pm 74 Posts

OK. I'd like to know if anyone has been successful at changing the date format in the stable release of 2.2.0. I was messing with it on 2.2.0-rc2 and it changes just fine. It has been a couple of days since I made the changes and noticed that it was working.

So either there is a bug with the stable version that wasn't in rc2 or it takes several hours to a couple of days to take effect.

Has anyone successfully changed the date format to US?

Avatar
areikiera

27 February 2008 at 4:23am (Last edited: 27 February 2008 5:22am), Community Member, 26 Posts

I've successfully changed the CalendarDateField to the American Date Format.

I changed this file: jsparty\calendar\calendar-setup.js

In line 5, change "ifFormat : %d/%m/%Y" to "ifFormat : %m/%d/%Y"

It doesn't appear to work at first, but flush the cache and it will show up after you select a date from the pop-up calendar.

Hope this helps!

Go to Top