本文整理汇总了TypeScript中moment.Moment.clone方法的典型用法代码示例。如果您正苦于以下问题:TypeScript Moment.clone方法的具体用法?TypeScript Moment.clone怎么用?TypeScript Moment.clone使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类moment.Moment
的用法示例。
在下文中一共展示了Moment.clone方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: decade
export function decade(date: Moment): Moment[] {
if (!date || !date.isValid()) {
throw new Error("Date is not valid");
}
const year = date.year();
const startYear = year - year % 10;
const endYear = startYear + 9;
return [
date.clone().year(startYear),
date.clone().year(endYear)
];
}
示例2: respondToResponseDeadline
get respondToResponseDeadline (): Moment {
if (!this.respondedAt) {
return undefined
}
const daysForService = 5
const daysForResponse = 28
return this.respondedAt.clone().add(daysForService + daysForResponse, 'days')
}
示例3: monthCalendar
export function monthCalendar(date: Moment): Moment[] {
const start = date.clone().startOf("month").startOf("week").startOf("day");
const end = date.clone().endOf("month").endOf("week").startOf("day");
const result: Moment[] = [];
let current = start.weekday(0).subtract(1, "d");
while (true) {
current = current.clone().add(1, "d");
result.push(current);
if (areDatesEqual(current, end)) {
break;
}
}
return result;
}
示例4: moment
export const getWeekViewHeader: Function = ({viewDate}: {viewDate: Date}): WeekDay[] => {
const start: Moment = moment(viewDate).startOf('week');
const days: WeekDay[] = [];
for (let i: number = 0; i < DAYS_IN_WEEK; i++) {
const date: Moment = start.clone().add(i, 'days');
days.push(getWeekDay({date}));
}
return days;
};
示例5: weekName
public weekName(week: Moment): string {
const start = week.clone();
const startDay = start.format('D');
const startMonth = start.format('MMM').replace('.', '');
const startYear = start.format('YYYY');
const end = start.clone().add(6, 'days');
const endDay = end.format('D');
const endMonth = end.format('MMM').replace('.', '');
const endYear = end.format('YYYY');
if (startYear !== endYear) {
return `${startDay} ${startMonth} ${startYear} - ${endDay} ${endMonth} ${endYear}`;
}
if (startMonth !== endMonth) {
return `${startDay} ${startMonth} - ${endDay} ${endMonth} ${endYear}`;
}
return `${startDay}-${endDay} ${endMonth} ${endYear}`;
}
示例6: isEligibleForReDetermination
isEligibleForReDetermination (): boolean {
const dateAfter19Days = this.countyCourtJudgmentRequestedAt && this.countyCourtJudgmentRequestedAt.clone().add(19, 'days')
return this.countyCourtJudgment && this.countyCourtJudgment.ccjType === CountyCourtJudgmentType.DETERMINATION
&& MomentFactory.currentDateTime().isBefore(dateAfter19Days)
&& this.reDeterminationRequestedAt === undefined
}
示例7: hasDefendantNotSignedSettlementAgreementInTime
hasDefendantNotSignedSettlementAgreementInTime (): boolean {
return this.settlement && this.settlement.isOfferAccepted() && this.settlement.isThroughAdmissions() &&
this.claimantRespondedAt && this.claimantRespondedAt.clone().add('7', 'days').isBefore(MomentFactory.currentDate())
}
示例8: nextWeek
public nextWeek(date: Moment): Moment {
return date.clone().add(1, 'week');
}
示例9: it
it("states that an exhibition opens in a few days", () => {
for (let days = 2; days <= 5; days++) {
const status = exhibitionStatus(today.clone().add(days, "d"), future)
expect(status).toBe(`Opening in ${days} days`)
}
})