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


TypeScript MomentFactory.maxDate方法代碼示例

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


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

示例1: createPaymentPlanFromClaimAdmission

  private static createPaymentPlanFromClaimAdmission (response: FullAdmissionResponse | PartialAdmissionResponse,
                                                      totalAmount: number,
                                                      draft: DraftClaimantResponse): PaymentPlan {
    const paymentIntention: PI = response.paymentIntention
    if (!paymentIntention) {
      return undefined
    }

    if (paymentIntention.repaymentPlan) {
      return PaymentPlanHelper.createPaymentPlanFromInstallment(
        totalAmount,
        paymentIntention.repaymentPlan.instalmentAmount,
        Frequency.of(paymentIntention.repaymentPlan.paymentSchedule),
        paymentIntention.repaymentPlan.firstPaymentDate
      )
    }

    if (draft.courtDetermination.disposableIncome <= 0) {
      return PaymentPlanHelper.createPaymentPlanFromStartDate(MomentFactory.maxDate())
    }

    if (paymentIntention.paymentOption === PaymentOption.BY_SPECIFIED_DATE) {
      const instalmentAmount: number = draft.courtDetermination.disposableIncome / Frequency.WEEKLY.monthlyRatio
      return PaymentPlanHelper.createPaymentPlanFromInstallment(totalAmount, instalmentAmount, Frequency.WEEKLY, calculateMonthIncrement(MomentFactory.currentDate()))
    }
  }
開發者ID:hmcts,項目名稱:cmc-citizen-frontend,代碼行數:26,代碼來源:paymentPlanHelper.ts

示例2: generateCourtCalculatedPaymentIntention

  static generateCourtCalculatedPaymentIntention (draft: DraftClaimantResponse, claim: Claim) {
    const courtCalculatedPaymentIntention = new PaymentIntention()
    const paymentPlanFromDefendantFinancialStatement: PaymentPlan = PaymentPlanHelper.createPaymentPlanFromDefendantFinancialStatement(claim, draft)
    if (!paymentPlanFromDefendantFinancialStatement) {
      return undefined
    }

    if (paymentPlanFromDefendantFinancialStatement.startDate.isSame(MomentFactory.maxDate())) {
      courtCalculatedPaymentIntention.paymentOption = PaymentOption.BY_SPECIFIED_DATE
      courtCalculatedPaymentIntention.paymentDate = MomentFactory.maxDate()
    } else {
      courtCalculatedPaymentIntention.paymentOption = PaymentOption.INSTALMENTS
      courtCalculatedPaymentIntention.repaymentPlan = {
        firstPaymentDate: paymentPlanFromDefendantFinancialStatement.startDate,
        instalmentAmount: _.round(paymentPlanFromDefendantFinancialStatement.instalmentAmount,2),
        paymentSchedule: Frequency.toPaymentSchedule(paymentPlanFromDefendantFinancialStatement.frequency),
        completionDate: paymentPlanFromDefendantFinancialStatement.calculateLastPaymentDate(),
        paymentLength: paymentPlanFromDefendantFinancialStatement.calculatePaymentLength()
      }
    }
    return courtCalculatedPaymentIntention
  }
開發者ID:hmcts,項目名稱:cmc-citizen-frontend,代碼行數:22,代碼來源:payment-plan.ts

示例3: createPaymentPlanFromDefendantFinancialStatement

  static createPaymentPlanFromDefendantFinancialStatement (claim: Claim, draft: DraftClaimantResponse): PaymentPlan {
    const response = claim.response as FullAdmissionResponse | PartialAdmissionResponse
    const frequency: Frequency = response.paymentIntention.paymentOption === PaymentOption.INSTALMENTS ?
      Frequency.of(response.paymentIntention.repaymentPlan.paymentSchedule) : Frequency.WEEKLY

    if (claim.claimData.defendant.isBusiness()) {
      return undefined
    }

    if (response === undefined) {
      throw new Error('Claim does not have response attached')
    }
    if (response.statementOfMeans === undefined) {
      throw new Error(`Claim response does not have financial statement attached`)
    }

    const instalmentAmount: number = Math.min(draft.courtDetermination.disposableIncome / frequency.monthlyRatio, claim.totalAmountTillToday)
    if (instalmentAmount < 1) {
      return PaymentPlanHelper.createPaymentPlanFromStartDate(MomentFactory.maxDate())
    }

    return PaymentPlanHelper.createPaymentPlanFromInstallment(AdmissionHelper.getAdmittedAmount(claim), instalmentAmount, frequency, calculateMonthIncrement(MomentFactory.currentDate()))
  }
開發者ID:hmcts,項目名稱:cmc-citizen-frontend,代碼行數:23,代碼來源:paymentPlanHelper.ts

示例4: it

 it('just over the threshold', () => {
   draft.courtDetermination.disposableIncome = parseFloat(Frequency.WEEKLY.monthlyRatio.toFixed(2)) + 0.01
   const paymentPlan = PaymentPlanHelper.createPaymentPlanFromDefendantFinancialStatement(claim, draft)
   expect(paymentPlan.startDate.toISOString()).not.to.equal(MomentFactory.maxDate().toISOString())
 })
開發者ID:hmcts,項目名稱:cmc-citizen-frontend,代碼行數:5,代碼來源:paymentPlanHelper.ts

示例5:

      firstPaymentDate: MomentFactory.currentDate().add(80, 'days').toISOString(),
      paymentSchedule: PaymentSchedule.EACH_WEEK,
      completionDate: MomentFactory.currentDate().add(100, 'days').toISOString(),
      paymentLength: '1'
    }
  }
}

export const fullAdmissionWithPaymentByInstalmentsDataWithUnReasonablePaymentSchedule = {
  ...baseResponseData,
  ...baseFullAdmissionData,
  paymentIntention: {
    paymentOption: PaymentOption.INSTALMENTS,
    repaymentPlan: {
      instalmentAmount: 100,
      firstPaymentDate: MomentFactory.maxDate().toISOString(),
      paymentSchedule: PaymentSchedule.EACH_WEEK,
      completionDate: MomentFactory.maxDate().toISOString(),
      paymentLength: '1'
    }
  }
}

export const partialAdmissionWithPaymentByInstalmentsData = {
  ...baseResponseData,
  ...basePartialAdmissionData,
  ...basePartialEvidencesAndTimeLines,
  defence: 'i have paid more than enough',
  ...basePayByInstalmentsData,
  amount: 3000
}
開發者ID:hmcts,項目名稱:cmc-citizen-frontend,代碼行數:31,代碼來源:responseData.ts

示例6: it

 it('should return a claimant in favour of defendant decision type when claimant offers better date and court calculated is max date', () => {
   let claimantPaymentDate = moment(new Date()).add(3, 'days')
   let defendantPaymentDate = moment(new Date()).add(1, 'days')
   expect(CourtDecision.calculateDecision(defendantPaymentDate, claimantPaymentDate, MomentFactory.maxDate())).to.equal(DecisionType.CLAIMANT_IN_FAVOUR_OF_DEFENDANT)
 })
開發者ID:hmcts,項目名稱:cmc-citizen-frontend,代碼行數:5,代碼來源:courtDecision.ts


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