Format dates with moment

This commit is contained in:
Daniel Odendahl Jr
2018-09-20 16:38:05 +00:00
parent 553abdb6fa
commit 42bd597db7
26 changed files with 81 additions and 51 deletions
+4 -2
View File
@@ -1,4 +1,5 @@
const Command = require('../../structures/Command');
const moment = require('moment');
const { MessageEmbed } = require('discord.js');
const request = require('node-superfetch');
const { STACKOVERFLOW_KEY } = process.env;
@@ -47,8 +48,9 @@ module.exports = class StackOverflowCommand extends Command {
.addField(' Asker', `[${data.owner.display_name}](${data.owner.link})`, true)
.addField(' Views', data.view_count, true)
.addField(' Score', data.score, true)
.addField(' Creation Date', new Date(data.creation_date * 1000).toDateString(), true)
.addField(' Last Activity', new Date(data.last_activity_date * 1000).toDateString(), true);
.addField(' Creation Date', moment.utc(data.creation_date * 1000).format('MMM Do, YYYY [at] hh:mm:ss A'), true)
.addField(' Last Activity',
moment.utc(data.last_activity_date * 1000).format('MMM Do, YYYY [at] hh:mm:ss A'), true);
return msg.embed(embed);
} catch (err) {
return msg.reply(`Oh no, an error occurred: \`${err.message}\`. Try again later!`);