On page load, only the year input is required for users to fill in. The user can enter their birth year first without providing the month and day.
Currently, I have a function that checks if a person is over 16 years old by comparing their birth year with the current year.
checkAge() {
let yearOfBirth = new Date().getFullYear() - this.form.dobYear;
if (yearOfBirth > 16) {
this.isSixteen = false;
this.belowSixteen = false;
}
}
If the age equals exactly 16 when subtracting the user's input birth year from the current year, then two select elements will display for the user to choose the day and month of their birthday.
In this scenario, it is important to accurately determine whether the user is precisely 16 years old or potentially a few months away from turning 16. This distinction will affect how their age is displayed.
I am utilizing BootstrapVue and Vue.js for this functionality.