Loading

Date

A calendar date, with no time component.

Where to find it

Architect Panel → Data:

  • Datastores — the datastore, then Table Designer to add or edit a field

What it stores

A date. Sorting, comparison and date arithmetic all work correctly, and the display format follows the user's locale rather than being baked into the stored value.

Why not a text box

Because a date in a text box sorts alphabetically, which puts December before February and 2019 before 2020 only by accident. It also cannot be compared, cannot drive a reminder, and accepts "next Tuesday" as readily as a date.

This is the single most common modelling mistake, and it is expensive to correct once there is data.

When to use it

  • Dates of birth, start dates, deadlines, renewal dates.
  • Anything where the time of day is genuinely irrelevant.

Date or date and time?

Ask whether the time will ever matter. A date of birth never needs one. An appointment does. A "date received" probably does, even if nobody thinks so today — and adding time later is harder than ignoring it.

Where you are unsure and the value records an event rather than a plan, prefer date and time.

Time zones do not apply

A date has no time, so it has no time zone — which is exactly why it is the right type for a birthday. Somebody's birthday is the same date wherever they are, and storing it with a time invites a time-zone conversion that can shift it by a day.

Defaults save typing

Where a date is usually today, default it. Most date fields are filled with today's date most of the time, and a default that is right nine times in ten is worth having.

Validate the range where it helps

A date of birth in the future or a start date twenty years hence is almost always a typo — usually a mistyped year. Range validation catches those at entry, where they cost nothing, rather than in a report.

Think about empty

Decide what a blank date means and whether it is allowed. "No end date" meaning ongoing is a legitimate and useful convention; a blank that means somebody did not know is a different thing, and conflating the two makes reports ambiguous.

Worked example

A membership datastore uses a date for joined and a nullable date for left, where blank means still a member. Range validation rejects joining dates before the organisation existed, which caught a run of records mistyped with the wrong century during an import.

Recommendations

  • Never store a date in a text box.
  • Prefer date and time for events, plain date for plans and anniversaries.
  • Default to today where that is usually right.
  • Decide what blank means and write it down.