Skip to content

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
}
}
// Minimal — label is inferred from the key ("Published At")
publishedAt: date()
// Required event date with a database index
eventDate: 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)

TFieldMeta extends object = { }

optional admin?: FieldAdminConfigInput

Defined in: packages/core/src/fields/baseTypes.ts:209

Admin UI configuration for this field.

BaseFieldInput.admin


optional defaultValue?: 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.

BaseFieldInput.defaultValue


optional description?: string

Defined in: packages/core/src/fields/baseTypes.ts:194

Semantic description of the field. Used in three places:

  1. Helper text rendered below the field input in the admin form UI.
  2. As the Zod .meta({ description }) value for form validation.
  3. As the JSDoc comment on the generated document interface property.

To write a separate JSDoc comment, use interfaceDescription in addition.

BaseFieldInput.description


optional index?: 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.

slug: { type: "text", index: "by_slug", required: true }
// Generates: .index("by_slug", ["slug"])

BaseFieldInput.index


optional interfaceDescription?: string

Defined in: packages/core/src/fields/baseTypes.ts:196

The JSDoc comment on the generated document interface property

BaseFieldInput.interfaceDescription


optional label?: string

Defined in: packages/core/src/fields/baseTypes.ts:185

Display label for the field in the admin form.

BaseFieldInput.label


optional max?: number

Defined in: packages/core/src/fields/date/types.ts:72

Maximum allowed Unix timestamp (milliseconds). Validated in the input schema.


optional meta?: TFieldMeta

Defined in: packages/core/src/fields/baseTypes.ts:221

BaseFieldInput.meta


optional min?: number

Defined in: packages/core/src/fields/date/types.ts:70

Minimum allowed Unix timestamp (milliseconds). Validated in the input schema.


optional required?: boolean

Defined in: packages/core/src/fields/baseTypes.ts:202

Whether this field is required.

Default: false

BaseFieldInput.required


optional time?: 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.

optional hidden?: boolean

Hide the time-of-day picker, showing only the calendar date selector.

Default: false (time picker is visible)

optional timePicker?: object

Control which time units are shown in the time picker. Each unit defaults to true for hour and minute, false for second.

hour: boolean

Show the hour selector. Default: true.

minute: boolean

Show the minute selector. Default: true.

second: boolean

Show the seconds selector. Default: false.

optional use12HourFormat?: boolean

Display time in 12-hour AM/PM format instead of 24-hour.

Default: true