From 10d2988985c6936fe5027bf30ab1a2195756478a Mon Sep 17 00:00:00 2001 From: andrewchae Date: Mon, 9 May 2016 10:45:57 -0700 Subject: [PATCH] Pass dates to cloud code functions (#655) (#1697) --- src/Routers/FunctionsRouter.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/Routers/FunctionsRouter.js b/src/Routers/FunctionsRouter.js index b405b90eb5..3b2c740a24 100644 --- a/src/Routers/FunctionsRouter.js +++ b/src/Routers/FunctionsRouter.js @@ -33,6 +33,14 @@ export class FunctionsRouter extends PromiseRouter { var theValidator = triggers.getValidator(req.params.functionName, applicationId); if (theFunction) { const params = Object.assign({}, req.body, req.query); + for (var key in params) { + if (params.hasOwnProperty(key)) { + var value = params[key]; + if (value.__type == 'Date') { + params[key] = new Date(value.iso); + } + } + } var request = { params: params, master: req.auth && req.auth.isMaster,