From 76bf459ff2bb431d8515943ca3ea9df07165da5b Mon Sep 17 00:00:00 2001 From: Paul Date: Tue, 3 Jun 2025 15:30:38 -0700 Subject: [PATCH] fix(ui): formatDate and formatTimeToNow utility type error on i18n arg to support I18nClient too (#12576) In one of the versions we've changed the type of the argument from `I18n` to `I18n` and this has caused some issues with TS resolving the type compatibility in the `formatDate` utility so it no longer supports `I18nClient`. This type change happened in https://github.com/payloadcms/payload/pull/10030 --- packages/ui/src/utilities/formatDocTitle/formatDateTitle.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/ui/src/utilities/formatDocTitle/formatDateTitle.ts b/packages/ui/src/utilities/formatDocTitle/formatDateTitle.ts index 43d41884ce..1fd7a5f434 100644 --- a/packages/ui/src/utilities/formatDocTitle/formatDateTitle.ts +++ b/packages/ui/src/utilities/formatDocTitle/formatDateTitle.ts @@ -1,11 +1,11 @@ -import type { I18n } from '@payloadcms/translations' +import type { I18n, I18nClient } from '@payloadcms/translations' import { TZDateMini as TZDate } from '@date-fns/tz/date/mini' import { format, formatDistanceToNow, transpose } from 'date-fns' export type FormatDateArgs = { date: Date | number | string | undefined - i18n: I18n + i18n: I18n | I18nClient pattern: string timezone?: string } @@ -34,7 +34,7 @@ export const formatDate = ({ date, i18n, pattern, timezone }: FormatDateArgs): s type FormatTimeToNowArgs = { date: Date | number | string | undefined - i18n: I18n + i18n: I18n | I18nClient } export const formatTimeToNow = ({ date, i18n }: FormatTimeToNowArgs): string => {