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-text-field
|
||||||
v-model="dateFormatted"
|
v-model="dateFormatted"
|
||||||
label="Date"
|
label="Date"
|
||||||
hint="MM/DD/YYYY format"
|
hint="DD/MM/YYYY format"
|
||||||
persistent-hint
|
persistent-hint
|
||||||
prepend-icon="mdi-calendar"
|
prepend-icon="mdi-calendar"
|
||||||
v-bind="attrs"
|
v-bind="attrs"
|
||||||
@blur="date = parseDate(dateFormatted)"
|
|
||||||
v-on="on"
|
v-on="on"
|
||||||
></v-text-field>
|
></v-text-field>
|
||||||
</template>
|
</template>
|
||||||
|
|
@ -169,24 +168,14 @@
|
||||||
},
|
},
|
||||||
formatDate (date) {
|
formatDate (date) {
|
||||||
if (!date) return null
|
if (!date) return null
|
||||||
|
|
||||||
const [year, month, day] = date.split('-')
|
const [year, month, day] = date.split('-')
|
||||||
return `${month}/${day}/${year}`
|
return `${day}/${month}/${year}`
|
||||||
},
|
|
||||||
parseDate (date) {
|
|
||||||
if (!date) return null
|
|
||||||
|
|
||||||
const [month, day, year] = date.split('/')
|
|
||||||
return `${year}-${month.padStart(2, '0')}-${day.padStart(2, '0')}`
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
headers() {
|
headers() {
|
||||||
return this.headersData
|
return this.headersData
|
||||||
},
|
},
|
||||||
computedDateFormatted () {
|
|
||||||
return this.formatDate(this.date)
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue