use js dates for recent cards
This commit is contained in:
@@ -39,18 +39,13 @@ export default function RecentPhoto() {
|
|||||||
console.log(data)
|
console.log(data)
|
||||||
}, [data])
|
}, [data])
|
||||||
|
|
||||||
const parseDate = (date: Date) => {
|
|
||||||
const jsDate = new Date(date);
|
|
||||||
return `${jsDate.getFullYear()}/${jsDate.getMonth() + 1}/${jsDate.getDate()}`;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (data && !loading) {
|
if (data && !loading) {
|
||||||
return (
|
return (
|
||||||
<ProjectComponent
|
<ProjectComponent
|
||||||
url={"https://photos.alexav.gg?id=" + data.id}
|
url={"https://photos.alexav.gg?id=" + data.id}
|
||||||
header={"Photos I've captured"}
|
header={"Photos I've captured"}
|
||||||
projectHeader={data.name}
|
projectHeader={data.name}
|
||||||
projectSubheader={`Taken on ${parseDate(data.dateTaken as Date)}`}
|
projectSubheader={`Taken on ${new Date(data.dateTaken).toLocaleDateString()}`}
|
||||||
projectImage={data.imageUrl}
|
projectImage={data.imageUrl}
|
||||||
projectImageSize={"85"}
|
projectImageSize={"85"}
|
||||||
/>
|
/>
|
||||||
|
|||||||
@@ -44,15 +44,11 @@ export default function RecentWatch() {
|
|||||||
})
|
})
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
const parseDate = (date: Date) => {
|
|
||||||
const jsDate = new Date(date);
|
|
||||||
return `${jsDate.getFullYear()}/${jsDate.getMonth() + 1}/${jsDate.getDate()}`;
|
|
||||||
}
|
|
||||||
const getSubheaderText = () => {
|
const getSubheaderText = () => {
|
||||||
if (data?.finished) {
|
if (data?.finished) {
|
||||||
return "Finished!"
|
return "Finished!"
|
||||||
} else if (data?.startedOn) {
|
} else if (data?.startedOn) {
|
||||||
return "Started on " + parseDate(data.startedOn)
|
return "Started on " + new Date(data.startedOn).toLocaleDateString()
|
||||||
} else {
|
} else {
|
||||||
return "Just Added"
|
return "Just Added"
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user