Skip to content

Commit

Permalink
remove formatShortDate from S3 and delete formatshortDate function
Browse files Browse the repository at this point in the history
  • Loading branch information
JeanMarcMilletScality committed Apr 10, 2024
1 parent ac081a3 commit 7212839
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 15 deletions.
20 changes: 18 additions & 2 deletions src/react/databrowser/objects/details/Properties.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,15 @@ function Properties({ objectMetadata }: Props) {
Locked <Icon name="Lock" /> (
{objectMetadata.objectRetention.mode.toLowerCase()})
<br />
until {objectMetadata.objectRetention.retainUntilDate}
until{' '}
<FormattedDateTime
format="date-time-second"
value={
new Date(
objectMetadata.objectRetention.retainUntilDate,
)
}
/>
</>
)
}
Expand All @@ -220,7 +228,15 @@ function Properties({ objectMetadata }: Props) {
<>
Released <Icon name="Lock-open" />
<br />
since {objectMetadata.objectRetention.retainUntilDate}
since{' '}
<FormattedDateTime
format="date-time-second"
value={
new Date(
objectMetadata.objectRetention.retainUntilDate,
)
}
/>
</>
)
}
Expand Down
13 changes: 5 additions & 8 deletions src/react/reducers/s3.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import {
import {
METADATA_SYSTEM_TYPE,
METADATA_USER_TYPE,
formatShortDate,
stripQuotes,
systemMetadataKeys,
} from '../utils';
Expand Down Expand Up @@ -40,7 +39,7 @@ const objects = (objs, prefix): Array<ObjectEntity> =>
return {
name: o.Key.replace(prefix, ''),
key: o.Key,
lastModified: formatShortDate(new Date(o.LastModified)),
lastModified: o.LastModified,
size: o.Size,
isFolder: false,
toggled: false,
Expand Down Expand Up @@ -90,10 +89,8 @@ const _getObjectLockInformation = (
? {
//@ts-expect-error fix this when you are working on it
mode: o.ObjectRetention.Mode,
retainUntilDate: formatShortDate(
//@ts-expect-error fix this when you are working on it
new Date(o.ObjectRetention.RetainUntilDate),
),
//@ts-expect-error fix this when you are working on it
retainUntilDate: o.ObjectRetention.RetainUntilDate,
}
: undefined,
};
Expand All @@ -104,7 +101,7 @@ const search = (objs): Array<ObjectEntity> => {
return {
name: o.Key,
key: o.Key,
lastModified: formatShortDate(new Date(o.LastModified)),
lastModified: o.LastModified,
size: o.Size,
isFolder: o.IsFolder,
isLatest: true,
Expand All @@ -129,7 +126,7 @@ const versioning = (
return {
name: o.Key.replace(prefix, ''),
key: o.Key,
lastModified: formatShortDate(new Date(o.LastModified)),
lastModified: o.LastModified,
size: o.Size || null,
isFolder: false,
isLatest: o.IsLatest,
Expand Down
5 changes: 0 additions & 5 deletions src/react/utils/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,6 @@ export function errorParser(error) {
export function formatDate(d) {
return `${d.toDateString()} ${d.toTimeString().split(' ')[0]}`;
}
export function formatShortDate(d: Date) {
const date = DateTime.fromISO(d?.toISOString()).toISODate();
const time = DateTime.fromISO(d?.toISOString()).toFormat('TT');
return `${date} ${time}`;
}
export function formatSimpleDate(d) {
return d.toISOString().split('T')[0];
}
Expand Down

0 comments on commit 7212839

Please sign in to comment.