Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[FIX] web: search input date in another timezone
Put the browser in timezone Sao Paulo (Or like West of UTC) Trigger the autocomplete (and the subsequent search) on a date field by writing a date (in the locale format) in the search view Before this commit, the domain sent to the server contained the date as the day **before** the one asked for in the input This is because, the string input is parsed and gives: input = 12/02/2018 When creating the moment object: > since there is no explicit time, moment will interpret it as 12am (midnight) > We force moment to consider the string as being UTC (function: moment.utc()) > the moment contains, as output the time ** 2018-02-12T00:00:00 UTC ** When getting the facet value for making the domain > we call toDate on the moment object, which, according to the browser is UTC and will be converted to the locale timezone before formatting > And the domain will use the date 2018-02-11T22:00:00 Brazil/SaoPaulo which gives the day before the one we asked for After this commit, this issue doesn't arise, because we don't convert the moment into a Date, and we directly format that moment into a string OPW 1903224 closes #28689
- Loading branch information
1 parent
8ccc976
commit 4626817
Showing
2 changed files
with
93 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters