Skip to content

Commit

Permalink
feat: datetime fields support timestamp
Browse files Browse the repository at this point in the history
  • Loading branch information
zhidongyin committed Feb 3, 2024
1 parent 8e0d7f1 commit 056ea4d
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion packages/tushan/client/components/fields/datetime.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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<
Expand All @@ -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}
Expand Down

0 comments on commit 056ea4d

Please sign in to comment.