mirror of
https://github.com/docmost/docmost.git
synced 2026-06-16 15:10:57 +08:00
4e5bff6d55
Table and kanban UI, formula engine package, and the base-embed editor extension
23 lines
725 B
TypeScript
23 lines
725 B
TypeScript
import { formatNumber } from "@/ee/base/components/cells/cell-number";
|
|
import { formatDateDisplay } from "@/ee/base/components/cells/cell-date";
|
|
|
|
export { formatNumber, formatDateDisplay };
|
|
|
|
export function formatTimestamp(value: string | null | undefined): string {
|
|
if (typeof value !== "string" || !value) return "";
|
|
const date = new Date(value);
|
|
if (isNaN(date.getTime())) return "";
|
|
return date.toLocaleDateString(undefined, {
|
|
month: "short",
|
|
day: "numeric",
|
|
year: "numeric",
|
|
hour: "numeric",
|
|
minute: "2-digit",
|
|
});
|
|
}
|
|
|
|
export function formatLongTextPreview(value: string | null | undefined): string {
|
|
if (typeof value !== "string") return "";
|
|
return value.replace(/\s+/g, " ").trim();
|
|
}
|