![]() Server : Apache System : Linux server2.corals.io 4.18.0-348.2.1.el8_5.x86_64 #1 SMP Mon Nov 15 09:17:08 EST 2021 x86_64 User : corals ( 1002) PHP Version : 7.4.33 Disable Function : exec,passthru,shell_exec,system Directory : /home/corals/vreg/components/Forms/ |
<template> <div> <label>Date of Birth</label> <div class="v-form-row"> <div class="v-form-col"> <vreg-select :form="form" header-text="Month" required @value-selected="v=>form.birth_date.month=v" :fieldValue="form.birth_date.month" v-if="months" :options="months" field="birth_date.month"/> </div> <div class="v-form-col"> <vreg-select :form="form" required header-text="Day" @value-selected="v=>form.birth_date.day=v" :fieldValue="form.birth_date.day" v-if="days" :options="days" field="birth_date.day"/> </div> <div class="v-form-col"> <vreg-select :form="form" required header-text="Year" @value-selected="v=>form.birth_date.year=v" :fieldValue="form.birth_date.year" v-if="years" :options="years" field="birth_date.year"/> </div> </div> </div> </template> <script> import VregSelect from "./VregSelect"; export default { components: {VregSelect}, props: ['form'], name: "BirthDate", computed: { years() { let years = [], dateStart = this.$moment().subtract(18, 'y'), dateEnd = this.$moment().subtract(18, 'y') .subtract(100, 'y'); while (dateStart.diff(dateEnd, 'years') >= 0) { years.push({ value: dateStart.format('YYYY'), label: dateStart.format('YYYY') }) dateStart.subtract(1, 'year') } return years; }, months() { let months = []; let year = this.$moment().month(0); do { months.push({ label: year.format('MM-MMM'), value: year.format('MM') }); } while (year.add(1, 'month').month() !== 0) ; return months; }, days() { let monthIndex = this.form.birth_date.month, date = new Date(this.form.birth_date.year, monthIndex - 1, 1), days = []; for (let i = 1; i <= this.$moment(date).daysInMonth(); i++) { days.push({ label: ("0" + i).slice(-2), value: ("0" + i).slice(-2) }); } return days; } } } </script> <style scoped> .form-group .custom-select { height: 50px; /*padding: 10px 30px 10px 15px;*/ box-shadow: none; background: #fff; border: 1px solid #DCDCDC; border-radius: 2px; } .form-group { position: relative; } .dropdown-arrow-select { position: absolute; right: 15px; bottom: 45px; width: 14px; pointer-events: none; top: 24px; } .custom-select-placeholder { position: absolute; padding-left: 7px; padding-top: 14px; color: #868686; letter-spacing: 0.01em; font: 15px / 19px sfProDisplay-Light; } .custom-select-selected { font-weight: bold; padding-top: 19px; font-size: 16px; padding-left: 28px; } .custom-select-placeholder-focused { font-size: 12px; padding-top: 4px; margin: unset; transition: all .2s ease-in; } </style>