'Getting wrong date when using date picker
I'm using this date picker Date Picker, and when I select a day and then it gets saved, it saves the previous day and not the day I selected.
For my backend code it's the normal laravel update method.
Here is my code
<template>
<div>
<div class="row">
<label>Project Start</label>
<date-picker v-model="startDate" type="date" format="MM-DD-YYYY" placeholder="mm-dd-yyyy"></date-picker>
</div>
<button type="button" class="btn btn-success" @click="save">Save</button>
</div>
</template>
<script>
import Vue from 'vue'
import DatePicker from 'vue2-datepicker';
import 'vue2-datepicker/index.css';
export default {
props: ['project'],
components: {
DatePicker
},
data() {
return {
startDate: null
}
},
computed: {
},
methods: {
save(){
axios.put(`/api/project/${this.project.id}`, {
startDate: this.startDate
}).then(response => {
});
}
},
beforeMount() {
},
mounted(){
}
}
</script>
<style>
.mx-datepicker{
width: auto;
}
</style>
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
