Bug: moment.js is not working on Retool

I'm unable to run this query, which seems to be something pretty simple and something which used to work before:

return [
  {
    id: '3711affa-7c6f-42ff-936d-af42557789ce',
    created_at: moment(),
  },
  {
    id: '13df8993-7311-4226-94f8-7c1331d91bae',
    created_at: moment(),
  }
]

I am getting this error when I try to run this:


query1 failed (0.001s):Failed to execute 'postMessage' on 'Window': function(e){var t=e%10;return e+(1===ce(e%100/10)?"th":1===t?"st":2===t?"nd":3===t?"rd":"th")} could not be cloned.

Is there a reason to use moment() in particular? The following works:

return [
  {
    id: '3711affa-7c6f-42ff-936d-af42557789ce',
    created_at: new Date(),
  },
  {
    id: '13df8993-7311-4226-94f8-7c1331d91bae',
    created_at: new Date(),
  }
]
1 Like

Returning the moment object directly will throw an error, but adding .format() works :slight_smile:

1 Like

Yes, but imagine that I would like to get the moment.js object itself in a JavaScript object?

It seems any attempt to use a moment object in an return array is throwing the same error: