Correctly highlight selected day in date picker. (5.1
)
#17121
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Please note, this PR is a backport of #16973 for
5.1
.Description
Motivation and Context
As described in #16096 the highlight for the selected date in the date picker can be wrong for a date time like
2023-10-17 00:00:00
. In this case it displayed the previous day as active.The reason is that the date time does not contain a time zone information and
moment()
still uses the estimated user time zone internally. For example when your browser timezone isEurope/Paris
the UTC time for2023-10-17 00:00:00
is2023-10-16 22:00:00
.We are now:
moment.utc()
instead ofmoment()
to make it's behaviour predictable for date times without a time zone.This only effects few cases, because usually timestamps in the frontend have a timezone.
There are more improvements we can make regarding the date time utils, but I will do them in a follow-up PR, so this PR will be easy to backport.
Fixes: #16096
Fixes: https://github.com/Graylog2/graylog-plugin-enterprise/issues/5998