Skip to content

Commit

Permalink
Merge pull request #247 from bcgov/ofmcc-3498-supp-app-timing-issue
Browse files Browse the repository at this point in the history
Ofmcc 3498 supp app timing issue
  • Loading branch information
jenbeckett authored Jun 19, 2024
2 parents 29b1ad9 + 06132fc commit a2b7d5c
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions frontend/src/views/supp-allowances/SupplementaryFormView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -495,11 +495,15 @@ export default {
setSuppTermDates() {
const today = new Date()
const formattedEndDate = new Date(this.fundingAgreement.endDate)
const termTwoEndDate = new Date(formattedEndDate.setFullYear(formattedEndDate.getFullYear() - 1))
const termOneEndDate = new Date(termTwoEndDate.setFullYear(termTwoEndDate.getFullYear() - 1))

const termTwoEndDate = new Date(new Date(this.fundingAgreement.endDate).setFullYear(new Date(this.fundingAgreement.endDate).getFullYear() - 1))
const termOneEndDate = new Date(new Date(termTwoEndDate).setFullYear(new Date(termTwoEndDate).getFullYear() - 1))

switch (true) {
case today < termOneEndDate:
//not having a funding agreement or FA end date will only happen if a user navigates to SuppApp right after
//OFM core creation. They moved too quickly and the FA did not have time to generate in Dynamics before returning.
//In this case, we can safely assume they are in term 1. Upon refresh, the FA will exist.
case today < termOneEndDate || !this.fundingAgreement?.endDate:
this.fundingExpiryDate = termOneEndDate
this.renewalTerm = SUPP_TERM_CODES.TERM_ONE
this.nextRenewalTerm = SUPP_TERM_CODES.TERM_TWO
Expand Down

0 comments on commit a2b7d5c

Please sign in to comment.