`ButtonInteraction.createdTimestamp` is ahead of fetched epoch from `Date.now()`?!

Alright so, I've encountered a confusing error related to this. Think of the following:
const Reply = await Interaction.reply({
components: [...],
embeds: [...],
fetchReply: true,
});

Reply.awaitMessageComponent(...)
.then(async (ButtonInteract) => {
await ButtonInteract.deferUpdate();
console.log("Sub:", Date.now() - ButtonInteract.createdTimestamp);
});
const Reply = await Interaction.reply({
components: [...],
embeds: [...],
fetchReply: true,
});

Reply.awaitMessageComponent(...)
.then(async (ButtonInteract) => {
await ButtonInteract.deferUpdate();
console.log("Sub:", Date.now() - ButtonInteract.createdTimestamp);
});
I'm getting a negative number every time I try it. No idea why is this happening. Shouldn't Date.now() be a higher value than ButtonInteract.createdTimestamp or I'm missing something? Node 21.0.0
4 Replies
d.js toolkit
d.js toolkit7mo ago
- What's your exact discord.js npm list discord.js and node node -v version? - Not a discord.js issue? Check out #other-js-ts. - Consider reading #how-to-get-help to improve your question! - Explain what exactly your issue is. - Post the full error stack trace, not just the top part! - Show your code! - Issue solved? Press the button! - Marked as resolved by OP
treble/luna
treble/luna7mo ago
Date.now depends on your system time So if your system is running behind, so is Date.now
Egiziano
Egiziano7mo ago
What is a workaround?
treble/luna
treble/luna7mo ago
Sync your system time, not a djs issue