Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Date objects in cloud functions are not same as hosted parse #2214

Closed
codebreach opened this issue Jul 6, 2016 · 4 comments
Closed

Date objects in cloud functions are not same as hosted parse #2214

codebreach opened this issue Jul 6, 2016 · 4 comments

Comments

@codebreach
Copy link
Contributor

I am calling a cloud function with parameters {date: new Date()}.

This is sent over the wire as:

{
  date: {
    __type: 'Date',
    iso: '1997-07-16T19:20:30+01:00'
  }
}

In the hosted parse function, the date object is untouched

Parse.Cloud.define('dateF', (request, response) => {
  console.log(request.params.date.iso);
  // Prints ISO date string
});

In parse-server the date object gets flattned to just the date string:

Parse.Cloud.define('dateF', (request, response) => {
  console.log(request.params.date);
  // Prints ISO date string
  // Date is now a string not an object
  console.log(request.params.date.iso);
  // ^ does not work
});

Environment Setup

  • Server
    • parse-server version: 2.2.15
    • Operating System: Mac OS X
    • Hardware: MBP
    • Localhost or remote server? Localhost
  • Database
    • MongoDB version: 3.2.1
    • Storage engine: Default
    • Hardware: MBP
    • Localhost or remote server? Localhost
@codebreach
Copy link
Contributor Author

Test failure:
drinklynk@b0d61f9

@flovilmart
Copy link
Contributor

This seems to be related / opposite of #1826

@drew-gross where should we go from here?

@drew-gross
Copy link
Contributor

I think we should always be matching Parse.com behaviour, even if that behaviour is weird.

@flovilmart
Copy link
Contributor

I'll add it to #2297

drew-gross pushed a commit that referenced this issue Jul 19, 2016
…ons (#2297)

* fix for #2294

* fail tests

* Makes sure dates are compatible with Parse.com CloudCode #2214

* Adds regression tests for #2204
rsouzas pushed a commit to back4app/parse-server that referenced this issue Mar 15, 2017
…ons (parse-community#2297)

* fix for parse-community#2294

* fail tests

* Makes sure dates are compatible with Parse.com CloudCode parse-community#2214

* Adds regression tests for parse-community#2204
rsouzas pushed a commit to back4app/parse-server that referenced this issue Mar 16, 2017
…ons (parse-community#2297)

* fix for parse-community#2294

* fail tests

* Makes sure dates are compatible with Parse.com CloudCode parse-community#2214

* Adds regression tests for parse-community#2204
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants