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

Unable to filter by schema default ISO dates #394

Closed
abovedave opened this Issue Mar 6, 2018 · 4 comments

Comments

Projects
None yet
3 participants
@abovedave
Copy link
Member

abovedave commented Mar 6, 2018

Expected behavior

Return an appropriate subset of results, when I pass a filter with the date format matching the schema default.

Actual behavior

No results returned.

Steps to reproduce the problem

Example field schema:

Set a date field in the schema:

"date": {
  "type": "DateTime",
  "required": true,
  "label": "Date & Time"
}

Create some test content with varying dates, then attempt to pass a filter e.g.,

{"date":{"$gt":"2016-01-01T00:00:00.000Z"}}

or a range

{"date":{"$gte":"2018-02-04T08:57:23.191Z","$lte":"2018-04-05T07:57:23.193Z"}}

In addition it might be worth setting the default date format in the schema to be "format": "unix" to match the auto-generated fields such a _createdAt

Package details

DADI API 3.x

@abovedave abovedave added the type: bug label Mar 6, 2018

@jimlambie

This comment has been minimized.

Copy link
Member

jimlambie commented Mar 6, 2018

@abovedave please attach a database dump so tests can be built from it

@abovedave

This comment has been minimized.

Copy link
Member Author

abovedave commented Mar 6, 2018

@abovedave

This comment has been minimized.

Copy link
Member Author

abovedave commented Mar 6, 2018

The work around is to set all dates as unix milliseconds, and pass the filter as unix too

date": {
  "type": "DateTime",
  "format": "unix",
  "required": true,
  "label": "Date & Time"
}

@eduardoboucas eduardoboucas self-assigned this Apr 5, 2018

@eduardoboucas

This comment has been minimized.

Copy link
Member

eduardoboucas commented Apr 5, 2018

This has been covered by acceptance tests in 651f9fe#diff-950b9a454b1a9169a2c95dcba4747789R399 and will be out with API 3.1.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment