var moment = require('moment');
console.log(
moment()
);
* _i: undefined, // input
* _f: undefined, // format
* _l: undefined,
* _strict: undefined,
* _isUTC: false,
* _pf:
* { empty: false,
* unusedTokens: [],
* unusedInput: [],
* overflow: -2,
* charsLeftOver: 0,
* nullInput: false,
* invalidMonth: null,
* invalidFormat: false,
* userInvalidated: false,
* iso: false },
* _d: Mon Jul 14 2014 21:32:18 GMT+0800 (CST)
}*/
console.log(
moment('July 14, 2014')
);
console.log(
moment('I\'m not a date string').isValid()
);
console.log(
moment('07-14-2014', 'MM-DD-YYYY')
);
console.log(
moment('07.14.2014', 'MM-DD-YYYY')
);
console.log(
moment('07-14-2014 21:30', 'YYYY-MM-DD HH:mm')
);
console.log(
moment('07-14-2014 21:30 +0000', 'YYYY-MM-DD HH:mm Z')
);
console.log(
moment('15-14-2014', 'MM DD YYYY').isValid()
);
console.log(
moment('06-31-2014', 'MM DD YYYY').isValid()
);
console.log(
moment('Today is 2014-07-14', 'YYYY-MM-DD').isValid()
);
console.log(
moment('Today is 2014-07-14', 'YYYY-MM-DD', true).isValid()
);
console.log(
moment({year: 2014, month: 6, day: 14, hour: 19, minute: 5, second: 4, millisecond: 321}),
moment([2014, 6, 14, 19, 5, 4, 321])
);
var date = new Date(2014, 6, 14, 19, 5, 4, 321);
console.log(
moment(date)
);
console.log(
moment("2014-07-14T21:13:90").invalidAt()
);
moment().second(Number);
moment().second();
moment().seconds(Number);
moment().get('year');
moment().get('month');
moment().get('date');
moment().get('hour');
moment().get('minute');
moment().get('second');
moment().get('millisecond');
moment().set('year', 2014);
moment().set('month', 6);
moment().set('date', 17);
moment().set('hour', 19);
moment().set('minute', 5);
moment().set('second', 4);
moment().set('millisecond', 321);
var a = moment().subtract(1, 'day');
var b = moment().add(1, 'day');
moment.max(a, b);
moment.min(a, b);
moment().add('days', 1).subtract('months', 1).year(2014).hours(19).minutes(5).seconds(5);
moment([2011, 6, 17]).fromNow();
var a = moment([2009, 6, 17]);
var b = moment([2014, 8, 18]);
a.from(b)
a.diff(b)
a.diff(b, 'days')
a.diff(b, 'years', true);
moment('2014-06-17').isSame('2014 06 17');
moment('2014-06-18').isAfter('2014-06-17');
moment([2014]).isLeapYear();
moment.isMoment()
moment.isMoment(new Date())
moment.isMoment(moment())