Skip to content

Query on a subfield date on an array with js native date object does not work #8001

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

Open
4 tasks done
Olzindel opened this issue May 16, 2022 · 3 comments
Open
4 tasks done
Labels
type:bug Impaired feature or lacking behavior that is likely assumed

Comments

@Olzindel
Copy link

New Issue Checklist

Issue Description

PArse.Query on a subfield date on an array with js native date object does not work

Steps to reproduce

quick example:

const obj = new Parse.Object('Example')
obj.set('anArrayField', [{ date: new Date(0) }])
await obj.save()

// Elsewhere later
const query = new Parse.Query('Example')
query.lessThan('anArrayField.date', new Date())

const result = query.find()
// Result is empty but it should contain obj 

Actual Outcome

Empty result, maybe related to incorrect handling of native JS date

Expected Outcome

Query a subfield date on an array with js native date object should work

Environment

Version 5.2.1

Server

  • Parse Server version: 5.2.1
  • Operating system: OsX
  • Local or remote host (AWS, Azure, Google Cloud, Heroku, Digital Ocean, etc): local

Database

  • System (MongoDB or Postgres): MongoDB
  • Database version: 4.4.2
  • Local or remote host (MongoDB Atlas, mLab, AWS, Azure, Google Cloud, etc): local

Client

  • SDK (iOS, Android, JavaScript, PHP, Unity, etc): JavaScript
  • SDK version: 3.4.2
@parse-github-assistant
Copy link

Thanks for opening this issue!

  • 🚀 You can help us to fix this issue faster by opening a pull request with a failing test. See our Contribution Guide for how to make a pull request, or read our New Contributor's Guide if this is your first time contributing.

@hariprasadiit
Copy link

possible duplicate of #7575

@mtrezza mtrezza added the type:bug Impaired feature or lacking behavior that is likely assumed label May 17, 2022
@cbaker6
Copy link
Contributor

cbaker6 commented May 21, 2022

Currently, this is suppose to be handled by the Client SDK's (in you case the JS SDK) as the SDK's should ensure the Date is encoded in a way the Parse Server understands. For example:

The same goes for decoding dates from the Parse Server.

If someone provides a PR to the server to address this, they should ensure the current way and new way both work in order to not break the Client SDKs that handle this properly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type:bug Impaired feature or lacking behavior that is likely assumed
Projects
None yet
Development

No branches or pull requests

4 participants