Spread parameter on setter

This commit is contained in:
Daniel Kluge 2022-04-05 18:43:04 +02:00
parent 6bcd4812a3
commit cc973b4ead
3 changed files with 7 additions and 3 deletions

View File

@ -12,6 +12,9 @@ function daysDifference(date1: Date, date2: Date) {
date2 = date1;
date1 = tmp;
}
console.log("Diff")
console.log(date1)
console.log(date2)
return Math.ceil((date2.getTime() - date1.getTime()) / 1000 / 60 / 60 / 24);
}
@ -83,6 +86,7 @@ const Calendar = ({ secrets }: { secrets: SecretsCalendar }) => {
const timeMin = new Date();
timeMin.setHours(timeMin.getHours() - 1);
console.log(timeMin);
const params = new URLSearchParams({
orderBy: "startTime",
fields: "items(creator,start,summary)",
@ -96,7 +100,7 @@ const Calendar = ({ secrets }: { secrets: SecretsCalendar }) => {
headers: { Authorization: `Bearer ${correctToken}` }
});
const events = await response.json();
setEvents(processEventData(events.items));
setEvents([...processEventData(events.items)]);
}
React.useEffect(() => {

View File

@ -29,7 +29,7 @@ const DVB = ({ stopId }: { stopId: number }) => {
);
});
setDeparturesTable(depTable);
setDeparturesTable([...depTable]);
}
const pullDepartures = async () => {

View File

@ -36,7 +36,7 @@ const News = () => {
)
})
setNews(newsTable);
setNews([...newsTable]);
}
const pullNews = async () => {