mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-18 04:23:31 +01:00
fix: Prevent NaN for nullable timestamps (#7750)
* fix(VoiceState): don't show `NaN` * fix(Invite): handle NaN * refactor: `&&` usage Co-authored-by: Almeida <almeidx@pm.me> Co-authored-by: Almeida <almeidx@pm.me>
This commit is contained in:
@@ -188,8 +188,11 @@ class Invite extends Base {
|
|||||||
this.createdTimestamp ??= null;
|
this.createdTimestamp ??= null;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ('expires_at' in data) this._expiresTimestamp = Date.parse(data.expires_at);
|
if ('expires_at' in data) {
|
||||||
else this._expiresTimestamp ??= null;
|
this._expiresTimestamp = data.expires_at && Date.parse(data.expires_at);
|
||||||
|
} else {
|
||||||
|
this._expiresTimestamp ??= null;
|
||||||
|
}
|
||||||
|
|
||||||
if ('stage_instance' in data) {
|
if ('stage_instance' in data) {
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -121,7 +121,7 @@ class VoiceState extends Base {
|
|||||||
* The time at which the member requested to speak. This property is specific to stage channels only.
|
* The time at which the member requested to speak. This property is specific to stage channels only.
|
||||||
* @type {?number}
|
* @type {?number}
|
||||||
*/
|
*/
|
||||||
this.requestToSpeakTimestamp = Date.parse(data.request_to_speak_timestamp);
|
this.requestToSpeakTimestamp = data.request_to_speak_timestamp && Date.parse(data.request_to_speak_timestamp);
|
||||||
} else {
|
} else {
|
||||||
this.requestToSpeakTimestamp ??= null;
|
this.requestToSpeakTimestamp ??= null;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user