Skip to content

Commit 0ac515f

Browse files
committed
fix: minutes granularity for client elevation
The types aren't needed, and are provided by the package.
1 parent a5fc2bc commit 0ac515f

3 files changed

Lines changed: 10 additions & 24 deletions

File tree

ui/src/client/Clients.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ const Row = ({name, value, lastUsed, elevatedUntil, fEdit, fDelete, fElevate}: I
136136
</TableCell>
137137
<TableCell>
138138
{elevatedUntil && Date.parse(elevatedUntil) > Date.now() ? (
139-
<TimeAgo date={elevatedUntil} formatter={TimeAgoFormatter.long} />
139+
<TimeAgo date={elevatedUntil} formatter={TimeAgoFormatter.longMinutes} />
140140
) : (
141141
'-'
142142
)}

ui/src/common/TimeAgoFormatter.ts

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,13 @@
11
import {Formatter} from 'react-timeago';
22
import {makeIntlFormatter} from 'react-timeago/defaultFormatter';
33

4-
export const TimeAgoFormatter: Record<'long' | 'narrow', Formatter> = {
5-
long: makeIntlFormatter({style: 'long', locale: 'en'}),
4+
const longFormatter = makeIntlFormatter({style: 'long', locale: 'en'});
5+
6+
const longMinutesFormatter: Formatter = (value, unit, ...rest) =>
7+
unit === 'second' ? longFormatter(1, 'minute', ...rest) : longFormatter(value, unit, ...rest);
8+
9+
export const TimeAgoFormatter = {
10+
long: longFormatter,
611
narrow: makeIntlFormatter({style: 'narrow', locale: 'en'}),
7-
};
12+
longMinutes: longMinutesFormatter,
13+
} as const satisfies Record<string, Formatter>;

ui/src/typedef/react-timeago.d.ts

Lines changed: 0 additions & 20 deletions
This file was deleted.

0 commit comments

Comments
 (0)