DateFieldInput
Defined in: packages/core/src/fields/date/types.ts:61
Configuration input for a date() field.
Date fields store a Unix timestamp in milliseconds — event dates, publish dates, expiry times, etc. All properties are optional; unset properties fall back to the defaults listed below.
Defaults applied by date():
{ type: "date", label: "", // inferred from the field key by defineCollection required: false, // field is optional by default time: { hidden: false, // time picker is visible alongside the calendar use12HourFormat: true, // AM/PM format (set false for 24-hour) timePicker: { hour: true, // hour selector shown minute: true, // minute selector shown second: false, // seconds hidden }, }, admin: { hidden: false, // visible in the admin form readOnly: false, // editable by default position: "main", // placed in the main content column, not the sidebar width: "full", // spans the full form width, not half cellAlignment: "left", // text aligned left in the data table column }}Example
Section titled “Example”// Minimal — label is inferred from the key ("Published At")publishedAt: date()
// Required event date with a database indexeventDate: date({ required: true, index: "by_event_date" })
// Appointment with 24-hour format and seconds hidden (overrides defaults)appointmentAt: date({ required: true, time: { use12HourFormat: false },})
// Date-only picker (hide the time UI entirely)expiresOn: date({ time: { hidden: true } })
// Pre-filled default (Unix ms timestamp for 2025-01-01T00:00:00Z)startsAt: date({ defaultValue: 1735689600000 })- DateField for the resolved type after defaults are applied
- date for the config function that applies defaults
- BaseFieldInput for shared properties (
label,description,required,admin,index)
Extends
Section titled “Extends”BaseFieldInput<TFieldMeta>
Type Parameters
Section titled “Type Parameters”TFieldMeta
Section titled “TFieldMeta”TFieldMeta extends object = { }
Properties
Section titled “Properties”admin?
Section titled “admin?”
optionaladmin?:FieldAdminConfigInput
Defined in: packages/core/src/fields/baseTypes.ts:209
Admin UI configuration for this field.
Inherited from
Section titled “Inherited from”defaultValue?
Section titled “defaultValue?”
optionaldefaultValue?:number
Defined in: packages/core/src/fields/date/types.ts:68
Pre-filled Unix timestamp (milliseconds) shown in the admin form when creating a new document. Does not apply to existing database values.
Overrides
Section titled “Overrides”description?
Section titled “description?”
optionaldescription?:string
Defined in: packages/core/src/fields/baseTypes.ts:194
Semantic description of the field. Used in three places:
- Helper text rendered below the field input in the admin form UI.
- As the Zod
.meta({ description })value for form validation. - As the JSDoc comment on the generated document interface property.
To write a separate JSDoc comment, use interfaceDescription in addition.
Inherited from
Section titled “Inherited from”index?
Section titled “index?”
optionalindex?:string
Defined in: packages/core/src/fields/baseTypes.ts:220
Create a database index on this field. The string value becomes the index name in Convex.
Example
Section titled “Example”slug: { type: "text", index: "by_slug", required: true }// Generates: .index("by_slug", ["slug"])Inherited from
Section titled “Inherited from”interfaceDescription?
Section titled “interfaceDescription?”
optionalinterfaceDescription?:string
Defined in: packages/core/src/fields/baseTypes.ts:196
The JSDoc comment on the generated document interface property
Inherited from
Section titled “Inherited from”BaseFieldInput.interfaceDescription
label?
Section titled “label?”
optionallabel?:string
Defined in: packages/core/src/fields/baseTypes.ts:185
Display label for the field in the admin form.
Inherited from
Section titled “Inherited from”
optionalmax?:number
Defined in: packages/core/src/fields/date/types.ts:72
Maximum allowed Unix timestamp (milliseconds). Validated in the input schema.
optionalmeta?:TFieldMeta
Defined in: packages/core/src/fields/baseTypes.ts:221
Inherited from
Section titled “Inherited from”
optionalmin?:number
Defined in: packages/core/src/fields/date/types.ts:70
Minimum allowed Unix timestamp (milliseconds). Validated in the input schema.
required?
Section titled “required?”
optionalrequired?:boolean
Defined in: packages/core/src/fields/baseTypes.ts:202
Whether this field is required.
Default: false
Inherited from
Section titled “Inherited from”
optionaltime?:object
Defined in: packages/core/src/fields/date/types.ts:78
Date/time picker display configuration. Each key is optional — omitted keys
fall back to the defaults applied by date(). The time object is always
fully resolved on DateField after defaults are merged.
hidden?
Section titled “hidden?”
optionalhidden?:boolean
Hide the time-of-day picker, showing only the calendar date selector.
Default: false (time picker is visible)
timePicker?
Section titled “timePicker?”
optionaltimePicker?:object
Control which time units are shown in the time picker.
Each unit defaults to true for hour and minute, false for second.
timePicker.hour
Section titled “timePicker.hour”hour:
boolean
Show the hour selector. Default: true.
timePicker.minute
Section titled “timePicker.minute”minute:
boolean
Show the minute selector. Default: true.
timePicker.second
Section titled “timePicker.second”second:
boolean
Show the seconds selector. Default: false.
use12HourFormat?
Section titled “use12HourFormat?”
optionaluse12HourFormat?:boolean
Display time in 12-hour AM/PM format instead of 24-hour.
Default: true