fix(MessageEmbed): createdAt field can be zero (#7218)

This commit is contained in:
Raiden-Ei
2022-01-09 21:20:07 +09:00
committed by GitHub
parent 4fd127e79e
commit 37cad54dbd

View File

@@ -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