Make date picker aware of the birthday max value
This commit is contained in:
parent
dd97a23ce7
commit
03d5c2e140
|
@ -71,6 +71,9 @@ const registration = {
|
||||||
minDate.setTime(today.getTime() - minAge * DAY)
|
minDate.setTime(today.getTime() - minAge * DAY)
|
||||||
return minDate
|
return minDate
|
||||||
},
|
},
|
||||||
|
birthdayMinAttr () {
|
||||||
|
return this.birthdayMin.toJSON().replace(/T.+$/, '')
|
||||||
|
},
|
||||||
birthdayMinFormatted () {
|
birthdayMinFormatted () {
|
||||||
const browserLocale = localeService.internalToBrowserLocale(this.$i18n.locale)
|
const browserLocale = localeService.internalToBrowserLocale(this.$i18n.locale)
|
||||||
return this.user.birthday && new Date(Date.parse(this.birthdayMin)).toLocaleDateString(browserLocale, { timeZone: 'UTC', day: 'numeric', month: 'long', year: 'numeric' })
|
return this.user.birthday && new Date(Date.parse(this.birthdayMin)).toLocaleDateString(browserLocale, { timeZone: 'UTC', day: 'numeric', month: 'long', year: 'numeric' })
|
||||||
|
|
|
@ -183,7 +183,7 @@
|
||||||
:disabled="isPending"
|
:disabled="isPending"
|
||||||
class="form-control"
|
class="form-control"
|
||||||
type="date"
|
type="date"
|
||||||
max="birthdayMin"
|
:max="birthdayRequired ? birthdayMinAttr : undefined"
|
||||||
:aria-required="birthdayRequired"
|
:aria-required="birthdayRequired"
|
||||||
>
|
>
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Reference in New Issue