samedi 3 juillet 2021

Date format changing in vue.js

I'm using date picker :

 <Datepicker :format="format"  v-model="form.start" name="start"></Datepicker>

Its format is something like this :

data(){
        return {
            format: "dd-MM-yyyy",
            form: new Form({
                id:'',
                start: '',

Now on form submit i have appended it to form Data like this

let formData = new FormData();
formData.append('start', this.form.start);

When i console i get date something like this Sat Jul 03 2021 19:11:00 GMT+0530 (India Standard Time)

In the controller i am validating date like :

public function store(Request $request)
    {   
        $this->validate($request, [
            'start' => 'required|date|after_or_equal:'.now()->format('d-m-Y'),

Output:

The start is not a valid date

Any help is highly appreciated.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire