diff --git a/types/moment-shortformat/moment-shortformat-tests.ts b/types/moment-shortformat/moment-shortformat-tests.ts index a0050348f7..84f754a750 100644 --- a/types/moment-shortformat/moment-shortformat-tests.ts +++ b/types/moment-shortformat/moment-shortformat-tests.ts @@ -1,20 +1,20 @@ import moment = require('moment'); -import momentShortformat = require('moment-shortformat'); - -moment === momentShortformat; // true +import 'moment-shortformat'; +let formatted: string; /*~ Formats time relative to current time. */ -moment(moment().valueOf() + (36e5 * 5)).short(); // in 5h -moment(moment().valueOf() - (36e5 * 5)).short(); // 5h ago -moment(moment().valueOf() + (36e5 * 5)).short(true); // 5h -moment(moment().valueOf() - (36e5 * 5)).short(true); // 5h +formatted = moment(moment().valueOf() + (36e5 * 5)).short(); // 'in 5h' +formatted = moment(moment().valueOf() - (36e5 * 5)).short(); // '5h ago' +formatted = moment(moment().valueOf() + (36e5 * 5)).short(true); // '5h' +formatted = moment(moment().valueOf() - (36e5 * 5)).short(true); // '5h' /*~ Times greater than 1 week are converted to dates like Mar 7, *~ or if the year of the date does not match the current year *~ it is convert to Mar 7, 2031 */ -moment(moment().valueOf() + 6048e5).short(); // Mar 7 +formatted = moment(moment().valueOf() + 6048e5).short(); // 'Mar 7' /*~ Using a different "now" */ -moment(moment().valueOf() + (36e5 * 5)) - .short(false, moment(moment().valueOf() + (36e5 * 3))); // in 2h +formatted = moment(moment().valueOf() + (36e5 * 5)).short( + false, moment(moment().valueOf() + (36e5 * 3)) +); // 'in 2h'