Skip to content

Commit fb2b728

Browse files
JiraliteTAEMBO
andcommitted
fix(GuildMember): joinedAt possibly being NaN
Co-Authored-By: TÆMBØØ <[email protected]>
1 parent c303bf3 commit fb2b728

File tree

1 file changed

+11
-7
lines changed

1 file changed

+11
-7
lines changed

packages/discord.js/src/structures/GuildMember.js

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,6 @@ class GuildMember extends Base {
2424
*/
2525
this.guild = guild;
2626

27-
/**
28-
* The timestamp the member joined the guild at
29-
* @type {?number}
30-
*/
31-
this.joinedTimestamp = null;
32-
3327
/**
3428
* The last timestamp this member started boosting the guild
3529
* @type {?number}
@@ -95,7 +89,17 @@ class GuildMember extends Base {
9589
this.banner ??= null;
9690
}
9791

98-
if ('joined_at' in data) this.joinedTimestamp = Date.parse(data.joined_at);
92+
if ('joined_at' in data) {
93+
/**
94+
* The timestamp the member joined the guild at
95+
*
96+
* @type {?number}
97+
*/
98+
this.joinedTimestamp = data.joined_at && Date.parse(data.joined_at);
99+
} else {
100+
this.joinedTimestamp ??= null;
101+
}
102+
99103
if ('premium_since' in data) {
100104
this.premiumSinceTimestamp = data.premium_since ? Date.parse(data.premium_since) : null;
101105
}

0 commit comments

Comments
 (0)