humps icon indicating copy to clipboard operation
humps copied to clipboard

invalid moment object when converting string to moment inside camelizeKeys

Open pirey opened this issue 5 years ago • 1 comments

when i try to camelize my object, i want to convert one of the field (string) into moment object, like this

  const p = camelizeKeys({
    ...myobject,
   timestamp: moment(purchase.timestamp),
  });

the camelization is ok, no error. the thing is, moment object suppose to have .format function defined on the object. but when i try to access it from p.timestamp.format it said that format is undefined.

what is the cause of that? how to do it 'properly' ?

pirey avatar Oct 22 '18 11:10 pirey