Skip to content

Commit

Permalink
add UTC timestamp to tags list and notifications
Browse files Browse the repository at this point in the history
  • Loading branch information
petermakowski committed Apr 4, 2024
1 parent b12c5cc commit b62929e
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import {
isUpgradeNotification,
} from "@/app/store/notification/utils";
import type { RootState } from "@/app/store/root/types";
import { getUtcTimestamp } from "@/app/utils/time";

type Props = {
className?: string | null;
Expand All @@ -31,6 +32,7 @@ const NotificationGroupNotification = ({
const notification = useSelector((state: RootState) =>
notificationSelectors.getById(state, id)
);
const createdTimestamp = getUtcTimestamp(notification?.created);
if (!notification) {
return null;
}
Expand Down Expand Up @@ -59,7 +61,7 @@ const NotificationGroupNotification = ({
: undefined
}
severity={severity}
timestamp={showDate ? notification.created : null}
timestamp={showDate ? createdTimestamp : null}
>
<span
dangerouslySetInnerHTML={{ __html: notification.message }}
Expand Down
3 changes: 2 additions & 1 deletion src/app/tags/views/TagList/TagTable/TagTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import type { Tag } from "@/app/store/tag/types";
import { TagMeta } from "@/app/store/tag/types";
import AppliedTo from "@/app/tags/components/AppliedTo";
import { isComparable } from "@/app/utils";
import { getUtcTimestamp } from "@/app/utils/time";

type Props = PropsWithSpread<
{
Expand Down Expand Up @@ -75,7 +76,7 @@ const generateRows = (
},
{
"aria-label": Label.Updated,
content: tag.updated,
content: getUtcTimestamp(tag.updated),
},
{
"aria-label": Label.Auto,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import AppliedTo from "@/app/tags/components/AppliedTo";
import DefinitionField from "@/app/tags/components/DefinitionField";
import KernelOptionsField from "@/app/tags/components/KernelOptionsField";
import { Label } from "@/app/tags/views/TagDetails";
import { getUtcTimestamp } from "@/app/utils/time";

type Props = {
id: Tag[TagMeta.PK];
Expand Down Expand Up @@ -39,7 +40,10 @@ export const TagUpdateFormFields = ({ id }: Props): JSX.Element | null => {
/>
</Col>
<Col size={12}>
<Definition description={tag.updated} label={Label.Update} />
<Definition
description={getUtcTimestamp(tag.updated)}
label={Label.Update}
/>
</Col>
<Col size={12}>
<Definition label={Label.AppliedTo}>
Expand Down

0 comments on commit b62929e

Please sign in to comment.