Date Input Format / Form Date Input Format [Workaround]
Permalink
I've seen a few posts knocking around the place to do with the current bug with formatting the date within the "form/date_time" helper. I've just come across the same issue, for reference it is fixed with as simple jQuery call.
Below is the code you should have (or something similar):
You need to change to the following:
Formatting for the UK is shown above.
For those of you worried about standards & validation, you'll need to move the added code or you could re-write the code to select all elements and update them via code in your header. No time to write an example here now, sorry!
Oliver
Below is the code you should have (or something similar):
$dh = Loader::helper("form/date_time"); print $dh->date("my_date_input");
You need to change to the following:
Formatting for the UK is shown above.
For those of you worried about standards & validation, you'll need to move the added code or you could re-write the code to select all elements and update them via code in your header. No time to write an example here now, sorry!
Oliver
Is this still the best way to approach this problem with C5?
In c5.6.3.1 a lot of work was done on internationalisation and as part of that on date formats. So in an up-to-date installation the issue on this old thread may no longer exist.
I realised that this was an old thread, but had found no other solution.
As it happens I am working with a 5.6.3.1 installation, but don't see where I can make the appropriate changes.
I see that I can't even select British English as it's not on the list.
As it happens I am working with a 5.6.3.1 installation, but don't see where I can make the appropriate changes.
I see that I can't even select British English as it's not on the list.
All date formats displayed should come from site constants that use php date format strings, so you can redefine them in config/site.
You probably want to define DATE_APP_GENERIC_MDY as that appears to be the format constant the date helper uses.
Another constant you may want to use is DATE_APP_DATE_PICKER.
The first controls date formats used for most things throughout concrete5 (http://www.php.net/manual/en/datetime.formats.date.php... ). The second appears to be the format passed to the datepicker (as perhttp://api.jqueryui.com/datepicker/#option-dateFormat... )
You can see both in use in the core file
concrete/core/helpers/form/date_time.php
You probably want to define DATE_APP_GENERIC_MDY as that appears to be the format constant the date helper uses.
Another constant you may want to use is DATE_APP_DATE_PICKER.
The first controls date formats used for most things throughout concrete5 (http://www.php.net/manual/en/datetime.formats.date.php... ). The second appears to be the format passed to the datepicker (as perhttp://api.jqueryui.com/datepicker/#option-dateFormat... )
You can see both in use in the core file
concrete/core/helpers/form/date_time.php
Okay, thank you. (Where should I have found this information in the documentation?)
That's only part of the way to a proper solution though; datepickers really ought to use the altField and altFormat to send and save dates in the ISO8601 format to prevent any possible confusion.
That's only part of the way to a proper solution though; datepickers really ought to use the altField and altFormat to send and save dates in the ISO8601 format to prevent any possible confusion.
The documentation is way behind on information like that. Date/Time format issues have been discussion topics on the forums and c5 github that I have followed. Armed with a bit of background, I then looked in the php source.