ImagesTable: show detailed time when hovering over the "Updated" column
This commit is contained in:
parent
baf58829eb
commit
c1d6053083
2 changed files with 27 additions and 1 deletions
|
|
@ -66,6 +66,7 @@ import { resolveRelPath } from '../../Utilities/path';
|
|||
import {
|
||||
computeHoursToExpiration,
|
||||
timestampToDisplayString,
|
||||
timestampToDisplayStringDetailed,
|
||||
} from '../../Utilities/time';
|
||||
import { useExperimentalFlag } from '../../Utilities/useExperimentalFlag';
|
||||
|
||||
|
|
@ -469,7 +470,10 @@ const Row = ({
|
|||
}}
|
||||
/>
|
||||
<Td dataLabel="Image name">{compose.image_name || compose.id}</Td>
|
||||
<Td dataLabel="Created">
|
||||
<Td
|
||||
dataLabel="Created"
|
||||
title={timestampToDisplayStringDetailed(compose.created_at)}
|
||||
>
|
||||
{timestampToDisplayString(compose.created_at)}
|
||||
</Td>
|
||||
<Td dataLabel="Release">
|
||||
|
|
|
|||
|
|
@ -57,6 +57,28 @@ export const timestampToDisplayString = (ts?: string) => {
|
|||
return tsDisplay;
|
||||
};
|
||||
|
||||
export const timestampToDisplayStringDetailed = (ts?: string) => {
|
||||
// Detailed representation including time and time zone
|
||||
if (!ts) {
|
||||
return '';
|
||||
}
|
||||
|
||||
const ms = Date.parse(ts);
|
||||
const options: Intl.DateTimeFormatOptions = {
|
||||
year: 'numeric',
|
||||
month: 'short',
|
||||
day: 'numeric',
|
||||
hour: 'numeric',
|
||||
minute: 'numeric',
|
||||
second: 'numeric',
|
||||
hour12: false,
|
||||
timeZoneName: 'short',
|
||||
};
|
||||
|
||||
const tsDisplay = new Intl.DateTimeFormat('en-US', options).format(ms);
|
||||
return tsDisplay;
|
||||
};
|
||||
|
||||
export const convertStringToDate = (createdAtAsString: string = '') => {
|
||||
if (isNaN(Date.parse(createdAtAsString))) {
|
||||
// converts property created_at of the image object from string to UTC
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue