2

tI want to add a calendar field to my custom form:

http://docs.joomla.org/Calendar_form_field_type

But I'd like that expected date format would be different depending on user's active language, as "standard" format is different from Europe to the US, for example. When outputting a date, Joomla handles that by default using DATE_FORMAT_LC constant, which comes fully localised with each language pack, and you can even customise it on a per language basis using language overrides... is there something similar for entering dates?

In the link I posted above it says this:

format (optional) is the date format to be used. This is in the format used by PHP to specify date string formats (see below). If no format argument is given, '%Y-%m-%d' is assumed (giving dates like '2008-04-16').

I've tried entering the lang constant for date format to that parameter, but doesn't seem to work:

<field name="mycalendar" type="calendar" default="5-10-2008" label="Select a date" description="" format="DATE_FORMAT_LC" />

Is there a built-in way for handling this? Or I'll have to add the logic to use one format or another depending on user's language?

Thanks in advance!

2

Sorry that answering on so old question, but just wanted to say that there is no built-in way to make it. You should consider to create your own field type and implement the logic there.

  • 1
    Thanks Dmitry, I got to that conclusion too in the meanwhile ;). – Isidro Baquero Jan 28 '15 at 13:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.