Skip to content

fix(discord): fix incorrect timezone assumption in Discord embed timestamps#7016

Draft
smayya337 wants to merge 1 commit intolouislam:masterfrom
smayya337:discord-timestamp-embed-fix
Draft

fix(discord): fix incorrect timezone assumption in Discord embed timestamps#7016
smayya337 wants to merge 1 commit intolouislam:masterfrom
smayya337:discord-timestamp-embed-fix

Conversation

@smayya337
Copy link

@smayya337 smayya337 commented Feb 21, 2026

Summary

In this pull request, the following changes are made:

  • The string "Z" is appended to heartbeatJSON["time"] and heartbeatJSON["lastDownTime"] to make it clear that the string is a UTC datetime. Currently, this string is passed into new 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 causes new 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)
  • ⚠️ If there are Breaking change (a fix or feature that alters existing functionality in a way that could cause issues) I have called them out
  • 🧠 I have disclosed any use of LLMs/AI in this contribution and reviewed all generated content.
    I understand that I am responsible for and able to explain every line of code I submit.
  • 🔍 Any UI changes adhere to visual style of this project.
  • 🛠️ I have self-reviewed and self-tested my code to ensure it works as expected.
  • 📝 I have commented my code, especially in hard-to-understand areas (e.g., using JSDoc for methods).
  • 🤖 I added or updated automated tests where appropriate.
  • 📄 Documentation updates are included (if applicable).
  • 🧰 Dependency updates are listed and explained.
  • ⚠️ CI passes and is green.

Screenshots for Visual Changes

Note how the "Went Offline" timestamp compares with the time the message was sent (the two times should match).

Before:
image

After:
image

@louislam
Copy link
Owner

louislam commented Feb 21, 2026

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.

@louislam louislam closed this Feb 21, 2026
@github-actions
Copy link
Contributor

Hello and thanks for lending a paw to Uptime Kuma! 🐻👋
As this is your first contribution, please be sure to check out our Pull Request guidelines.
In particular: - Mark your PR as Draft while you’re still making changes - Mark it as Ready for review once it’s fully ready
If you have any design or process questions, feel free to ask them right here in this pull request - unclear documentation is a bug too.

@smayya337
Copy link
Author

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.

@louislam
Copy link
Owner

louislam commented Feb 21, 2026

Sorry about that. I am being too sensitive to AI now, because they keep wasting my time.

Anyway, as I remember, it was fixed previously by another contributor, I think #6745 added this bug again? Not quite sure. But #6745 should point you to where you should look into.

@louislam louislam reopened this Feb 21, 2026
@smayya337 smayya337 force-pushed the discord-timestamp-embed-fix branch from 794be08 to 21e7222 Compare February 21, 2026 20:24
@smayya337
Copy link
Author

I moved the logic from heartbeatJSON creation to the Discord notification provider class based on the PR you linked.

@louislam
Copy link
Owner

Since we are using dayjs to parse/convert date/time in this project, we would like to standardize it.
Also don't forget to press "Ready for review" when it is ready to review. Thanks.

It may be a reference for you: #6805

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.

2 participants