Summer Sale! All accounts are 50% off this week.

Spiral's avatar

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")
            }
0 likes
5 replies
Spiral's avatar

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")
}
Spiral's avatar

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)

Please or to participate in this conversation.