Skip to content

Build your own AI office with Univer Office SDK. Bring editing, calculation, collaboration, and file processing into your product for people and AI agents. Built on an extensible open-source core.

feat(core): add Base date field config types (#7374)

Univer1ab98a155ffe
diff --git a/packages/core/src/bases/index.ts b/packages/core/src/bases/index.ts
index d5ab72fb82..b1ca4205be 100644
--- a/packages/core/src/bases/index.ts
+++ b/packages/core/src/bases/index.ts
@@ -26,6 +26,7 @@ export type {
BaseCellPrimitiveValue,
CellValue as BaseCellValue,
BaseCellValueType,
+ BaseDateHourCycle,
BaseHitTestResult,
BaseId,
PrimitiveCellValue as BasePrimitiveCellValue,
@@ -37,6 +38,7 @@ export type {
FieldSnapshot,
IBaseAttachment,
IBaseCellData,
+ IBaseDateFieldConfig,
IBaseInvalidation,
IBaseRect,
IBaseResources,
diff --git a/packages/core/src/bases/typedef.ts b/packages/core/src/bases/typedef.ts
index b4a4702ab1..840de68a4c 100644
--- a/packages/core/src/bases/typedef.ts
+++ b/packages/core/src/bases/typedef.ts
@@ -115,6 +115,27 @@ export enum BaseViewType {
}
export type FieldConfig = Record<string, unknown>;
+
+export type BaseDateHourCycle = 'h12' | 'h24';
+
+/**
+ * Display options for Date, CreatedAt, and UpdatedAt fields.
+ */
+export interface IBaseDateFieldConfig extends FieldConfig {
+ /**
+ * Date-only display pattern, such as `yyyy/mm/dd`.
+ */
+ pattern?: string;
+ /**
+ * Whether to append a time to the formatted date.
+ */
+ includeTime?: boolean;
+ /**
+ * Explicit 12-hour or 24-hour time format.
+ */
+ hourCycle?: BaseDateHourCycle;
+}
+
export type ViewSpecificConfig =
| IGridViewConfig
| IKanbanViewConfig