Fixed Date issues
This commit is contained in:
@@ -57,17 +57,17 @@ export const useOrdersStore = defineStore('orders', () => {
|
|||||||
|
|
||||||
async function getOrderDates() {
|
async function getOrderDates() {
|
||||||
const tempDates = new Array<Date>();
|
const tempDates = new Array<Date>();
|
||||||
tempDates.push(...await fetchDates(0));
|
for (let i = 0; i <= 11; i++) {
|
||||||
tempDates.push(...await fetchDates(1));
|
tempDates.push(...await fetchDates(i));
|
||||||
tempDates.push(...await fetchDates(2));
|
}
|
||||||
dates.value = tempDates;
|
dates.value = tempDates;
|
||||||
console.log(dates.value);
|
console.log(dates.value);
|
||||||
}
|
}
|
||||||
|
|
||||||
async function fetchDates(offset : number) {
|
async function fetchDates(offset : number) {
|
||||||
const date = new Date(Date.now());
|
const date = new Date(Date.now());
|
||||||
date.setMonth(offset + 1);
|
date.setMonth(offset );
|
||||||
const urlString = "/kalendarz/" + Number(date.getFullYear()) + "-" + Number(date.getMonth());
|
const urlString = "/kalendarz/" + Number(date.getFullYear()) + "-" + Number(date.getMonth()+1);
|
||||||
const response = await axiosInstance.get(urlString, {withCredentials: true});
|
const response = await axiosInstance.get(urlString, {withCredentials: true});
|
||||||
const datesTemp :Array<Date> = response.data;
|
const datesTemp :Array<Date> = response.data;
|
||||||
return datesTemp;
|
return datesTemp;
|
||||||
|
|||||||
Reference in New Issue
Block a user