DateFieldInput
Defined in: packages/core/src/fields/date/types.ts:62
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: "100%", // 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<TCollectionSlug,TFieldKey,TFieldMeta>
Type Parameters
Section titled “Type Parameters”TCollectionSlug
Section titled “TCollectionSlug”TCollectionSlug extends VexResourceSlug = VexResourceSlug
TFieldKey
Section titled “TFieldKey”TFieldKey extends string = never
TFieldMeta
Section titled “TFieldMeta”TFieldMeta extends object = { }
Properties
Section titled “Properties”admin?
Section titled “admin?”
optionaladmin?:FieldAdminConfigInput<TCollectionSlug,ComponentHKT>
Defined in: packages/core/src/fields/baseTypes.ts:531
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:71
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:516
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?:FieldIndexConfigInput<TCollectionSlug,TFieldKey>
Defined in: packages/core/src/fields/baseTypes.ts:545
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"])
author: { type: "relationship", index: { name: "by_author_status", additionalFields: ["status"] } }// Generates: .index("by_author_status", ["author", "status"])Inherited from
Section titled “Inherited from”interfaceDescription?
Section titled “interfaceDescription?”
optionalinterfaceDescription?:string
Defined in: packages/core/src/fields/baseTypes.ts:518
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:507
Display label for the field in the admin form.
Inherited from
Section titled “Inherited from”
optionalmax?:FieldLimitInput
Defined in: packages/core/src/fields/date/types.ts:75
Maximum allowed Unix timestamp (milliseconds). Validated in the input schema.
optionalmeta?:TFieldMeta
Defined in: packages/core/src/fields/baseTypes.ts:546
Inherited from
Section titled “Inherited from”
optionalmin?:FieldLimitInput
Defined in: packages/core/src/fields/date/types.ts:73
Minimum allowed Unix timestamp (milliseconds). Validated in the input schema.
required?
Section titled “required?”
optionalrequired?:boolean
Defined in: packages/core/src/fields/baseTypes.ts:524
Whether this field is required.
Default: false
Inherited from
Section titled “Inherited from”
optionaltime?:object
Defined in: packages/core/src/fields/date/types.ts:81
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
Methods
Section titled “Methods”validate()?
Section titled “validate()?”
optionalvalidate(props):void|Promise<void>
Defined in: packages/core/src/fields/date/types.ts:108
Server-only async validation with value typed as number (Unix ms timestamp).
Parameters
Section titled “Parameters”FieldValidateProps<TCollectionSlug, number>
Returns
Section titled “Returns”void | Promise<void>
Overrides
Section titled “Overrides”BaseFieldInput.validate