Time
Interface
export type ITimeTypeValue = string;
export interface ITimeField extends CommonField {
type: 'time';
options?: {
placeholder?: string;
};
private?: () => Promise<ITimeTypeValue>;
render?: (v: ITimeTypeValue) => JSX.Element;
validation?: Validation<ITimeTypeValue>;
}Example
{
type: 'time',
name: 'YOUR_PATH',
validation: z.string().refine(
(val) => {
const match = /^([01]\d|2[0-3]):([0-5]\d):([0-5]\d)$/.test(val)
if (!match) return false
return val > '15:30:00'
},
"Data has to be after 15:30:00"
)
}