Fix time trimming

This commit is contained in:
Daniel Odendahl Jr
2018-09-20 20:21:05 +00:00
parent 46803dfb98
commit 325615fe7d
4 changed files with 7 additions and 6 deletions
+4 -3
View File
@@ -31,8 +31,9 @@ module.exports = class DaysUntilCommand extends Command {
let year = now.getMonth() + 1 <= month ? now.getFullYear() : now.getFullYear() + 1;
if (month === now.getMonth() + 1 && now.getDate() >= day) ++year;
const future = new Date(`${month}/${day}/${year}`);
const time = moment.duration(future - now).format('M [months and] d [days]');
if (time === 'Invalid date') return msg.reply('Invalid date.');
return msg.say(`There are ${time} until ${moment.utc(future).format('dddd, MMMM Do, YYYY')}!`);
const futureFormat = moment.utc(future).format('dddd, MMMM Do, YYYY');
const time = moment.duration(future - now);
const link = time.months() === 1 ? 'is' : 'are';
return msg.say(`There ${link} ${time.format('M [months and] d [days]')} until ${futureFormat}!`);
}
};
+1 -1
View File
@@ -33,7 +33,7 @@ module.exports = class NekoAtsumePasswordCommand extends Command {
const data = await this.fetchPassword(locale);
return msg.say(stripIndents`
The current Neko Atsume password is **${data.password}**.
It will expire in **${moment.duration(data.expires - data.date).format('hh:mm:ss')}**.
It will expire in **${moment.duration(data.expires - data.date).format('hh:mm:ss', { trim: false })}**.
${data.gold} ${this.goldFish} ${data.silver} ${this.silverFish}
`);
+1 -1
View File
@@ -30,7 +30,7 @@ module.exports = class InfoCommand extends Command {
.addField(' Source Code',
source ? `[Here](https://github.com/${XIAO_GITHUB_REPO_USERNAME}/${XIAO_GITHUB_REPO_NAME})` : 'N/A', true)
.addField(' Memory Usage', `${Math.round(process.memoryUsage().heapUsed / 1024 / 1024)}MB`, true)
.addField(' Uptime', moment.duration(this.client.uptime).format('hh:mm:ss'), true)
.addField(' Uptime', moment.duration(this.client.uptime).format('hh:mm:ss', { trim: false }), true)
.addField(' Version', `v${version}`, true)
.addField(' Node Version', process.version, true)
.addField(' Dependencies', this.parseDependencies());
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "xiao",
"version": "91.8.9",
"version": "91.8.10",
"description": "Your personal server companion.",
"main": "Xiao.js",
"scripts": {