Currently, my Vue Datepicker is functional in that it allows the selection of date and logs it within the console. However, the issue I am facing is that it logs the date as
Fri Oct 18 2019 15:01:00 GMT-0400
, whereas I specifically need only the formatted date portion like 2019-10-18
.
I have been trying to use the customFormatter function in the vuejs-datepicker
library but so far, nothing seems to be working:
customFormatter(date) {
return moment(date).format('MMMM Do YYYY, h:mm:ss a');
}
What could possibly be going wrong with my approach?
<datepicker :value="date" @selected="CallDateFunction"></datepicker>
date(){
return {
date: '',
...
CallDateFunction(date){
console.log(date);
}