本文整理匯總了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)
})