I have a problem with the Date Class. It should take a parameter (wheres a timestamp in) and output the right day of month and the month. But it always shows something like 02.06. Everything from past month instead of current Date.
Here is my part where I pass Timestamp to getter
<workCard v-if="services_getSort(sortServicesBy).length > 0" v-for="i in services_getSort(sortServicesBy).data" :key="i.source">
<div slot="content" class="d-flex justify-content-between ">
<router-link :to="'/services/' + i">
<div style="min-width:4.0rem" class="pr-1 align-items-center">
<span style="color:black;"><i class="fas fa-calendar-alt fa-md"></i> {{outputDateOnly(i.start)}}</span>
<br>
<span style="color:darkblue"><i class="fas fa-clock fa-md"></i> {{outputTimeOnly(i.start)}}</span>
</div>
</router-link>
<div class="p-1 d-flex mt-2">
<span style="color:black">></span>
</div>
<div style="min-width:4.0rem" class="align-items-center">
<span v-if="i.end != ''">
<span style="color:black;"><i class="fas fa-calendar-alt fa-md"></i> {{outputDateOnly(i.end)}}</span>
<br>
<span style="color:darkblue"><i class="fas fa-clock fa-md"></i> {{outputTimeOnly(i.end)}}</span>
</span>
<i v-if="i.end == ''" class="fas mt-3 fa-infinity fa-md"></i>
</div>
And here is my getter function which should handle this raw timestamp
export const outputDateOnly = (state, getters) => {
return payload => {
let check = getters.zeroCheck;
let date = new Date(payload)
console.log(payload);
console.log(`${date.getDay()}.${date.getMonth()}`);
return `${date.getDay().toString()}.${date.getMonth().toString()}`
}
}
My Timestamp Format comes from HTML input type="date" and looks like this 2018-07-17T10:10
I hope someone knows the solution