fix: date format
Signed-off-by: Ameya Shenoy <shenoy.ameya@gmail.com>
This commit is contained in:
parent
d5ff6089be
commit
dc6e8ca736
1 changed files with 2 additions and 13 deletions
|
|
@ -42,11 +42,10 @@
|
|||
<v-text-field
|
||||
v-model="dateFormatted"
|
||||
label="Date"
|
||||
hint="MM/DD/YYYY format"
|
||||
hint="DD/MM/YYYY format"
|
||||
persistent-hint
|
||||
prepend-icon="mdi-calendar"
|
||||
v-bind="attrs"
|
||||
@blur="date = parseDate(dateFormatted)"
|
||||
v-on="on"
|
||||
></v-text-field>
|
||||
</template>
|
||||
|
|
@ -169,24 +168,14 @@
|
|||
},
|
||||
formatDate (date) {
|
||||
if (!date) return null
|
||||
|
||||
const [year, month, day] = date.split('-')
|
||||
return `${month}/${day}/${year}`
|
||||
},
|
||||
parseDate (date) {
|
||||
if (!date) return null
|
||||
|
||||
const [month, day, year] = date.split('/')
|
||||
return `${year}-${month.padStart(2, '0')}-${day.padStart(2, '0')}`
|
||||
return `${day}/${month}/${year}`
|
||||
},
|
||||
},
|
||||
computed: {
|
||||
headers() {
|
||||
return this.headersData
|
||||
},
|
||||
computedDateFormatted () {
|
||||
return this.formatDate(this.date)
|
||||
},
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
|
|
|
|||
Loading…
Reference in a new issue