mirror of
https://github.com/docmost/docmost.git
synced 2025-11-14 05:11:12 +10:00
fixes
This commit is contained in:
@ -1,10 +1,10 @@
|
||||
import { Text, Group, Stack, UnstyledButton, Divider } from "@mantine/core";
|
||||
import { format } from "date-fns";
|
||||
import classes from "./home.module.css";
|
||||
import { Link } from "react-router-dom";
|
||||
import PageListSkeleton from "@/features/home/components/page-list-skeleton";
|
||||
import { useRecentChangesQuery } from "@/features/page/queries/page-query";
|
||||
import { buildPageSlug } from "@/features/page/page.utils.ts";
|
||||
import { formattedDate } from "@/lib/time.ts";
|
||||
|
||||
function RecentChanges() {
|
||||
const { data, isLoading, isError } = useRecentChangesQuery();
|
||||
@ -35,7 +35,7 @@ function RecentChanges() {
|
||||
</Stack>
|
||||
|
||||
<Text c="dimmed" size="xs" fw={500}>
|
||||
{format(new Date(page.updatedAt), "PP")}
|
||||
{formattedDate(page.updatedAt)}
|
||||
</Text>
|
||||
</Group>
|
||||
</UnstyledButton>
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
import { Text, Group, UnstyledButton } from "@mantine/core";
|
||||
import { UserAvatar } from "@/components/ui/user-avatar";
|
||||
import { formatDate } from "@/lib/time";
|
||||
import { formattedDate } from "@/lib/time";
|
||||
import classes from "./history.module.css";
|
||||
import clsx from "clsx";
|
||||
|
||||
@ -19,7 +19,9 @@ function HistoryItem({ historyItem, onSelect, isActive }: HistoryItemProps) {
|
||||
>
|
||||
<Group wrap="nowrap">
|
||||
<div>
|
||||
<Text size="sm">{formatDate(new Date(historyItem.createdAt))}</Text>
|
||||
<Text size="sm">
|
||||
{formattedDate(new Date(historyItem.createdAt))}
|
||||
</Text>
|
||||
|
||||
<div style={{ flex: 1 }}>
|
||||
<Group gap={4} wrap="nowrap">
|
||||
|
||||
@ -1,16 +1,16 @@
|
||||
import { formatDistanceStrict } from 'date-fns';
|
||||
import { format, isToday, isYesterday } from 'date-fns';
|
||||
import { formatDistanceStrict } from "date-fns";
|
||||
import { format, isToday, isYesterday } from "date-fns";
|
||||
|
||||
export function timeAgo(date: Date) {
|
||||
return formatDistanceStrict(new Date(date), new Date(), { addSuffix: true });
|
||||
}
|
||||
|
||||
export function formatDate(date: Date) {
|
||||
export function formattedDate(date: Date) {
|
||||
if (isToday(date)) {
|
||||
return `Today, ${format(date, 'h:mma')}`;
|
||||
return `Today, ${format(date, "h:mma")}`;
|
||||
} else if (isYesterday(date)) {
|
||||
return `Yesterday, ${format(date, 'h:mma')}`;
|
||||
return `Yesterday, ${format(date, "h:mma")}`;
|
||||
} else {
|
||||
return format(date, 'MMM dd, yyyy, h:mma');
|
||||
return format(date, "MMM dd, yyyy, h:mma");
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user