diff --git a/src/components/ProjectComponents/RecentBook.tsx b/src/components/ProjectComponents/RecentBook.tsx index 7f054a0..27282cb 100644 --- a/src/components/ProjectComponents/RecentBook.tsx +++ b/src/components/ProjectComponents/RecentBook.tsx @@ -43,9 +43,15 @@ export default function RecentBook() { }) }, []); - const parseDate = (date: Date) => { - const jsDate = new Date(date); - return `${jsDate.getFullYear()}/${jsDate.getMonth() + 1}/${jsDate.getDate()}`; + const getDateString = (startedOn: Date, finished: boolean) => { + if (startedOn && !finished) { + const startedOnDate = new Date(startedOn); + return "Started on " + startedOnDate.toLocaleDateString(); + } else if (finished) { + return "Finished!" + } else { + return "Just Added" + } } if (data && !loading) { @@ -53,7 +59,7 @@ export default function RecentBook() { { if (res.ok) { - console.log("ok!") const json = await res.json() setData(json.data[0]); setLoading(false) } else { - console.log("not ok :(") setErrorState("Failed to fetch data!"); setLoading(false); }