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:
| Style | Function | English | German |
|---|---|---|---|
| list | list_date | 16:02, Yesterday, Sun, Jun 30, Jun 30, 2025 | 16:02, Gestern, So., 30. Juni, 30. Juni 2025 |
| day fact | day_fact, Formats::day_fact | Overdue, 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 fact | moment_fact, Formats::moment_fact | 15:00, Sat 09:00, Jun 29 09:00 | 15:00, Sa. 09:00, 29. Juni 09:00 |
| timestamp | timestamp | Jun 30, 2026, 13:42 (or ISO 2026-06-30 13:42, …) | 30.06.2026, 13:42 |
| date | date | Jun 30, 2026 (or ISO, US, EU, 30 Jun 2026) | 30.06.2026 (or 30. Juni 2026, Long) |
| time | time | 13:42 or 1:42 PM | 13:42 |
| day heading | day_heading | Tuesday, June 30 | Dienstag, 30. Juni |
| month heading | month_heading | June 2026 | Juni 2026 |
| relative | relative | 3 min ago | vor 3 Min. |
| duration | duration | 1 hr 5 min | 1 Std. 5 Min. |
| timecode | timecode | 1:01:01 | 1:01:01 |
| size | size | 1.5 MB | 1,5 MB |
| memory | memory | 1.5 GiB | 1,5 GiB |
| rate | rate | 6.7 MB/s | 6,7 MB/s |
| count | count, items | 12,345, 12 items | 12.345, 12 Objekte |
| money | money | $5, $0.42, $1,250 | $5, $0,42, $1.250 |
| decimal | decimal | 3.14 | 3,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
localesection 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. - Naive
Date - 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.
- Naive
Date Time - ISO 8601 combined date and time without timezone.
- Naive
Time - ISO 8601 time without timezone. Allows for the nanosecond precision and optional leap second representation.
- Region
Formats - The formats a person chose in Region & Formats.
numberisNoneuntil they choose a number style; the language’s own convention applies then. - Unix
Secs - Seconds since the Unix epoch, as protocols and files keep them.
Enums§
- Date
Style - How dates render: the shared
locale.date_formatsetting. 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. - First
DayOf Week - The day a week starts on, for every calendar grid and week number.
- Number
Style - 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
chronodate and time in any zone, a localNaiveDateTimeorUnixSecs.
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
ßbecomesSS) 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, not12.0K) and a value that rounds into the next unit is promoted (999_999becomes1M, never1000.0K). Values below 1000 print in full. - count
- The count style:
12,345. SeeFormats::count. - date
- The date style:
Jun 30, 2026by default. SeeFormats::date. - date_of
- The date style for a moment’s local calendar day.
- day_
done Formats::day_doneagainsttoday: the heading over what was done onday, in the person’s formats and the desktop’s language.- day_
done_ today day_doneagainst the person’s own today (crate::clock::today).- day_
fact - The day fact
day_fact_todayholds, againsttoday: the person’s formats, the language’s words. - day_
fact_ today day_factagainst 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. SeeFormats::day_heading. - day_
heading_ short - The short day heading:
Tue, Jun 30. SeeFormats::day_heading_short. - day_
range - A span of days:
Jun 23 – 29. SeeFormats::day_range. - decimal
- The decimal style:
3.14. SeeFormats::decimal. - duration
- The duration style:
1 hr 5 min. SeeFormats::duration. - first_
weekday - The first day of the week the person chose.
- items
- A count of things:
12 items. SeeFormats::items. - list_
date - The list style for
at, relative to now:16:02,Yesterday,Sun,Jun 30,Jun 30, 2025. SeeFormats::list_date. - memory
- The memory style:
5 MiB. SeeFormats::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. SeeFormats::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. SeeFormats::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— orNonefurther out, where the caller shows its own date.days_from_todayis negative for the past. - parse_
money - The millionths of the currency an amount a person typed names:
5,0.50,12.5or$5, read the waymoneywrites 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. SeeFormats::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) readjust 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 readin 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) readnow. - size
- The size style:
1.5 MB. SeeFormats::size. - time
- A time of day:
14:05or2:05 PM. - time_of
- The time of day of a moment:
14:05or2:05 PM. - timecode
- The timecode style, for media positions and lengths:
m:ssunder an hour,h:mm:ssfrom one hour. - timestamp
- The timestamp style:
Jun 30, 2026, 13:42by default. SeeFormats::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.