Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Backgrid wont render date values from database

Im new to backGrid and im very impressed with what it can do so far.

I have successfully got some data from my Database back to my web-app in JSON and all renders ok with the exception of a date column which will throws an error:

Object 1361561820000 has no method 'trim' Heres is the column:

var columns = [{
name: "dateTime",
label: "Date/Time",
cell: 'date'
}];

This will render ok on the page when cell is set to 'string' but obviously this doesnt display in date format..

Is there anyway around this?

Previously i used a standard html table and parsed the date column with: $.format.date(get('dateTime'), 'dd/MM/yyyy hh:mm:ss' but i seem unable to apply this now,

Any help much appreciated

like image 679
user1694873 Avatar asked Mar 25 '26 09:03

user1694873


1 Answers

All of the core datetime cells will only accept datetime values in ISO-8601 format. Timestamps are not supported. To make the datetime cells to accept UNIX timestamps, you will have to override the formatter.

like image 78
Y.H Wong Avatar answered Mar 28 '26 01:03

Y.H Wong



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!