datepicker format on datetime field

datepicker format on datetime field

TeeWeeTeeWee Posts: 6Questions: 3Answers: 0

Hello everyone,
I am new to this forum.
I've been trying and reading for hours but I'm still having problems with the datepicker.
How can I format a datepicker for a datetime field like this: d.m.Y H: i

******* Source ********
....
Editor :: inst ($ db, 'a53_cc_zeiten')
-> fields (
Field :: inst ('Name')
-> validator (Validate :: notEmpty (ValidateOptions :: inst ()
-> message ('Name required field')
)),
Field :: inst ('datetime')
-> getFormatter ('Format :: datetime', array (
'from' => 'Y-m-d H: i: s',
'to' => 'd.m.Y H: i'
))
-> setFormatter ('Format :: datetime', array (
'from' => 'd.m.Y H: i',
'to' => 'Y-m-d H: i: s'
)),
...


AND


....
$ (document) .ready (function () {
editor = new $ .fn.dataTable.Editor ({
ajax: "controllers / staff2.php",
table: "#example",
fields: [{
label: "Name:",
name: "Name"
}, {
label: "Timestamp:",
name: "datetime",
type: "datetime",
def: function () {return new Date (); },
dateFormat: "d.m.Y H: m"
},
....


It works fine with manual input, but the datepicker still formats to Y-m-d

thank you for your help

Answers

  • colincolin Posts: 15,237Questions: 1Answers: 2,599

    I would say send it as, if it's in ISO 8601 format, and use the formatting on the field definition on the client with wireFormat and displayFormat. This example demonstrates that,

    Colin

This discussion has been closed.