Fixed NaN date

This commit is contained in:
2022-06-29 21:00:58 +07:00
parent 081d766686
commit c3bf7891e9
+12 -2
View File
@@ -106,14 +106,24 @@ const EMBEDS = {
title = `📺 ${locale.__('userinfo.watching_x', { NAME: activity.name })}`; title = `📺 ${locale.__('userinfo.watching_x', { NAME: activity.name })}`;
break; break;
case ActivityType.Competing: case ActivityType.Competing:
title = `'🌠 ${locale.__('userinfo.competing_x', { NAME: activity.name })}`; title = `🌠 ${locale.__('userinfo.competing_x', { NAME: activity.name })}`;
break; break;
} }
const startTime = activity.timestamps?.start;
const endTime = activity.timestamps?.end;
embed.addFields({ embed.addFields({
name: `${title}`, name: `${title}`,
value: `${activity.details === null ? '' : activity.details} value: `${activity.details === null ? '' : activity.details}
${activity.state === null ? '' : activity.state} ${activity.state === null ? '' : activity.state}
Since <t:${Math.round(new Date(activity.createdAt).getTime() / 1000)}:R> ${
startTime
? `Since <t:${Math.round(startTime.getTime() / 1000)}:R>`
: ''
}${
endTime
? `\nEnd <t:${Math.round(endTime.getTime() / 1000)}:R>`
: ''
}
\u200b`, \u200b`,
inline: false inline: false
}); });