Skip to content

Give dates to a Cloud Code functions is different on parse-server than Parse.com #655

Closed
@Kira2

Description

@Kira2

Hi,

The way that the date parameters are given to a Cloud Code function seems different on parse-server and Parse.com. This is how to reproduce it.

Create a Cloud Code function like this:

/**
 * @description Just displays the given date parameter
 */
Parse.Cloud.define("myFunction", function(request, response) {
  console.log(request.params.date);
  response.success();
});

When I call this function through the REST API on Parse.com, the date parameter must have this format {__type: "Date", iso: "2016-02-25T00:00:00.000Z"}. Then, the console displays 2016-02-25T00:00:00.000Z probably because there is a mechanism to deserialize it before calling the function.

The same call with the same parameter on parse-server will make the console display {__type: "Date", iso: "2016-02-25T00:00:00.000Z"}.

So, to be able to continue to use my Cloud Code functions with parse-server, it seems now that I have to directly use 2016-02-25T00:00:00.000Z as a date parameter, instead of {__type: "Date", iso: "2016-02-25T00:00:00.000Z"}. Is this difference normal?

Thanks.

Metadata

Metadata

Assignees

Labels

type:questionSupport or code-level question

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions