diff options
author | Nate Sesti <33237525+sestinj@users.noreply.github.com> | 2023-08-23 14:44:33 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-08-23 14:44:33 -0700 |
commit | 0c563fc28fefa0cd7181fd78c579c3a86faaa4f9 (patch) | |
tree | b67514fc49c7d19821d1a7f03579259b2948cc48 /extension/react-app/src/pages | |
parent | c5211c2cd69f368cc564aad155080957b754de19 (diff) | |
download | sncontinue-0c563fc28fefa0cd7181fd78c579c3a86faaa4f9.tar.gz sncontinue-0c563fc28fefa0cd7181fd78c579c3a86faaa4f9.tar.bz2 sncontinue-0c563fc28fefa0cd7181fd78c579c3a86faaa4f9.zip |
Testing gh workflow (#401)
* testing
* logging again
* log home dir
* build m1 script
* correctly parse dates in history.tsx
* logging
* add redbaron to requirements.txt
* tweaks before merging to main
Diffstat (limited to 'extension/react-app/src/pages')
-rw-r--r-- | extension/react-app/src/pages/history.tsx | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/extension/react-app/src/pages/history.tsx b/extension/react-app/src/pages/history.tsx index edf4d39f..2eb895b1 100644 --- a/extension/react-app/src/pages/history.tsx +++ b/extension/react-app/src/pages/history.tsx @@ -14,6 +14,14 @@ const Tr = styled.tr` } `; +const parseDate = (date: string): Date => { + let dateObj = new Date(date); + if (isNaN(dateObj.getTime())) { + dateObj = new Date(parseInt(date) * 1000); + } + return dateObj; +}; + const TdDiv = styled.div` cursor: pointer; padding-left: 1rem; @@ -46,6 +54,8 @@ function History() { fetchSessions(); }, [client]); + console.log(sessions.map((session) => session.date_created)); + return ( <div className="w-full"> <div className="items-center flex"> @@ -60,7 +70,11 @@ function History() { <table className="w-full"> <tbody> {sessions - .sort((a, b) => parseInt(b.date_created) - parseInt(a.date_created)) + .sort( + (a, b) => + parseDate(b.date_created).getTime() - + parseDate(a.date_created).getTime() + ) .map((session, index) => ( <Tr key={index}> <td> @@ -72,9 +86,7 @@ function History() { > <div className="text-lg">{session.title}</div> <div className="text-gray-400"> - {new Date( - parseInt(session.date_created) * 1000 - ).toLocaleString("en-US", { + {parseDate(session.date_created).toLocaleString("en-US", { weekday: "short", year: "numeric", month: "long", |