DateTime Field
Overview
The DateTime component allows the user to to input date and time together which outputs a standard ISO 8601 datetime.
If you do not need to use ISCO 8601 and are just looking for a simpler component that either returns just the time or the date then visit the Time Field and Date Field components.
When to use
- Use a Date Time Field if the entry requires its value formatted as a ISO_8601 datetime.
- If you require either a date and time or just a date value in the above format.
When not to use
- Do not use Date Time Field if you only need to return a plain date or time value.
Interactive demo
The demo below allows you to preview the component. You can play with its props, variations, configuration options and dive into its events and even see them trigger in the event log tab.
MedKit Date Time Field
Invalid time
Date Format
DateFormat
Date Input Only
boolean
false
Error
string
Array<string>
Error Hidden
boolean
false
Help Text
string
Array<string>
Label
string
Required
Label Hidden
boolean
false
Required
boolean
false
Time Format
TimeFormat
24
12 Hour Time
Date Only
If only a full date is required and time is not the focus but it still needs to be stored as and ISO8601 date then it's possible to use the dateInputOnly prop to hide the time value and only display the date. In this case the time will automatically always return the time for the date at midnight 00:00:00
Default
With an error
This is an example error
With help text
This is a helpful hint for a user
Figma Library
You can find the component in our MedKit Figma library.