momentjs - Moment throwing TypeError string.indexOf when using Backgrid -


i using backgrid display json results backend db. 1 of fields time in seconds 1970 (eg. 1362578461000) when backbone view receives data backgrid sends off moment formating. moment throws javascript typeerror exception indicated on line 758 of moment.js (v.2.0.0)

typeerror: string.indexof not function

the column format looks this:

            var columns = [{             name: "starttime",             label: "start time",             editable: false,             cell: "moment"         }, {             name: "endtime",             label: "end time",             editable: false,             cell: "moment"         }]; 

putting brakepoint in firebug looks moment thinks value integer rather string.

utc()moment.js (line 960)

input = 1362578461000

format = "yyyy-mm-ddthh:mm:ssz"

lang = undefined

and call makedatefromstringandformat looks this:

makedatefromstringandformat()moment.js (line 758) config = object { _useutc=true, _isutc=true, _i=1362578461000, more...}

any ideas can fix/get around this?

thanks

author of backgrid here. there 2 parts question:

  1. backgrid.js has gained compatibility moment.js 2.0.0 in 0.2.5 released yesterday.
  2. the moment cell doesn't accept integers input in model because tries convert timezones , locales, model values have in datetime string format moment knows how parse.

Comments

Popular posts from this blog

node.js - Bad Request - node js ajax post -

Why does Ruby on Rails generate add a blank line to the end of a file? -

keyboard - Smiles and long press feature in Android -