當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。