From d4ad8d4a9fdc09c66ba8203c4cf2218496442d01 Mon Sep 17 00:00:00 2001 From: Galen Guyer Date: Sat, 14 Nov 2020 10:03:30 -0500 Subject: add latest update date --- package.json | 1 + src/App.js | 4 ++++ yarn.lock | 5 +++++ 3 files changed, 10 insertions(+) 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", diff --git a/src/App.js b/src/App.js index 4abd1e4..74d97be 100644 --- a/src/App.js +++ b/src/App.js @@ -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 (

RIT Covid Dashboard

+

Last Updated: {lastUpdate.toLocaleString(DateTime.DATETIME_FULL)}

diff --git a/yarn.lock b/yarn.lock index 6ff2a88..5b60034 100644 --- a/yarn.lock +++ b/yarn.lock @@ -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" -- cgit v1.2.3