fix(discord): fix incorrect timezone assumption in Discord embed timestamps#7016
fix(discord): fix incorrect timezone assumption in Discord embed timestamps#7016smayya337 wants to merge 1 commit intolouislam:masterfrom
Conversation
|
Please don't break our application. It won't work on MySQL. Please fix it in discord part, also be careful when you used AI, I am really mad now, because there were a lot of AI slop recently. |
|
Hello and thanks for lending a paw to Uptime Kuma! 🐻👋 |
|
This was not AI -- I wrote this myself without AI assistance. I will resubmit with the change in the Discord section if that is fine with you. |
794be08 to
21e7222
Compare
|
I moved the logic from |
|
Since we are using It may be a reference for you: #6805 |
Summary
In this pull request, the following changes are made:
"Z"is appended toheartbeatJSON["time"]andheartbeatJSON["lastDownTime"]to make it clear that the string is a UTC datetime. Currently, this string is passed intonew Date()for the Discord notification.new Date()'s default behavior is to incorrectly treat the string as being in local time. This results in the Discord embed having incorrect timestamps when the local timezone is not UTC. Appending"Z"to the string causesnew Date()to treat it as a UTC datetime, fixing the incorrect time display.Please follow this checklist to avoid unnecessary back and forth (click to expand)
I understand that I am responsible for and able to explain every line of code I submit.
Screenshots for Visual Changes
Note how the "Went Offline" timestamp compares with the time the message was sent (the two times should match).
Before:

After:
