From 8225ea51278a925dd577deb6a7900b727fcb5b2a Mon Sep 17 00:00:00 2001 From: Heartz66 <8833887+Heartz66@users.noreply.github.com> Date: Wed, 6 Nov 2019 19:43:45 +0100 Subject: [PATCH] Fix wrong date https://github.com/DoctorMcKay/node-steamcommunity/issues/236 --- classes/CSteamUser.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/classes/CSteamUser.js b/classes/CSteamUser.js index a412eb0..850d164 100644 --- a/classes/CSteamUser.js +++ b/classes/CSteamUser.js @@ -69,7 +69,13 @@ function CSteamUser(community, userData, customurl) { this.customURL = processItem('customURL', customurl); if(this.visibilityState == 3) { - this.memberSince = new Date(processItem('memberSince', '0').replace(/(\d{1,2})(st|nd|th)/, "$1")); + let memberSinceValue = processItem('memberSince', '0').replace(/(\d{1,2})(st|nd|th)/, "$1"); + + if (memberSinceValue.indexOf(',') === -1) { + memberSinceValue += ', ' + new Date().getFullYear(); + } + + this.memberSince = new Date(memberSinceValue); this.location = processItem('location'); this.realName = processItem('realname'); this.summary = processItem('summary');