当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript Moment.clone方法代码示例

本文整理汇总了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)
    ];
}
开发者ID:Nimzi-Git,项目名称:angular-io-datepicker,代码行数:14,代码来源:dateUtils.ts

示例2: respondToResponseDeadline

 get respondToResponseDeadline (): Moment {
   if (!this.respondedAt) {
     return undefined
   }
   const daysForService = 5
   const daysForResponse = 28
   return this.respondedAt.clone().add(daysForService + daysForResponse, 'days')
 }
开发者ID:hmcts,项目名称:cmc-citizen-frontend,代码行数:8,代码来源:claim.ts

示例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;
}
开发者ID:Nimzi-Git,项目名称:angular-io-datepicker,代码行数:20,代码来源:dateUtils.ts

示例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;

};
开发者ID:xMrWhite,项目名称:calendar-utils,代码行数:12,代码来源:calendarUtils.ts

示例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}`;
  }
开发者ID:PIWEEK,项目名称:comocomo,代码行数:19,代码来源:dates.service.ts

示例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
 }
开发者ID:hmcts,项目名称:cmc-citizen-frontend,代码行数:6,代码来源:claim.ts

示例7: hasDefendantNotSignedSettlementAgreementInTime

 hasDefendantNotSignedSettlementAgreementInTime (): boolean {
   return this.settlement && this.settlement.isOfferAccepted() && this.settlement.isThroughAdmissions() &&
     this.claimantRespondedAt && this.claimantRespondedAt.clone().add('7', 'days').isBefore(MomentFactory.currentDate())
 }
开发者ID:hmcts,项目名称:cmc-citizen-frontend,代码行数:4,代码来源:claim.ts

示例8: nextWeek

 public nextWeek(date: Moment): Moment {
   return date.clone().add(1, 'week');
 }
开发者ID:PIWEEK,项目名称:comocomo,代码行数:3,代码来源:dates.service.ts

示例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`)
   }
 })
开发者ID:xtina-starr,项目名称:metaphysics,代码行数:6,代码来源:date.test.ts


注:本文中的moment.Moment.clone方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。