feat: display latest update datetime
This commit is contained in:
@@ -127,4 +127,15 @@ export const formatTime = (
|
|||||||
second: options?.keepSeconds ? "numeric" : undefined,
|
second: options?.keepSeconds ? "numeric" : undefined,
|
||||||
}).format(new Date(time));
|
}).format(new Date(time));
|
||||||
};
|
};
|
||||||
|
export const formatDateShort = (time : number | string) => {
|
||||||
|
const date = new Date(time);
|
||||||
|
const padZero = (num :number) => num.toString().padStart(2, '0');
|
||||||
|
|
||||||
|
const month = padZero(date.getMonth() + 1); // Months are zero-indexed
|
||||||
|
const day = padZero(date.getDate());
|
||||||
|
const year = date.getFullYear();
|
||||||
|
const hours = padZero(date.getHours());
|
||||||
|
const minutes = padZero(date.getMinutes());
|
||||||
|
|
||||||
|
return `${month}.${day}.${year} ${hours}:${minutes}`;
|
||||||
|
};
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ import RouterServices from '@features/router/services/router-service';
|
|||||||
import useRouteState from 'app/features/router/hooks/use-route-state';
|
import useRouteState from 'app/features/router/hooks/use-route-state';
|
||||||
import { DocumentIcon } from './document-icon';
|
import { DocumentIcon } from './document-icon';
|
||||||
import { hasAnyPublicLinkAccess } from '@features/files/utils/access-info-helpers';
|
import { hasAnyPublicLinkAccess } from '@features/files/utils/access-info-helpers';
|
||||||
|
import { formatDateShort } from 'app/features/global/utils/Numbers';
|
||||||
|
|
||||||
export const DocumentRow = ({
|
export const DocumentRow = ({
|
||||||
item,
|
item,
|
||||||
@@ -80,11 +81,12 @@ export const DocumentRow = ({
|
|||||||
<Base className="flex maxWidth100">{item.name}</Base>
|
<Base className="flex maxWidth100">{item.name}</Base>
|
||||||
</div>
|
</div>
|
||||||
<div className="shrink-0 ml-4">
|
<div className="shrink-0 ml-4">
|
||||||
{hasAnyPublicLinkAccess(item) && (
|
{hasAnyPublicLinkAccess(item) && <PublicIcon className="h-5 w-5 text-blue-500" />}
|
||||||
<PublicIcon className="h-5 w-5 text-blue-500" />
|
|
||||||
)}
|
|
||||||
</div>
|
</div>
|
||||||
<div className="shrink-0 ml-4 text-right minWidth80">
|
<div className="shrink-0 ml-4 mr-12">
|
||||||
|
<BaseSmall>{formatDateShort(item?.last_version_cache?.date_added)}</BaseSmall>
|
||||||
|
</div>
|
||||||
|
<div className="shrink-0 ml-4 text-right lg:w-24 sm:w-20 ">
|
||||||
<BaseSmall>{formatBytes(item.size)}</BaseSmall>
|
<BaseSmall>{formatBytes(item.size)}</BaseSmall>
|
||||||
</div>
|
</div>
|
||||||
<div className="shrink-0 ml-4">
|
<div className="shrink-0 ml-4">
|
||||||
@@ -101,10 +103,7 @@ export const DocumentRow = ({
|
|||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
export const DocumentRowOverlay = ({
|
export const DocumentRowOverlay = ({ item, className }: DriveItemOverlayProps) => {
|
||||||
item,
|
|
||||||
className,
|
|
||||||
}: DriveItemOverlayProps) => {
|
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
className={
|
className={
|
||||||
@@ -116,5 +115,5 @@ export const DocumentRowOverlay = ({
|
|||||||
<Base>{item?.name}</Base>
|
<Base>{item?.name}</Base>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
)}
|
);
|
||||||
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user