Misc fixes from qa pass (#5650)

This commit is contained in:
Tom Moor
2023-08-04 23:40:36 -04:00
committed by GitHub
parent 80acc16791
commit 042ea7b61f
11 changed files with 96 additions and 54 deletions

View File

@@ -1,5 +1,5 @@
import { formatDistanceToNow } from "date-fns";
import * as React from "react";
import { dateToRelative } from "@shared/utils/date";
import lazyWithRetry from "~/utils/lazyWithRetry";
const LocaleTime = lazyWithRetry(() => import("~/components/LocaleTime"));
@@ -9,17 +9,11 @@ type Props = React.ComponentProps<typeof LocaleTime> & {
};
function Time({ onClick, ...props }: Props) {
let content = formatDistanceToNow(Date.parse(props.dateTime), {
const content = dateToRelative(Date.parse(props.dateTime), {
addSuffix: props.addSuffix,
shorten: props.shorten,
});
if (props.shorten) {
content = content
.replace("about", "")
.replace("less than a minute ago", "just now")
.replace("minute", "min");
}
return (
<span onClick={onClick}>
<React.Suspense