oroinc / platform

Main OroPlatform package with core functionality.
Other
627 stars 351 forks source link

Filter type date in datagrid is displaying the wrong date when it reloads #1017

Open successmarket opened 4 years ago

successmarket commented 4 years ago

Summary
If you use a filter of type: date (not datetime) in a datagrid, you will see that when the date is sent, you use "date 00:00:00" in the query. That's kind of ok. The issue is that when you display the filter widget back to the user, you are using the localized version of the date. In my case, EST (-4). So when the date is displayed back to me, it is 1 day back of what I actually selected. Also, because the date adds the time, there is no way to use the "is equal to" filter because it needs to be specifically at midnight.

Steps to reproduce
You can easily reproduce this by changing the filter type to "date" for the dateTime filter in the calls datagrid: oro\crm-call-bundle\Resources\config\oro\datagrids.yml

Actual Result The day selected with the timezone applied on a 00:00:00 time,

Expected Result
The day I selected.

Also, to get proper results on "is equal to", the date() function could be applied on the database fields when the date filter is used.

Details about your environment