Standard Formating
Date Format (ISO8601)
Date | 2019-05-10 |
---|---|
Date and time in UTC | 2019-05-10T20:18:46+00:00 2019-05-10T20:18:46Z 20190510T201846Z |
Week | 2019-W19 |
Date with week number | 2019-W19-5 |
Date without year | --05-10[1] |
Ordinal date | 2019-130 |
Display Format (order of preference)
Full Date:
- December 10, 2019
- 10 December 2019
- December 2019
Numbers Only Date
- 2019-12-10
- 2019-12
- 2018 to 2019
Date Ranges
- December 10 to December 25, 2019
- 2019-12-10 to 2019-12-25
- Monday to Friday, 9 a.m. to 5 p.m.
Today, Tomorrow, This Week
- Today (December 10, 2019)
- Tomorrow (December 11, 2019)
- This week (Dec 10 to Dec 17, 2019
Time:
- 3 p.m.
- 3:25 a.m.
Component Refence
How to Ask For Date Information
The way you should ask users for dates depends on the types of date you’re asking for. When asking for a date from an existing document be sure to make the fields match the format of the existing document. This makes it easier for users to copy the date across accurately.
Dates you may need users to provide include:
- dates from documents or cards, like a passport or credit card
- approximate dates, like ‘December 2017’
- relative dates, like ‘4 days from today’
In some cases you might need users to pick a date from a given selection.
Generally
When asking for a date from an existing document be sure to make the fields match the format of the existing document. This makes it easier for users to copy the date across accurately.
Helping Users Pick a Date
Users might need to pick a date from a selection, for example, to book an appointment.
To do this, you can present dates in a calendar format using a calendar control. Users are typically shown one month’s worth of dates at a time, and can skip through months and years.
Only use a calendar control if users need to:
- pick a date in the near future or recent past
- know the day of the week, or the week of the month, as well as the date
- be able to see dates in relation to other dates
Never make a calendar control that depends on JavaScript as the only input option. Allow users to enter the date into a text input as well as use the control.
How to Check that Dates Are Valid
To check that the dates users give you are valid, make sure that:
- it’s a real date, for example, not 54 July
- past dates are in the past
- future dates are in the future
- the first date in a date range is before the second
Handling Errors
??
Resources:
https://www.ontario.ca/document/go-its-7400-date-format
https://en.wikipedia.org/wiki/ISO_8601