Browse Source

Make date picker aware of the birthday max value

tusooa 1 year ago
parent
commit
03d5c2e140

+ 3 - 0
src/components/registration/registration.js

@@ -71,6 +71,9 @@ const registration = {
       minDate.setTime(today.getTime() - minAge * DAY)
       return minDate
     },
+    birthdayMinAttr () {
+      return this.birthdayMin.toJSON().replace(/T.+$/, '')
+    },
     birthdayMinFormatted () {
       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' })

+ 1 - 1
src/components/registration/registration.vue

@@ -183,7 +183,7 @@
                 :disabled="isPending"
                 class="form-control"
                 type="date"
-                max="birthdayMin"
+                :max="birthdayRequired ? birthdayMinAttr : undefined"
                 :aria-required="birthdayRequired"
               >
             </div>