Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Handle nullable timestamps (v13) #7778

Merged
merged 1 commit into from Apr 14, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 5 additions & 2 deletions src/structures/Invite.js
Expand Up @@ -197,8 +197,11 @@ class Invite extends Base {
this.createdTimestamp ??= null;
}

if ('expires_at' in data) this._expiresTimestamp = new Date(data.expires_at).getTime();
else this._expiresTimestamp ??= null;
if ('expires_at' in data) {
this._expiresTimestamp = data.expires_at && Date.parse(data.expires_at);
} else {
this._expiresTimestamp ??= null;
}

if ('stage_instance' in data) {
/**
Expand Down
2 changes: 1 addition & 1 deletion src/structures/VoiceState.js
Expand Up @@ -118,7 +118,7 @@ class VoiceState extends Base {
* The time at which the member requested to speak. This property is specific to stage channels only.
* @type {?number}
*/
this.requestToSpeakTimestamp = new Date(data.request_to_speak_timestamp).getTime();
this.requestToSpeakTimestamp = data.request_to_speak_timestamp && Date.parse(data.request_to_speak_timestamp);
} else {
this.requestToSpeakTimestamp ??= null;
}
Expand Down