Vue js Datepicker not formating
I am using vuejs-datepicker for saving date into the database for frontend and for backend using laravel and mysql database
when send date from date picker then get this error
Could not parse 'Thu Jun 11 2020 11:46:00 GMT+0500 (Pakistan Standard Time)
<datepicker
input-class="form-control"
v-model="due_date"
name="due_date"
type="date"
autocomplete="off"
:format="customDateFormat"
:typeable="true">
</datepicker>
customDateFormat() {
return moment(this.due_date).format("MM-DD-YYYY")
}
Thanks @bobbybouwmann bro for replyming me
Getting same error Could not parse 'Thu Jun 25 2020 15:31:00 GMT+0500 (Pakistan Standard Time)
when use
customDateFormat(date) {
return moment(date).format("MM-DD-YYYY")
}
Mmh not sure what going on then...
i'm using vuejs-datepicker how can change its format for save in mysql database because mysql date format is different from vuejs-datepicker
mysql database datepicker Format 2020-15-03
where as in vuejs datepicker format getting Could not parse 'Thu Jun 25 2020 15:31:00 GMT+0500 (Pakistan Standard Time)
I looked at the Github page of this package and it seems that there are some issues with the date formatting.
Can you try this instead in your datepicker
<datepicker
input-class="form-control"
v-model="due_date"
:format="MM-dd-yyyy">
</datepicker>
Note the lower case d and y. This is also according to the docs: https://github.com/charliekassel/vuejs-datepicker#date-formatting
Please or to participate in this conversation.