diff --git a/ui/src/common/LastUsedCell.tsx b/ui/src/common/LastUsedCell.tsx index 45d21999..9103bffa 100644 --- a/ui/src/common/LastUsedCell.tsx +++ b/ui/src/common/LastUsedCell.tsx @@ -1,6 +1,7 @@ import {Typography} from '@mui/material'; import React from 'react'; import TimeAgo from 'react-timeago'; +import {TimeAgoFormatter} from './TimeAgoFormatter'; export const LastUsedCell: React.FC<{lastUsed: string | null}> = ({lastUsed}) => { if (lastUsed === null) { @@ -11,5 +12,5 @@ export const LastUsedCell: React.FC<{lastUsed: string | null}> = ({lastUsed}) => return Recently; } - return ; + return ; }; diff --git a/ui/src/common/TimeAgoFormatter.ts b/ui/src/common/TimeAgoFormatter.ts new file mode 100644 index 00000000..cccc4934 --- /dev/null +++ b/ui/src/common/TimeAgoFormatter.ts @@ -0,0 +1,7 @@ +import {Formatter} from 'react-timeago'; +import {makeIntlFormatter} from 'react-timeago/defaultFormatter'; + +export const TimeAgoFormatter: Record<'long' | 'narrow', Formatter> = { + long: makeIntlFormatter({style: 'long', locale: 'en'}), + narrow: makeIntlFormatter({style: 'narrow', locale: 'en'}), +}; diff --git a/ui/src/message/Message.tsx b/ui/src/message/Message.tsx index e6e6af30..da036528 100644 --- a/ui/src/message/Message.tsx +++ b/ui/src/message/Message.tsx @@ -11,7 +11,7 @@ import {Markdown} from '../common/Markdown'; import * as config from '../config'; import {IMessageExtras} from '../types'; import {contentType, RenderMode} from './extras'; -import {makeIntlFormatter} from 'react-timeago/defaultFormatter'; +import {TimeAgoFormatter} from '../common/TimeAgoFormatter'; const PREVIEW_LENGTH = 500; @@ -248,7 +248,7 @@ const HeaderWide = ({ - + - +
diff --git a/ui/src/typedef/react-timeago.d.ts b/ui/src/typedef/react-timeago.d.ts index bd7acf80..d5d1c4f0 100644 --- a/ui/src/typedef/react-timeago.d.ts +++ b/ui/src/typedef/react-timeago.d.ts @@ -3,6 +3,7 @@ declare module 'react-timeago' { export type FormatterOptions = { style?: 'long' | 'short' | 'narrow'; + locale?: string; }; export type Formatter = (options: FormatterOptions) => React.ReactNode;