• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

TypeScript calculateMonthIncrement.calculateMonthIncrement函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了TypeScript中common/calculate-month-increment/calculateMonthIncrement.calculateMonthIncrement函数的典型用法代码示例。如果您正苦于以下问题:TypeScript calculateMonthIncrement函数的具体用法?TypeScript calculateMonthIncrement怎么用?TypeScript calculateMonthIncrement使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了calculateMonthIncrement函数的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。

示例1: monthIncrementFilter

export function monthIncrementFilter (value: moment.Moment | string): moment.Moment {
  try {
    if (!value || !(typeof value === 'string' || value instanceof moment)) {
      throw new Error('Input should be moment or string, cannot be empty')
    }

    let date: moment.Moment
    if (typeof value === 'string') {
      if (value === 'now') {
        date = moment()
      } else {
        date = moment(value)
      }
    } else {
      date = value
    }
    if (!date.isValid()) {
      throw new Error('Invalid date')
    }
    return calculateMonthIncrement(date)
  } catch (err) {
    logger.error(err)
    throw err
  }
}
开发者ID:hmcts,项目名称:cmc-citizen-frontend,代码行数:25,代码来源:dateFilter.ts


示例2: it

  it('should return the correct earliest date where defendant pays by instalment in 50 days but claimant chooses pay by instalment in 5 days - partial admissions', () => {
    const claim = prepareClaim(partialAdmissionWithPaymentByInstalmentsDataPaymentDateAfterMonth)
    const claimantPaymentDate: moment.Moment = MomentFactory.currentDate().add(5, 'days')
    const monthIncrement = calculateMonthIncrement(moment().startOf('day'))
    const paymentDate = getEarliestPaymentDateForPaymentPlan(claim, claimantPaymentDate)

    expect(paymentDate.toString()).to.equal(monthIncrement.toString())
  })
开发者ID:hmcts,项目名称:cmc-citizen-frontend,代码行数:8,代码来源:paydateHelper.ts


示例3: calculateLastPaymentDate

  calculateLastPaymentDate (): moment.Moment {
    let lastPaymentDate = this.startDate.clone()

    switch (this.frequency) {
      case (Frequency.WEEKLY):
        lastPaymentDate.add(this.numberOfInstalments - 1, 'weeks')
        break
      case (Frequency.TWO_WEEKLY):
        lastPaymentDate.add((this.numberOfInstalments - 1) * 2, 'weeks')
        break
      case (Frequency.MONTHLY):
        lastPaymentDate = calculateMonthIncrement(lastPaymentDate, this.numberOfInstalments - 1)
        break
    }
    return lastPaymentDate
  }
开发者ID:hmcts,项目名称:cmc-citizen-frontend,代码行数:16,代码来源:paymentPlan.ts


示例4: getEarliestPaymentDateForPaymentPlan

export function getEarliestPaymentDateForPaymentPlan (claim: Claim, claimantPaymentDate: moment.Moment): moment.Moment {
  const monthIncrementDate: moment.Moment = calculateMonthIncrement(moment().startOf('day'))
  const response: FullAdmissionResponse | PartialAdmissionResponse = claim.response as FullAdmissionResponse | PartialAdmissionResponse
  if (!response) {
    return monthIncrementDate
  }
  const defendantPaymentOption: PaymentOption = response.paymentIntention.paymentOption
  const earliestPermittedDate: moment.Moment = claimantPaymentDate < monthIncrementDate ? monthIncrementDate : claimantPaymentDate

  if (defendantPaymentOption === PaymentOption.IMMEDIATELY || defendantPaymentOption === PaymentOption.BY_SPECIFIED_DATE) {
    return earliestPermittedDate
  }

  const defendantPaymentDate: moment.Moment = response.paymentIntention.repaymentPlan.firstPaymentDate

  return defendantPaymentDate < earliestPermittedDate ? defendantPaymentDate : earliestPermittedDate
}
开发者ID:hmcts,项目名称:cmc-citizen-frontend,代码行数:17,代码来源:paydateHelper.ts


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


示例6: it

 it('should calculate a month where the start date is 31st leading to next month with 30 days',() => {
   const startDate: moment.Moment = MomentFactory.parse('2018-08-31')
   const calculateMonthDate: moment.Moment = calculateMonthIncrement(startDate)
   expect(calculateMonthDate.toString()).to.equal(MomentFactory.parse('2018-10-01').toString())
 })
开发者ID:hmcts,项目名称:cmc-citizen-frontend,代码行数:5,代码来源:calculate-month-increment.ts


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


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



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap