I am currently using vue-date-pick@1.4.1
as date picker. The problem is after the user select a date and when the form is submitted, the date changed to be one day difference. I console.log the payload of the payload object before post to the endpoint. This is the value of the payload object for the date.
BirthDate: Tue Jul 06 2010 00:00:00 GMT+0800 (Malaysia Time)
I troubleshoot this by stringify this payload object. After I stringify this payload object, the value becomes
"BirthDate":"2010-07-05T16:00:00.000Z"
This is because my date is set to UTC date? If so, how do I set it to local date?
This is the code.
DatePick.eform--input_datepicker(v-model="BirthDate", :format="'DD/MM/YYYY'")
This is the method which generate the payload.
generatePayload() {
let _obj = { };
Object.keys(eFormModel).forEach(key => {
let value = this.$store.state.eform[key];
_obj[key] = value;
});
// TODO: Remove later
//----------------------------
console.log(_obj);
const jsondata = JSON.stringify(_obj);
console.log(jsondata);
//----------------------------
return _obj;
},
and the model
export let model = {
BirthDate: { value: null, format: 'dateTime', updateRetrieve: formatDate, updateSend: toDate },
}