Skip to content

Commit

Permalink
Fix update check
Browse files Browse the repository at this point in the history
  • Loading branch information
merlinschumacher authored May 30, 2024
1 parent 89d34d3 commit 79bf923
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions wwwroot/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -224,14 +224,14 @@ async function loadUpdatedData() {
const currentUpdate = new Date(await updateRequest.text());
const lastKnownUpdate = new Date(localStorage.getItem('updateTime'));
var data = localStorage.getItem('eventData');
if (currentUpdate < lastKnownUpdate || data == null) {
if (currentUpdate > lastKnownUpdate || data == null) {
localStorage.setItem('updateTime', currentUpdate);
eventRequest = await fetch('/data/events.json');
data = await eventRequest.text();
localStorage.setItem('eventData', data);
}
let lastUpdate = document.getElementById('lastUpdate');
lastUpdate.textContent = currentUpdate.toLocaleString();
lastUpdate.textContent = new Date(localStorage.getItem('updateTime')).ToLocaleString();
getEventSources(JSON.parse(data));
}

Expand Down

0 comments on commit 79bf923

Please sign in to comment.