當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript Moment.year方法代碼示例

本文整理匯總了TypeScript中moment.Moment.year方法的典型用法代碼示例。如果您正苦於以下問題:TypeScript Moment.year方法的具體用法?TypeScript Moment.year怎麽用?TypeScript Moment.year使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在moment.Moment的用法示例。


在下文中一共展示了Moment.year方法的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。

示例1: String

 const getFromDate = (date: Moment): Semester => {
   const prefix = date.month() >= 6 ? 'h' : 'v'
   const suffix = String(date.year()).slice(2, 4)
   return {
     id: prefix + suffix,
     year: date.year(),
     semester: prefix,
   }
 }
開發者ID:blindern,項目名稱:intern,代碼行數:9,代碼來源:ArrplanService.ts

示例2: areDatesEqual

export function areDatesEqual(d1: Moment, d2: Moment): boolean {
    if (!d1 || !d1.isValid()) {
        throw new Error("First date is not valid.");
    }
    if (!d2 || !d2.isValid()) {
        throw new Error("Second date is not valid.");
    }

    return d1.year() === d2.year() &&
        d1.dayOfYear() === d2.dayOfYear();
}
開發者ID:Nimzi-Git,項目名稱:angular-io-datepicker,代碼行數:11,代碼來源:dateUtils.ts

示例3: setFirstPaymentDate

 function setFirstPaymentDate (firstPaymentDate: Moment): object {
   return {
     day: firstPaymentDate.date(),
     month: firstPaymentDate.month() + 1,
     year: firstPaymentDate.year()
   }
 }
開發者ID:hmcts,項目名稱:cmc-citizen-frontend,代碼行數:7,代碼來源:payment-plan.ts

示例4: isCurrentMonth

    public isCurrentMonth(date: Moment): boolean {
        if (!date) {
            throw new Error("Date is required.");
        }

        return this.value.year() === date.year() && this.value.month() === date.month();
    }
開發者ID:Nimzi-Git,項目名稱:angular-io-datepicker,代碼行數:7,代碼來源:daySelector.ts

示例5: removeHoursAndMinutes

  private static removeHoursAndMinutes(dateTime: Moment): Moment {
    const date = moment(new Date(
      dateTime.year(),
      dateTime.month(),
      dateTime.date()
    ))

    return date
  }
開發者ID:janaagaard75,項目名稱:FilmFilter,代碼行數:9,代碼來源:ImmutableDate.ts

示例6: dataToSend

 function dataToSend (firstPaymentDate: Moment): object {
   return {
     totalAmount: 100,
     instalmentAmount: 50,
     firstPaymentDate: {
       day: firstPaymentDate.date(),
       month: firstPaymentDate.month() + 1,
       year: firstPaymentDate.year()
     },
     paymentSchedule: 'EVERY_MONTH'
   }
 }
開發者ID:hmcts,項目名稱:cmc-citizen-frontend,代碼行數:12,代碼來源:payment-plan.ts

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

示例8: getRepaymentPlanForm

export function getRepaymentPlanForm (claim: Claim, draft: DraftWrapper<DraftCCJ>): RepaymentPlanForm {
  if (draft.document.paymentOption.option === PaymentType.INSTALMENTS) {
    if ((claim.settlement && (claim.settlementReachedAt || claim.settlement.isOfferRejectedByDefendant())) || claim.hasDefendantNotSignedSettlementAgreementInTime()) {
      const coreRepaymentPlan: CoreRepaymentPlan = claim.settlement.getLastOffer().paymentIntention.repaymentPlan
      const firstPaymentDate: Moment = calculateMonthIncrement(MomentFactory.currentDate(), 1)
      const paymentSchedule: PaymentSchedule = PaymentSchedule.of(coreRepaymentPlan.paymentSchedule)
      const alreadyPaid: number = (draft.document.paidAmount.amount || 0)
      const remainingAmount: number = claim.totalAmountTillToday - alreadyPaid
      const repaymentPlanForm: RepaymentPlanForm = new RepaymentPlanForm(
        remainingAmount,
        coreRepaymentPlan.instalmentAmount,
        new LocalDate(firstPaymentDate.year(), firstPaymentDate.month() + 1, firstPaymentDate.date()),
        paymentSchedule)
      return repaymentPlanForm
    }
  }
  return draft.document.repaymentPlan
}
開發者ID:hmcts,項目名稱:cmc-citizen-frontend,代碼行數:18,代碼來源:ccjModelConverter.ts

示例9: fromModel

 fromModel(date: Moment): NgbDateStruct {
     if (date != null && moment.isMoment(date) && date.isValid()) {
         return { year: date.year(), month: date.month() + 1, day: date.date() };
     }
     return null;
 }
開發者ID:Danils123,項目名稱:Prueba-azure,代碼行數:6,代碼來源:datepicker-adapter.ts

示例10: year

 public year(): number {
   return this.moment.year()
 }
開發者ID:janaagaard75,項目名稱:FilmFilter,代碼行數:3,代碼來源:ImmutableMoment.ts


注:本文中的moment.Moment.year方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。