0% прочитано

Time Formatting Is Part of Localization Too

Interface localization does not end with translated strings. Time format, dates, numbers, and time zones also affect how users read data. This article uses a simple admin-panel case where both Ukrainian and English intentionally use a 24-hour clock.

30 жовтня 2026 р. 6 хв читанняLaravel

When people talk about localization, they often mean interface translation: button labels, messages, headings, and hints.

But users read more than text. They also see dates, time, numbers, money values, month names, and time zones.

So if the Ukrainian and English versions have correct translations but one shows 18:45 and the other shows 6:45 PM, that is also a localization decision.

Interface language and time format are related, but they are not the same setting. A product may intentionally use the same 24-hour clock across multiple languages.

Localization Is More Than a Translation Dictionary

The same moment can be displayed in several ways:

  • 18:45;
  • 6:45 PM;
  • 27.10.2026, 18:45;
  • Oct 27, 2026, 18:45.

All of them may represent the same date. The difference is how the data is presented to the user.

A Locale Default Is Not Always the Product Rule

Browser formatting APIs can automatically choose a time representation that is common for a locale.

That is convenient, but an automatic default does not always match a product requirement.

For example, an admin panel may intentionally use a 24-hour clock for both uk and en so that timestamps are consistent across tables, audit logs, and filters.

Intl.DateTimeFormat Can Explicitly Enforce a 24-Hour Clock

Explicit 24-hour formatting for both locales
const formatTime = (value, locale) => {    return new Intl.DateTimeFormat(locale, {        hour: '2-digit',        minute: '2-digit',        hour12: false,    }).format(new Date(value));};

The locale still controls other language-specific formatting rules, while hour12: false explicitly controls the clock format.

The interface remains localized, while the clock representation follows a separate product decision.

The Same Applies to Full Date and Time Formatting

Formatting date and time together
const formatDateTime = (value, locale) => {    return new Intl.DateTimeFormat(locale, {        year: 'numeric',        month: '2-digit',        day: '2-digit',        hour: '2-digit',        minute: '2-digit',        hour12: false,    }).format(new Date(value));};

Here the locale may affect date order and separators, while the time still uses a 24-hour clock.

This allows localized date presentation together with a consistent time format in the admin interface.

Laravel Should Usually Send the Timestamp and Let the UI Format It

If an API or Inertia response sends a date as ISO 8601, the client has enough information to present it according to the interface language and formatting rules.

This is more flexible than converting the timestamp into a final display string on the server when the same value is used across multiple languages or components.

The server sends the timestamp without a UI-specific format
return [    'createdAt' =>        $model->created_at?->toISOString(),];

Time Format and Time Zone Are Different Concerns

18:45 instead of 6:45 PM changes only how the hour is represented.

Changing the time zone can change the actual hour value.

So when fixing time formatting, keep two questions separate: "how should the time be displayed?" and "which time zone should it represent?"

Centralize Time Formatting

If every table or component creates its own Intl.DateTimeFormat, the interface can quickly become inconsistent.

One screen shows 18:45, another shows 6:45 PM, and a third includes seconds.

A shared helper or composable keeps the admin interface consistent.

Shared admin time formatter
export const formatAdminTime = (    value,    locale,) => new Intl.DateTimeFormat(    locale,    {        hour: '2-digit',        minute: '2-digit',        hour12: false,    },).format(    new Date(value),);

What to Test

Simple expectation for both locales
UA admin:18:45 EN admin:18:45 Do not expect:UA -> 18:45EN -> 6:45 PM

Tests should verify not only translated labels but also the final presentation of values.

If the product defines a 24-hour clock for both admin locales, that should be treated as an explicit UI contract.

Locale Should Not Accidentally Control Every Formatting Decision

Automatic locale rules are useful defaults, but they are not a replacement for product requirements.

If admin users need the same 24-hour clock across multiple languages, define that rule explicitly.

Localization is not only about which language the interface uses. It is also about how users read the data it presents.

Translations can be correct while the interface is still incompletely localized if data formatting conflicts with product rules.