From 684617f4c688b5131fa804a0ebb1bc9994e9f2fc Mon Sep 17 00:00:00 2001 From: Andrew Chae Date: Tue, 3 May 2016 13:03:16 -0700 Subject: [PATCH] Pass dates to cloud code functions (#655) --- 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,