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

filtering with date on datetime field using le #693

Open
Dushyant7 opened this issue Nov 19, 2018 · 0 comments
Open

filtering with date on datetime field using le #693

Dushyant7 opened this issue Nov 19, 2018 · 0 comments

Comments

@Dushyant7
Copy link

Dushyant7 commented Nov 19, 2018

Name: Flask-Restless
Version: 0.17.0

I am getting wrong results while filtering.

I have model defined like below:

class Session(Base):
    ...
    start_time = Column(DateTime, nullable=False, default=get_current_utc_datetime)
    end_time = Column(DateTime, onupdate=get_current_utc_datetime)
    ...

when I filter using simple date string
api/session?q={"filters":[{"name":"start_time","op":"ge","val":"2018-10-19"},{"name":"end_time","op":"le","val":"2018-11-19"}]}
I get 3 result. It does not include one result which has end_time "2018-11-19".

However when I filter using datetime iso string
api/session?q={"filters":[{"name":"start_time","op":"ge","val":"2018-10-19"},{"name":"end_time","op":"le","val":"2018-11-19T23:59:59.000Z"}]}
It returns 4 result which is correct.

It seems like edge case is not covered here when filtered using date.

Edit:
I also tried
api/session?q={"filters":[{"name":"start_time","op":"ge","val":"2018-10-19"},{"name":"end_time","op":"le","val":"2018-11-20"}]}
It returns 4 results.

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

1 participant