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: relative time format bug

Brad Barbin021da8448be6
diff --git a/packages/utils/src/date.ts b/packages/utils/src/date.ts
index f0e8b59d82..f6d6c575a7 100644
--- a/packages/utils/src/date.ts
+++ b/packages/utils/src/date.ts
@@ -89,11 +89,9 @@ export function formatTimeFromNow(isoString: string) {
for (let i = 0; i <= DIVISIONS.length; i++) {
const division = DIVISIONS[i];
- if (Math.abs(duration) < division!.amount) {
- return relativeFormatter.format(
- Math.round(-1 * duration),
- division!.name
- );
+ if (!division) return "";
+ if (Math.abs(duration) < division.amount) {
+ return relativeFormatter.format(Math.round(-1 * duration), division.name);
}
duration /= division!.amount;
}