Skip to main content

Module format

Module format 

Expand description

The one way Tilo shows dates, times, numbers, sizes and durations.

Every app and the shell format what a person reads through this module. It follows the person’s Region & Formats settings (date style, 12/24-hour clock, number style, first day of the week; region) and the desktop’s language (month and weekday names, word order, plurals), and it follows them live: a change re-renders every view without a restart (region::refresh). A policy check (tools/policy/check_formats.py) keeps hand-built formatting (strftime patterns, {:02}:{:02} clocks, ad-hoc size units) out of everything else.

The named styles:

StyleFunctionEnglishGerman
listlist_date16:02, Yesterday, Sun, Jun 30, Jun 30, 202516:02, Gestern, So., 30. Juni, 30. Juni 2025
day factday_fact, Formats::day_factOverdue, Today, Tomorrow, Thursday, Jun 29; Today 09:00, Thu 14:30Überfällig, Heute, Morgen, Donnerstag, 29. Juni; Heute 09:00, Do. 14:30
moment factmoment_fact, Formats::moment_fact15:00, Sat 09:00, Jun 29 09:0015:00, Sa. 09:00, 29. Juni 09:00
timestamptimestampJun 30, 2026, 13:42 (or ISO 2026-06-30 13:42, …)30.06.2026, 13:42
datedateJun 30, 2026 (or ISO, US, EU, 30 Jun 2026)30.06.2026 (or 30. Juni 2026, Long)
timetime13:42 or 1:42 PM13:42
day headingday_headingTuesday, June 30Dienstag, 30. Juni
month headingmonth_headingJune 2026Juni 2026
relativerelative3 min agovor 3 Min.
durationduration1 hr 5 min1 Std. 5 Min.
timecodetimecode1:01:011:01:01
sizesize1.5 MB1,5 MB
memorymemory1.5 GiB1,5 GiB
raterate6.7 MB/s6,7 MB/s
countcount, items12,345, 12 items12.345, 12 Objekte
moneymoney$5, $0.42, $1,250$5, $0,42, $1.250
decimaldecimal3.143,14

size uses SI decimal units and memory IEC binary ones, the platform’s rule shared with Files, Disks and the Storage pane: anything stored or transferred (files, downloads, caches, packages, drives, partitions) is a size and memory a memory, while a flow whose requirements are themselves stated in binary units (the installer’s GiB partition minimums) stays binary throughout so its numbers compare.

The free functions use the person’s current formats (Formats::current); the same styles on Formats take explicit formats and an explicit now, for tests and for callers formatting many values at once.

Modules§

region
The person’s region and formats, as every formatter reads them: the locale section of their settings (date style, 12/24-hour clock, number style, first day of the week) next to the desktop’s language.

Structs§

DayFact
A day as a person reads it: the words, and the tone they are read in.
Formats
One set of formats: the person’s RegionFormats. Words (month names, “Yesterday”, plurals) come from the language active on the calling thread.
NaiveDate
ISO 8601 calendar date without timezone. Allows for every proleptic Gregorian date from Jan 1, 262145 BCE to Dec 31, 262143 CE. Also supports the conversion from ISO 8601 ordinal and week date.
NaiveDateTime
ISO 8601 combined date and time without timezone.
NaiveTime
ISO 8601 time without timezone. Allows for the nanosecond precision and optional leap second representation.
RegionFormats
The formats a person chose in Region & Formats. number is None until they choose a number style; the language’s own convention applies then.
UnixSecs
Seconds since the Unix epoch, as protocols and files keep them.

Enums§

DateStyle
How dates render: the shared locale.date_format setting. The serde names are the exact strings the settings file uses (Language/ISO/US/EU/Long). Until the person picks one, dates follow the desktop’s language (DateStyle::Language); ISO is a choice like the others.
FirstDayOfWeek
The day a week starts on, for every calendar grid and week number.
NumberStyle
Decimal and grouping convention. Kept apart from the currency so someone can use EUR with either continental or English-language formatting.
Period
A span of the calendar a view shows: one day, a run of days, or a month.
Weekday
The day of week.

Traits§

Moment
A moment the formatters can show: a chrono date and time in any zone, a local NaiveDateTime or UnixSecs.

Functions§

arithmetic_operator
The arithmetic operator a typed symbol stands for: a keypad shows the multiplication and division signs where the expression grammar uses * and /.
capitalize_first
Upper-case the first character (by Unicode case mapping, so ß becomes SS) and keep the rest unchanged.
compact_count
Abbreviate a large count to at most one fractional digit: 1.2K, 3.4M, 1.1B. Exact tenths omit the redundant .0 (12K, not 12.0K) and a value that rounds into the next unit is promoted (999_999 becomes 1M, never 1000.0K). Values below 1000 print in full.
count
The count style: 12,345. See Formats::count.
date
The date style: Jun 30, 2026 by default. See Formats::date.
date_of
The date style for a moment’s local calendar day.
day_done
Formats::day_done against today: the heading over what was done on day, in the person’s formats and the desktop’s language.
day_done_today
day_done against the person’s own today (crate::clock::today).
day_fact
The day fact day_fact_today holds, against today: the person’s formats, the language’s words.
day_fact_today
day_fact against the person’s own today (crate::clock::today): the one call a surface makes when it shows a date fact.
day_heading
The day heading style: Tuesday, June 30. See Formats::day_heading.
day_heading_short
The short day heading: Tue, Jun 30. See Formats::day_heading_short.
day_range
A span of days: Jun 23 – 29. See Formats::day_range.
decimal
The decimal style: 3.14. See Formats::decimal.
duration
The duration style: 1 hr 5 min. See Formats::duration.
first_weekday
The first day of the week the person chose.
items
A count of things: 12 items. See Formats::items.
list_date
The list style for at, relative to now: 16:02, Yesterday, Sun, Jun 30, Jun 30, 2025. See Formats::list_date.
memory
The memory style: 5 MiB. See Formats::memory.
moment_fact
The moment fact style for a moment: a time of day, with the short weekday before it when it is not today. See Formats::moment_fact.
money
An amount in millionths of the currency: $5, $0.42, $1,250. See Formats::money.
month_day
Month and day: Jun 30.
month_day_time
A day without its year and a time of day: Jun 30, 14:05. See Formats::month_day_time.
month_day_year
Month, day and year with the month named: Jun 30, 2025.
month_heading
The month heading style: June 2026.
month_heading_short
A month in a tight space: Jun 2026.
month_name
The month’s name (1 = January): June.
month_short
The abbreviated month (1 = January): Jun.
near_day
Name a calendar day next to today in the host’s language — Yesterday, Today, Tomorrow — or None further out, where the caller shows its own date. days_from_today is negative for the past.
parse_money
The millionths of the currency an amount a person typed names: 5, 0.50, 12.5 or $5, read the way money writes them.
percent
A percentage of fraction (0.0..=1.0), whole: 42%.
range
Any span between two formatted values: Mon, Jun 29 – Sun, Jul 5, 9:00 – 10:30.
rate
A transfer rate: 6.7 MB/s. See Formats::rate.
relative
The relative style: a past interval (in seconds) as a coarse label in the host’s language: just now, 3 min ago, 2 hr ago, yesterday, 4 days ago, 2 weeks ago, 3 months ago, 1 year ago. Zero and negative deltas (clock skew) read just now. Counts go through Fluent plurals, so each language words its own singular and plural forms.
relative_ahead
The relative style ahead: a future interval (in seconds) as a coarse label in the host’s language: in a moment, in 3 min, in 2 hr, tomorrow, in 4 days, in 2 weeks, in 3 months, in 1 year. Zero and negative deltas read in a moment.
relative_compact
The relative style for list columns too tight for relative’s wording: now, 3m, 2h, 4d, 2w, 3mo, 1y. Zero and negative deltas (clock skew) read now.
size
The size style: 1.5 MB. See Formats::size.
time
A time of day: 14:05 or 2:05 PM.
time_of
The time of day of a moment: 14:05 or 2:05 PM.
timecode
The timecode style, for media positions and lengths: m:ss under an hour, h:mm:ss from one hour.
timestamp
The timestamp style: Jun 30, 2026, 13:42 by default. See Formats::timestamp.
week
The seven weekdays from the first day of the week the person chose.
weekday_name
The weekday’s name: Sunday.
weekday_short
The abbreviated weekday: Sun.