Skip to content

Conversation

@graylog-internal-actions-access
Copy link

@graylog-internal-actions-access graylog-internal-actions-access bot commented Oct 21, 2025

Note: This is a backport of #23918 to 6.2.

Description

Motivation and Context

As described in #22273 the active month in date time pickers can be wrong. This can happen for dates like 2025-10-01 when the browser time zone is UTC - X.

This PR fixes the problem by using moment to provide a JavaScript date in the correct format.

The date time picker only gets dates in the following format 2025-10-01.toDateObject('2025-10-01').toDate() and new Date('2025-10-01'), treat this as UTC midnight. With a timezone like America/Los_Angeles (UTC-7), this generates the following JavaScript date Tue Sep 30 2025 17:00:00 GMT-0700 (Pacific Daylight Time).

By using moment(selectedDate, 'YYYY-MM-DD').toDate() it generates a JavaScript Date Oct 01 2025 00:00:00 GMT-0700 (Pacific Daylight Time), which has the same day and month like the provided date 2025-10-01.

Ideally we avoid using moment directly, but in this case it makes it easy to backport the fix. In future versions we can avoid this by upgrading the react-day-picker #23857. The newer versions have improved time zone support.

Fixes #22273

…#23918)

* Fix time zone issue when displaying active month in date time picker.

* Use correct moment import.

* Adding changelog

(cherry picked from commit 01283e9)
@linuspahl linuspahl merged commit e40226f into 6.2 Nov 4, 2025
15 of 16 checks passed
@linuspahl linuspahl deleted the backport-6.2/issue-22273 branch November 4, 2025 15:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants