Search code examples
parse-platformmomentjsparse-server

How to use momentjs to find number of days between ParseServer object updatedAt


How to find the number of days difference between today and Parse Server Object column updatedAt using momentjs. Not sure whats the exact format of updatedAt column.


Solution

  • If you have a JSON representation of your ParseObject, you can create a moment object from the "iso" property.

    const obj = yourParseObject.toJSON()
    const momentDate = moment(obj.updatedAt.iso).fromNow()