本文整理汇总了TypeScript中moment.Moment.startOf方法的典型用法代码示例。如果您正苦于以下问题:TypeScript Moment.startOf方法的具体用法?TypeScript Moment.startOf怎么用?TypeScript Moment.startOf使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类moment.Moment
的用法示例。
在下文中一共展示了Moment.startOf方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: moment
const getDaySpan: Function = (event: CalendarEvent, offset: number, startOfWeek: Moment): number => {
let span: number = 1;
if (event.end) {
const begin: Moment = moment(event.start).isBefore(startOfWeek) ? startOfWeek : moment(event.start);
span = moment(event.end)
.endOf('day')
.add(1, 'minute')
.diff(begin.startOf('day'), 'days');
if (span > DAYS_IN_WEEK) {
span = DAYS_IN_WEEK;
}
}
const totalLength: number = offset + span;
if (totalLength > DAYS_IN_WEEK) {
span -= (totalLength - DAYS_IN_WEEK);
}
return span;
};
示例2: updateRangeDate
updateRangeDate() {
let from = this.pickerStartDate.startOf('minute').unix() * 1000;
let to = this.pickerEndDate.endOf('minute').unix() * 1000;
let diff = to - from;
let timeframe = _.findLast(this.timeframes, function (timeframe: Timeframe) {
return timeframe.range < diff;
});
if (!timeframe) {
timeframe = this.timeframes[0];
}
this.update({
interval: timeframe.interval,
from: from,
to: to
});
}