You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
PMM-15326: Put the OM plugin on date-fns and plugin-react
Two review notes on #5817, both about using what the monorepo already has.
`vitest.config.ts` used `@vitejs/plugin-react-swc`. `main` moved to
`@vitejs/plugin-react` and vite itself now prints the recommendation on
every run, so this package follows. Only this package - the rest of the
tree is not this PR's to move.
`format.ts` hand-rolled parsing and date arithmetic that date-fns does,
and date-fns is already a dependency of `apps/pmm`. Parsing, validity
and differences now come from `parseISO`, `isValid`,
`differenceInMilliseconds` and `format`.
The compact duration formatter stays, and is renamed
`formatCompactDuration` to say why. Its callers are table cells and
chips that need `2d 3h`; date-fns' `formatDuration` emits
`2 days 3 hours`, and the short form needs a custom
`locale.formatDistance` - more code than the arithmetic it replaces.
The rename also ends a collision with date-fns' export of the same
name, so a file can now import both.
Two behaviours worth naming. `formatTimestamp` moves from
`toLocaleString()` to a fixed `yyyy-MM-dd HH:mm:ss` in local time: run
timestamps are read down a column, and a format that varies by locale
is not a column anyone can scan. `formatAge` deliberately does not use
`formatDistanceToNowStrict`, which rounds to one unit - these columns
have to distinguish `1h 12m` from `1h 58m`.
Signed-off-by: Pawel Lebioda <pawel.lebioda@percona.com>
0 commit comments