Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Moar <FormattedDateString> #1450

Merged
merged 4 commits into from
Oct 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 6 additions & 11 deletions moped-editor/src/views/projects/projectView/ProjectActivityLog.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import { Alert } from "@mui/material";
import ApolloErrorHandler from "../../../components/ApolloErrorHandler";
import CDNAvatar from "../../../components/CDN/Avatar";
import typography from "src/theme/typography";
import { formatRelativeDate } from "src/utils/dateAndTime";
import { FormattedDateString } from "src/utils/dateAndTime";
import { getUserFullName, getInitials } from "../../../utils/userNames";
import ProjectActivityEntry from "./ProjectActivityEntry";

Expand Down Expand Up @@ -285,16 +285,11 @@ const ProjectActivityLog = () => {
className={classes.tableCell}
style={{ whiteSpace: "nowrap" }}
>
<span>
{change.created_at
? formatRelativeDate(change.created_at)
: ""}
</span>
<span className={classes.mutedDate}>
{change.created_at
? new Date(change.created_at).toLocaleString()
: ""}
</span>
<FormattedDateString
date={change.created_at}
primary="relative"
secondary="absolute"
/>
</TableCell>
</TableRow>
);
Expand Down
13 changes: 2 additions & 11 deletions moped-editor/src/views/projects/projectView/ProjectFiles.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,7 @@ import {
} from "../../../queries/project";
import { getJwt, useUser } from "../../../auth/user";
import downloadFileAttachment from "../../../utils/downloadFileAttachment";
import {
formatTimeStampTZType,
makeFullTimeFromTimeStampTZ,
} from "src/utils/dateAndTime";
import { FormattedDateString } from "src/utils/dateAndTime";
import { isValidUrl } from "src/utils/urls";
import ProjectFilesToolbar from "./ProjectFilesToolbar";
import DataGridTextField from "./DataGridTextField";
Expand Down Expand Up @@ -184,13 +181,7 @@ const useColumns = ({
field: "created_at",
width: 200,
renderCell: ({ value }) => (
<span>
{value
? `${formatTimeStampTZType(value)}, ${makeFullTimeFromTimeStampTZ(
value
)}`
: "N/A"}
</span>
<FormattedDateString date={value} primary="relative" secondary="absolute" />
),
},
{
Expand Down
12 changes: 9 additions & 3 deletions moped-editor/src/views/projects/projectsListView/helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { useMemo } from "react";
import { NavLink as RouterLink, useLocation } from "react-router-dom";
import Link from "@mui/material/Link";
import parse from "html-react-parser";
import { formatDateType, formatTimeStampTZType } from "src/utils/dateAndTime";
import { formatDateType, FormattedDateString } from "src/utils/dateAndTime";
import ExternalLink from "../../../components/ExternalLink";
import ProjectStatusBadge from "../projectView/ProjectStatusBadge";
import RenderSignalLink from "../../../components/RenderSignalLink";
Expand Down Expand Up @@ -246,8 +246,14 @@ export const useColumns = ({ hiddenColumns }) => {
headerName: "Modified",
description: "Date record was last modified",
field: "updated_at",
valueFormatter: (value) => formatTimeStampTZType(value),
width: COLUMN_WIDTHS.small,
width: COLUMN_WIDTHS.medium,
renderCell: ({ row }) => (
<FormattedDateString
date={row.updated_at}
primary="relative"
secondary="absolute"
/>
),
},
{
headerName: "Signal IDs",
Expand Down