Skip to content

Commit

Permalink
fix(MessageEmbed): createdAt field can be zero (#7218)
Browse files Browse the repository at this point in the history
  • Loading branch information
Raiden-Ei committed Jan 9, 2022
1 parent 4fd127e commit 37cad54
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion packages/discord.js/src/structures/MessageEmbed.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,8 @@ class MessageEmbed {
* @type {?number}
*/
// Date.parse() cannot be used here because data.timestamp might be a number
this.timestamp = 'timestamp' in data ? new Date(data.timestamp).getTime() : null;
// Additionally, the nullish coalescing operator cannot be used here as we're checking for 0
this.timestamp = new Date(data.timestamp).getTime() || null;

/**
* Represents a field of a MessageEmbed
Expand Down

0 comments on commit 37cad54

Please sign in to comment.