From 056ea4d868519ea381117bf9fec816b9cdf98a22 Mon Sep 17 00:00:00 2001 From: zhidongyin Date: Sat, 3 Feb 2024 14:16:44 +0800 Subject: [PATCH] feat: datetime fields support timestamp --- packages/tushan/client/components/fields/datetime.tsx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/tushan/client/components/fields/datetime.tsx b/packages/tushan/client/components/fields/datetime.tsx index b01fc38..fd17741 100644 --- a/packages/tushan/client/components/fields/datetime.tsx +++ b/packages/tushan/client/components/fields/datetime.tsx @@ -6,7 +6,7 @@ import type { FieldDetailComponent, FieldEditComponent } from './types'; export type DateTimeFieldValueType = string | number; export interface DateTimeFieldOptions { - format: 'iso' | 'unix'; + format: 'iso' | 'unix' | 'timestamp'; } export const DateTimeFieldDetail: FieldDetailComponent< @@ -32,6 +32,8 @@ export const DateTimeFieldEdit: FieldEditComponent< props.onChange(date.toISOString()); } else if (format === 'unix') { props.onChange(date.unix()); + } else if (format === 'timestamp') { + props.onChange(date.valueOf()); } }} showTime={true}