Skip to content

Open-source manufacturing ERP, MES and QMS. Quoting, MRP, inventory, shop floor, quality and lot/serial traceability on one Postgres schema, with a REST API and MCP server. Self-host or use Carbon Cloud.

fix: timestamp on dashboard page

Brad Barbin87400d726532
diff --git a/apps/carbon/app/routes/x+/_index.tsx b/apps/carbon/app/routes/x+/_index.tsx
index 94b452d2dd..4eafbaad01 100644
--- a/apps/carbon/app/routes/x+/_index.tsx
+++ b/apps/carbon/app/routes/x+/_index.tsx
@@ -1,23 +1,26 @@
import { Heading, cn } from "@carbon/react";
-import { formatDate } from "@carbon/utils";
-import { getLocalTimeZone, today } from "@internationalized/date";
+import { getLocalTimeZone } from "@internationalized/date";
import { Link } from "@remix-run/react";
import type { ComponentProps } from "react";
import { useModules } from "~/components/Layout/Navigation/useModules";
import { useUser } from "~/hooks";
import type { Authenticated, NavItem } from "~/types";
+const formatter = new Intl.DateTimeFormat("en-US", {
+ dateStyle: "full",
+ timeZone: getLocalTimeZone(),
+});
+
export default function AppIndexRoute() {
const user = useUser();
const modules = useModules();
+
+ const date = new Date();
+
return (
<div className="p-8 w-full h-full bg-muted">
<Heading size="h3">Hello, {user.firstName}</Heading>
- <Subheading>
- {formatDate(today(getLocalTimeZone()).toString(), {
- dateStyle: "full",
- })}
- </Subheading>
+ <Subheading>{formatter.format(date)}</Subheading>
<Hr />
<Subheading className="mb-8">Modules</Subheading>
<div className="grid grid-cols-1 sm:grid-cols-3 md:grid-cols-4 lg:grid-cols-6 gap-6">
diff --git a/packages/utils/src/date.ts b/packages/utils/src/date.ts
index 788027044c..bdf06a7354 100644
--- a/packages/utils/src/date.ts
+++ b/packages/utils/src/date.ts
@@ -1,3 +1,4 @@
+import { getLocalTimeZone, parseDate } from "@internationalized/date";
const relativeFormatter = new Intl.RelativeTimeFormat(undefined, {
numeric: "auto",
});
@@ -14,14 +15,15 @@ const DIVISIONS: { amount: number; name: Intl.RelativeTimeFormatUnit }[] = [
const defaultFormatOptions: Intl.DateTimeFormatOptions = {
dateStyle: "medium",
+ timeZone: getLocalTimeZone(),
};
export function formatDate(
- isoString?: string | null,
+ dateString?: string | null,
options?: Intl.DateTimeFormatOptions
) {
- if (!isoString) return "";
- const date = new Date(isoString);
+ if (!dateString) return "";
+ const date = new Date(parseDate(dateString).toString());
return new Intl.DateTimeFormat(
undefined,