mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-06 06:10:49 +02:00
Support Years from 1 - 99
This commit is contained in:
@@ -22,7 +22,7 @@ module.exports = class CalendarCommand extends Command {
|
||||
key: 'year',
|
||||
prompt: 'What year would you like to get the calendar of?',
|
||||
type: 'integer',
|
||||
min: 100
|
||||
min: 1
|
||||
}
|
||||
]
|
||||
});
|
||||
@@ -37,6 +37,7 @@ module.exports = class CalendarCommand extends Command {
|
||||
`;
|
||||
display += '\n';
|
||||
const startDay = new Date(year, month - 1, 1).getDay();
|
||||
if (year > 100) startDay.setFullYear(year);
|
||||
for (let i = 0; i < startDay; i++) {
|
||||
display += ' ';
|
||||
}
|
||||
|
||||
@@ -26,7 +26,7 @@ module.exports = class DaysSinceCommand extends Command {
|
||||
key: 'year',
|
||||
prompt: 'What year would you like to get the days since?',
|
||||
type: 'integer',
|
||||
min: 100
|
||||
min: 1
|
||||
}
|
||||
]
|
||||
});
|
||||
@@ -35,6 +35,7 @@ module.exports = class DaysSinceCommand extends Command {
|
||||
run(msg, { month, day, year }) {
|
||||
const now = new Date();
|
||||
const past = new Date(year, month - 1, day);
|
||||
if (year > 100) past.setFullYear(year);
|
||||
const pastFormat = moment.utc(past).format('dddd, MMMM Do, YYYY');
|
||||
const time = moment.duration(now - past);
|
||||
return msg.say(`There have been ${time.format('Y [years,] M [months and] d [days]')} since ${pastFormat}!`);
|
||||
|
||||
Reference in New Issue
Block a user