Allow multiple input formats for Editor datetime field type

Allow multiple input formats for Editor datetime field type

datacollectdatacollect Posts: 6Questions: 4Answers: 0

Hi,
our server always returns iso formatted strings. Thus we are handling the locale based formatting of dates on client side (using moment.js and the render option in the columns definition).
For editing date fields we are using the datetime fieldtype. Unfortunately there is no possibility to let the field parse the iso formatted date but display the locale based formatted date.
A solution would be an additional option for the datetime fieldtype to define multiple input formats or at least that the datetime fieldtype is able to parse iso formatted date strings in general. Any chance this might be implemented in the future?
Thanks for an answer.

Answers

  • allanallan Posts: 61,642Questions: 1Answers: 10,093 Site admin

    Thanks for the feedback. As it currently stands the datetime input is given a format (or uses its default of ISO8601) and then uses that format only (as you have discovered).

    In future I might relax that so it allows the format or ISO8601, but it is unlikely that it will support multiple complex formats (I'd be worried about ambiguous values - is 6-6-2016 m-d-y or d-m-y for example).

    Would it be possible to have your data contain the two formats you need? If you are using the prebuilt PHP or .NET libraries you can specify the same field twice - just give one an alias.

    Allan

This discussion has been closed.