Skip to content

fix timezone offset issue in custom rpc timestamp picker#480

Open
rootdevss wants to merge 1 commit intodead8309:masterfrom
rootdevss:fix-timestamp-timezone-offset
Open

fix timezone offset issue in custom rpc timestamp picker#480
rootdevss wants to merge 1 commit intodead8309:masterfrom
rootdevss:fix-timestamp-timezone-offset

Conversation

@rootdevss
Copy link

hey, i noticed theres an issue with the custom rpc timestamp picker where selecting the current date causes discord to show "playing for 24 hours" instead of the correct time, to get the right timestamp users have to select the next day which is obviously not ideal

i looked into the code and found that the problem is in the getDateTimeInMillis function in DateTimePicker.kt, the datepicker returns timestamps in utc at midnight but when calendar.getinstance processes this value with the local timezone it shifts the date by one day for users in negative utc offsets like gmt-3

this pr changes the function to properly extract the date components from the utc timestamp and then create a new calendar instance in the local timezone with those values plus the user selected time, this should prevent the date shifting issue

i havent tested this myself since i dont have a test environment set up right now but the logic should fix the timezone conversion problem, would appreciate if you could review this and test it out.

thanks.

@rootdevss
Copy link
Author

@dead8309 could you review this when you get a chance?

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Fixes a timezone-related date shift when converting the Material3 DatePicker selection into an epoch timestamp for Custom RPC timestamps, preventing “playing for 24 hours” caused by selecting the “current” day in negative UTC offsets.

Changes:

  • Interpret selectedDateMillis using a UTC Calendar to extract stable Y/M/D components.
  • Construct a new local-time Calendar using those UTC-derived date components plus the user-selected time.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

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

Successfully merging this pull request may close these issues.

1 participant

Comments