本文整理汇总了TypeScript中moment.default方法的典型用法代码示例。如果您正苦于以下问题:TypeScript moment.default方法的具体用法?TypeScript moment.default怎么用?TypeScript moment.default使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类moment
的用法示例。
在下文中一共展示了moment.default方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: dayShort
function dayShort(offset) {
return moment().locale('fi').add(offset, 'days').format('dddd')
.toLowerCase()
.slice(0, 2);
}
示例2: moment
transform(value: any, args: Array<any>): string {
return moment(value).fromNow();
}
示例3: converterStringsParaDatas
private converterStringsParaDatas(dados: Array<any>) {
for (const dado of dados) {
dado.dia = moment(dado.dia, 'YYYY-MM-DD').toDate();
}
}
示例4:
export const isHoliday = (date: Moment|Date): boolean => HOLIDAYS.some((holiday: Moment) => holiday.isSame(moment(date), 'day'))
示例5: moment
.map((holiday: string) => moment(holiday, Config.holidaysFormat))
示例6: constructor
constructor(private bucket: string, now = moment()) {
this.expires = now.add(90, 'days').format(HTTP_DATE_FORMAT) + ' GTM';
this.exec = promisify(cp.exec);
}
示例7: generateFileName
generateFileName(migrationName: string): string {
return `m${moment().format('YMMDD_HHmmss')}_${migrationName}`;
}
示例8:
it('should return true if the first moment is before the second', (): void => {
expect(moment('2015-01-01')).to.be.beforeMoment(moment('2016-01-01'));
expect(moment('2015-01-01')).to.not.be.beforeMoment(moment('2014-01-01'));
});
示例9: moment
it('should handle timezones', (): void => {
let est_moment: moment.Moment = moment('2016-01-02T12:00:00.000-05:00').tz('US/Eastern');
let pst_moment: moment.Moment = moment('2016-01-02T09:00:00.000-08:00').tz('US/Pacific');
expect(est_moment).to.equalMoment(pst_moment);
});
示例10: daysBetween
static daysBetween(beginDate, endDate) {
return moment(endDate)
.endOf('day')
.diff(moment(beginDate).startOf('day'), 'days');
}