diff --git a/.changeset/forty-bananas-tie.md b/.changeset/forty-bananas-tie.md new file mode 100644 index 0000000000..8e2ad69cc1 --- /dev/null +++ b/.changeset/forty-bananas-tie.md @@ -0,0 +1,5 @@ +--- +"@medusajs/dashboard": patch +--- + +fix(dashboard): correctly format date cell time diff --git a/packages/admin/dashboard/src/components/table/table-cells/common/date-cell/date-cell.tsx b/packages/admin/dashboard/src/components/table/table-cells/common/date-cell/date-cell.tsx index e3ef58ec09..bcd40b1ff7 100644 --- a/packages/admin/dashboard/src/components/table/table-cells/common/date-cell/date-cell.tsx +++ b/packages/admin/dashboard/src/components/table/table-cells/common/date-cell/date-cell.tsx @@ -1,35 +1,33 @@ import { Tooltip } from "@medusajs/ui" -import { format } from "date-fns/format" import { useTranslation } from "react-i18next" import { PlaceholderCell } from "../placeholder-cell" +import { useDate } from "../../../../../hooks/use-date" type DateCellProps = { date?: Date | string | null } export const DateCell = ({ date }: DateCellProps) => { + const { getFullDate } = useDate() + if (!date) { return } - const value = new Date(date) - value.setMinutes(value.getMinutes() - value.getTimezoneOffset()) - - const hour12 = Intl.DateTimeFormat().resolvedOptions().hour12 - const timestampFormat = hour12 ? "dd MMM yyyy hh:MM a" : "dd MMM yyyy HH:MM" - return (
{`${format( - value, - timestampFormat - )}`} + {`${getFullDate({ + date, + includeTime: true, + })}`} } > - {format(value, "dd MMM yyyy")} + + {getFullDate({ date, includeTime: false })} +
)