本文整理汇总了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()))
}
}
示例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
}
示例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()))
}
示例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())
})
示例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
}
示例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)
})