PhoenixKitProjects.L10n (PhoenixKitProjects v0.1.1)

Copy Markdown View Source

Tiny locale-aware date/time formatting helpers used by the projects UI.

Unlike Calendar.strftime(d, "%b %d, %Y"), the output of these helpers is safe to translate: the three-letter month labels and the surrounding string template all go through Gettext.

The 12 month labels are intentionally listed as separate gettext/1 calls so the string-extraction task picks them up into the .pot file. Don't collapse them into a map-based lookup.

Summary

Functions

Formats a Date/DateTime as Mon DD, YYYY. Returns nil for nil.

Formats as Mon DD, YYYY at HH:MM. For DateTimes.

Formats as Mon DD HH:MM — month, day, and time only.

24-hour time string as HH:MM (locale-neutral).

Short 3-letter month name, translated (Jan, Feb, ...).

Functions

format_date(dt)

Formats a Date/DateTime as Mon DD, YYYY. Returns nil for nil.

format_datetime(dt)

Formats as Mon DD, YYYY at HH:MM. For DateTimes.

format_month_day_time(dt)

Formats as Mon DD HH:MM — month, day, and time only.

format_time(date_time)

24-hour time string as HH:MM (locale-neutral).

short_month(int)

Short 3-letter month name, translated (Jan, Feb, ...).