Datatable Editor DateFormat
Datatable Editor DateFormat
gunseli
Posts: 14Questions: 8Answers: 0
Hi,
I get an error when I use the date format as follows.
Unable to cast value to be DateTime
.Field(new Field("Vessels.ETA")
.Validator(Validation.DateFormat("Y-m-d"))
.GetFormatter(Format.DateSqlToFormat("Y-m-d"))
.SetFormatter(Format.DateFormatToSql("Y-m-d"))
)
My sql date format is like this.
2020-03-10 00:00:00.000
Thanks..
This discussion has been closed.
Answers
Looks like wrong syntax.
https://editor.datatables.net/manual/nodejs/formatters?1
Also, make sure your model uses a
string
type for the field, rather thanDateTime
(sinceDateTime
has no direct representation in JSON).Allan