diff --git a/electron/changelog.json b/electron/changelog.json index 73285d9..cb8fc12 100644 --- a/electron/changelog.json +++ b/electron/changelog.json @@ -73,5 +73,10 @@ "title": "Release Notes for 1.0.23", "date": "10/13/2021", "notes": "New Features: \n- Improved detection of glass and glass related lines.\n- Improved detection of manual part changes." + }, + "1.0.24": { + "title": "Release Notes for 1.0.24", + "date": "11/08/2021", + "notes": "New Features: \n- Resolved age calculation issue for model year 2022 vehicles." } } diff --git a/src/ipc/ipc-estimate-utils.js b/src/ipc/ipc-estimate-utils.js index 9dcdd6e..336d3c2 100644 --- a/src/ipc/ipc-estimate-utils.js +++ b/src/ipc/ipc-estimate-utils.js @@ -20,14 +20,11 @@ export function CalculateVehicleAge(job) { const parsedYr = parseInt(job.v_model_yr); const vehicleYr = - moment().year() - 2000 >= parsedYr ? 2000 + parsedYr : 1900 + parsedYr; + moment().year() + 1 - 2000 >= parsedYr ? 2000 + parsedYr : 1900 + parsedYr; - let ret = - moment().year() - 2000 < parsedYr - ? 0 - : moment(job.close_date || new Date()).year() - vehicleYr; + let ret; - if (ret < 0) ret = 0; + ret = Math.max(0, moment(job.close_date || new Date()).year() - vehicleYr); return ret; }