Skip to content

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

@codebreach

Description

@codebreach

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions