diff options
author | Galen Guyer <galen@galenguyer.com> | 2020-11-14 10:03:30 -0500 |
---|---|---|
committer | Galen Guyer <galen@galenguyer.com> | 2020-11-14 10:03:30 -0500 |
commit | d4ad8d4a9fdc09c66ba8203c4cf2218496442d01 (patch) | |
tree | 29380af7b5f296a372215773610971c13830154f | |
parent | 01e9ba26136c351793f41c99e85f3caddfca8c81 (diff) |
add latest update date
-rw-r--r-- | package.json | 1 | ||||
-rw-r--r-- | src/App.js | 4 | ||||
-rw-r--r-- | yarn.lock | 5 |
3 files changed, 10 insertions, 0 deletions
diff --git a/package.json b/package.json index 60803d4..80e0062 100644 --- a/package.json +++ b/package.json @@ -6,6 +6,7 @@ "@testing-library/jest-dom": "^5.11.4", "@testing-library/react": "^11.1.0", "@testing-library/user-event": "^12.1.10", + "luxon": "^1.25.0", "prettier": "^2.1.2", "react": "^17.0.1", "react-dom": "^17.0.1", @@ -1,4 +1,5 @@ import useSWR from "swr"; +import { DateTime } from "luxon"; import Card from "./Card"; import "./App.css"; @@ -24,10 +25,13 @@ function App() { const latest = data[data.length - 1]; const prior = data[data.length - 2]; + const local = DateTime.local().zoneName; + const lastUpdate = DateTime.fromSQL(latest.last_updated, { zone: "UTC" }).setZone(local); return ( <div className="App"> <h1>RIT Covid Dashboard</h1> + <h3>Last Updated: {lastUpdate.toLocaleString(DateTime.DATETIME_FULL)}</h3> <div className="Section"> <Card name="Total Student Cases" latest={latest.total_students} prior={prior.total_students} /> <Card name="Total Staff Cases" latest={latest.total_staff} prior={prior.total_staff} /> @@ -6932,6 +6932,11 @@ lru-cache@^6.0.0: dependencies: yallist "^4.0.0" +luxon@^1.25.0: + version "1.25.0" + resolved "https://registry.yarnpkg.com/luxon/-/luxon-1.25.0.tgz#d86219e90bc0102c0eb299d65b2f5e95efe1fe72" + integrity sha512-hEgLurSH8kQRjY6i4YLey+mcKVAWXbDNlZRmM6AgWDJ1cY3atl8Ztf5wEY7VBReFbmGnwQPz7KYJblL8B2k0jQ== + lz-string@^1.4.4: version "1.4.4" resolved "https://registry.yarnpkg.com/lz-string/-/lz-string-1.4.4.tgz#c0d8eaf36059f705796e1e344811cf4c498d3a26" |