German Dates in Datatable and Editor

German Dates in Datatable and Editor

Stefan.GStefan.G Posts: 1Questions: 1Answers: 0

Per ajax i get english date formats from the server.
In Datatable i use a render to format DD.MM.YYY

DATATABLE

         columns: [
                 ...                
                 { data: "datum", title: "Datum", render: function(d) {return d ? moment(d).format("DD.MM.YYYY") : ''} },
                 ...
        },

and in EDITOR:

   {  name: "datum", label: "Datum",  type: "datetime", format: "DD.MM.YYYY" },

the datepicker works as expected and a selected date is returned in DD.MM.YYYY.

BUT when edit a dt-row, the date-field in editor is always filled in YYYY-MM-DD-format until i picked a new one.

What must i do to have DD.MM.YYYY per default?

Answers

  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin

    Per ajax i get english date formats from the server.

    You either need to modify them in the JSON data source at the client-side (ajax.dataSrc can be used for that), or modify them on the server-side so the client sees only the expected format.

    Editor always works with the raw data for a field. In this case that is ISO8601.

    The examples use server-side formatters to transform the date as required, so the client-side will only see the formatted date.

    Allan

This discussion has been closed.