Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update SupplementaryFormView for hotfix date change #402

Merged
merged 5 commits into from
Nov 1, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions frontend/src/views/supp-allowances/SupplementaryFormView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -555,7 +555,7 @@ export default {
},
setSuppTermDates() {
const today = new Date()
const formattedEndDate = new Date(this.fundingAgreement.endDate)
const formattedEndDate = moment(this.fundingAgreement?.endDate).endOf('day').toDate()
const formattedStartDate = new Date(this.fundingAgreement.startDate)
const daysOfTerm = moment.duration(moment(formattedEndDate).diff(moment(formattedStartDate))).asDays()
let termTwoEndDate
Expand All @@ -564,11 +564,11 @@ export default {
//ofmcc-6357- allow supp terms to work with both a FA term of 2 and 3 years in length
//this will account for leap years as a standard non leap year term would be 729 days.
if (daysOfTerm > TWO_YEARS) {
termTwoEndDate = moment(formattedEndDate).subtract(1, 'years').toDate()
termOneEndDate = moment(formattedEndDate).subtract(2, 'years').toDate()
termTwoEndDate = moment(formattedEndDate).subtract(1, 'years').endOf('day').toDate()
termOneEndDate = moment(formattedEndDate).subtract(2, 'years').endOf('day').toDate()
} else {
termTwoEndDate = formattedEndDate
termOneEndDate = moment(formattedEndDate).subtract(1, 'years').toDate()
termOneEndDate = moment(formattedEndDate).subtract(1, 'years').endOf('day').toDate()
}

switch (true) {
Expand Down
Loading