Modified test

This commit is contained in:
whatasoda
2018-06-13 00:27:31 +09:00
parent 1d2f4b6585
commit 9fc95b02e1

View File

@@ -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'