Skip to content

Commit

Permalink
fix(frontend): fix last_modified
Browse files Browse the repository at this point in the history
resolves #10
  • Loading branch information
kkkrist committed Mar 2, 2021
1 parent fc33afb commit ca5efb8
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions packages/frontend/src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,15 @@ const getDocs = (docs, areacode, forecast) => {
return forecast ? addPredictions(docs) : docs
}

const getLastModified = data =>
data.reduce((timestamp, doc) => {
const getLastModified = data => {
const now = new Date().getTime()
return data.reduce((timestamp, doc) => {
const last_modified = Date.parse(doc.last_modified)
return last_modified > timestamp ? last_modified : timestamp
return last_modified < now - 3 && last_modified > timestamp
? last_modified
: timestamp
}, 0)
}

const reducer = (state, { type, ...values }) => {
switch (type) {
Expand Down

0 comments on commit ca5efb8

Please sign in to comment.