Having an issue with axios. In my application, I have an input field for datetime-local. When I select a date and time, the displayed time is correct (e.g., selecting 10:00 shows as 10:00), but when calling a function using axios.post, the request sends the data with the wrong timezone (axios posts 9:00 instead of 10:00).
Here is a snippet of my code:
Input Field
<input type="datetime-local" class="form-control" id="form-control-classesStart" v-model="newClasse.classesStart">
Function Call
this.newClasse.roomId = this.selectedItem.id
this.axios.post(Linklist.apiClasses, this.newClasse)
.then(response =>{
console.log(response)
this.$store.dispatch('loadClasses') // refresh data from database
})
.catch(err => {
console.log('Something went wrong: ', err)
})
},
You can see: 13:50 instead of 14:50
Any suggestions on how to resolve this issue?
EDIT:
I am considering storing the time in UTC timezone and converting it using a function on the front-end. Is this a good or bad idea?