Fix dates
This commit is contained in:
@ -42,8 +42,6 @@ function ProjectCard({
|
|||||||
function getDisplayedTime(date: Date) {
|
function getDisplayedTime(date: Date) {
|
||||||
const startOfToday = new Date()
|
const startOfToday = new Date()
|
||||||
startOfToday.setHours(0, 0, 0, 0)
|
startOfToday.setHours(0, 0, 0, 0)
|
||||||
// TODO: fix time
|
|
||||||
return ''
|
|
||||||
return date.getTime() < startOfToday.getTime()
|
return date.getTime() < startOfToday.getTime()
|
||||||
? date.toLocaleDateString()
|
? date.toLocaleDateString()
|
||||||
: date.toLocaleTimeString()
|
: date.toLocaleTimeString()
|
||||||
@ -122,7 +120,7 @@ function ProjectCard({
|
|||||||
}`}
|
}`}
|
||||||
</span>
|
</span>
|
||||||
<span className="text-chalkboard-60 text-xs">
|
<span className="text-chalkboard-60 text-xs">
|
||||||
Edited {getDisplayedTime(project.entrypointMetadata.modifiedAt)}
|
Edited {getDisplayedTime(project.entrypointMetadata.mtime)}
|
||||||
</span>
|
</span>
|
||||||
<div className="absolute z-10 bottom-2 right-2 flex gap-1 items-center opacity-0 group-hover:opacity-100 group-focus-within:opacity-100">
|
<div className="absolute z-10 bottom-2 right-2 flex gap-1 items-center opacity-0 group-hover:opacity-100 group-focus-within:opacity-100">
|
||||||
<ActionButton
|
<ActionButton
|
||||||
|
@ -97,7 +97,7 @@ const ProjectSidebarMenu = ({
|
|||||||
data-testid="createdAt"
|
data-testid="createdAt"
|
||||||
>
|
>
|
||||||
Created{' '}
|
Created{' '}
|
||||||
{project.entrypointMetadata.createdAt.toLocaleDateString()}
|
{project.entrypointMetadata.atime?.toLocaleDateString()}
|
||||||
</p>
|
</p>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
|
@ -43,12 +43,12 @@ export function getSortFunction(sortBy: string) {
|
|||||||
a: ProjectWithEntryPointMetadata,
|
a: ProjectWithEntryPointMetadata,
|
||||||
b: ProjectWithEntryPointMetadata
|
b: ProjectWithEntryPointMetadata
|
||||||
) => {
|
) => {
|
||||||
if (a.entrypointMetadata?.modifiedAt && b.entrypointMetadata?.modifiedAt) {
|
if (a.entrypointMetadata?.mtime && b.entrypointMetadata?.mtime) {
|
||||||
return !sortBy || sortBy.includes('desc')
|
return !sortBy || sortBy.includes('desc')
|
||||||
? b.entrypointMetadata.modifiedAt.getTime() -
|
? b.entrypointMetadata.mtime.getTime() -
|
||||||
a.entrypointMetadata.modifiedAt.getTime()
|
a.entrypointMetadata.mtime.getTime()
|
||||||
: a.entrypointMetadata.modifiedAt.getTime() -
|
: a.entrypointMetadata.mtime.getTime() -
|
||||||
b.entrypointMetadata.modifiedAt.getTime()
|
b.entrypointMetadata.mtime.getTime()
|
||||||
}
|
}
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user