Discord Timestamp with Seconds

This script provides users with the capability to view seconds in the timestamps of Discord messages, allows users to view the time that has elapsed since a message was sent, and enhances the date formatting.

< 脚本 Discord Timestamp with Seconds 的反馈

评价:一般 - 脚本能用,但还有一些问题

§
发布于:2025-10-07

Hello,

The script stopped working for me and when I consulted ChatGPT it said the following (I tried the fix and it worked):
As of the last few days (around early October 2025), Discord has changed the HTML structure of time elements in chat.

Discord no longer uses aria-label to display the time — they replaced it with a data-tooltip or a completely new internal React component.

As a result:

timeElement.getAttribute('aria-label') returns null;

then the code tries to call originalLabel.includes(...), which shows an error in the console and breaks the entire updateTimestamps() function.

👉 The DOM structure has changed, and the script no longer finds the data it needs.

✅ Quick fix

You can edit your script and replace all places where aria-label is used with the following safe option:

🔧 Change this (old):
const originalLabel = timeElement.getAttribute('aria-label');

🆕 With this (new):
const originalLabel = timeElement.getAttribute('aria-label')
|| timeElement.getAttribute('data-tooltip')
|| timeElement.textContent;

发布留言

登录以发布留言。