firebase-functions icon indicating copy to clipboard operation
firebase-functions copied to clipboard

Encode Date object in return value of onCall functions

Open takaaa220 opened this issue 3 years ago • 0 comments

Description

refs: https://github.com/firebase/firebase-functions/issues/988

Encode a Date object in return value of onCall functions to ISO formatted date string.

Code sample

onCall(() => { 
  return { d: new Date() }
})

The execution result of the above code changes as follows,

Before behavior:

{
  "result": {
    "d": {}
  }
}

After behavior:

{
  "result": {
    "d": "2021-10-12T13:11:44.977Z"
  }
}

takaaa220 avatar Feb 04 '22 01:02 takaaa220