concept date in category design

appears as: dates, date, date
Usability Matters: Mobile-first UX for developers and other accidental designers

This is an excerpt from Manning's book Usability Matters: Mobile-first UX for developers and other accidental designers.

Harriet once got reports from someone who was unable to get their app working on a newly released, top-of-the-line device. When the app started up, it would crash. Her concern was that the app didn’t work on the latest device. After looking at the automatically generated crash logs (see how useful these can be?), she noted that a formatting exception was occurring. After some investigation and experimentation, she determined that the server was returning the US-formatted date when the app was expecting a Norwegian format (due to the device settings), and failing to convert it correctly. Using a standard format for date transmission, and not assuming dates are in the device’s local format, would have avoided this.

Date formats also vary around the world. Consider the date 8/9/16. In some parts of the world, this represents the 9th of August, 2016 and, in others, the 8th of September in the same year. There’s no right or wrong answer for this value. If you’re in North America, you’d assume the August date, but if in the UK, the September one. If you’re in the USA and looking at that date displayed in an app, and it’s intended to be a date in September, that’s where problems begin. A date should be displayed the way a person using the device expects. If you can’t be sure what the person using the app would expect, use something that’s unambiguous. For example, there’s no doubt what the date September 8th, 2016 means.

How the date is displayed within the app is important, but how dates are stored internally and transmitted can be more significant. If the server sends the date 8/9/16, you’d have to know what each element means. You may know that the server returns the date in the format month/day/year, but someone else working with the data may not know that or may wrongly assume a different structure, or the format the server used could change.

I once had to help a company solve an intermittent problem with date formatting. I eventually identified the cause as one of the four load-balanced servers that hosted the API being set to a different locale. Because of that, it returned data in a different format than the other servers. The app developers weren’t expecting this.

Details of the format can be sent (and stored) with the value, but this also increases the amount of data sent and stored. To avoid problems like this, there’s an internationally recognized and accepted format for representing dates and times in the Gregorian calendar. It’s defined by the International Organization of Standardization (ISO) as ISO-8601 and shown in figure 3.4.

Figure 3.4. The structure of the ISO-8601 date format. Use this for sending and storing date and time values.

A date-related formatting gotcha relates to regional settings. Developers format a date with the formatting string of yyyy MMM dd and expect this to always return a four-figure year value, the month as a three-letter abbreviation, and the day of the month as two digits. In some cultures and for some months, however, a period (.) is added after the abbreviated month name, even though the provided formatting string doesn’t include this.

Most platforms let you specify regional settings separately from the language used on a device. This affects date and number formatting. You’ll need to allow for the formatting settings and language to be different and to use the formatting options specified. Don’t assume based on the configured language.

  • Supporting people in other countries, cultures, and those who speak different languages also means treating numbers and dates in the different ways they expect.
  • Use standardized formats for transferring and storing numbers, dates, and times, so you don’t have issues when converting them to different regional formats.