mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-06-01 03:20:46 +08:00
Modified test
This commit is contained in:
@@ -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'
|
||||
|
||||
Reference in New Issue
Block a user