Skip to content

Commit

Permalink
Pass dates to cloud code functions (#655) (#1697)
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewchae authored and drew-gross committed May 9, 2016
1 parent 37c502b commit 10d2988
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/Routers/FunctionsRouter.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

3 comments on commit 10d2988

@ideastouch
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi, this fix is great.
Could be added another fix in cases that the value of params is a list of Dates. In Parse.com server works but parse.server is not.
Thank you,
Gus.

@drew-gross
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You you open a new issue with some code that demonstrates the issue please?

@ideastouch
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done. The new issue is #1826.

Txs,
Gus

Please sign in to comment.