All notable changes to this project will be documented in this file.
number/number_withnow support the T (Trillion) suffix for values ≥ 1 000 000 000 000, including the rounding-promotion check from B → T.
bytes_decimal/bytes_binarynow always show the decimal when the value has been scaled to a sub-unit (KB and above). For example,bytes_decimal(1000)returns"1.0 KB"instead of"1 KB". Raw bytes (unit "B") are unaffected and never show decimals.durationandduration_precisenow handle negative seconds correctly: the sign is stripped, the absolute value is formatted as usual, and a leading-is prepended (e.g.duration(-120)→"-2 minutes").
pow10andpow_intinternal helpers now guard against negative exponents (n ≤ 0returns 1 immediately) so that passingdecimals < 0to any formatting function no longer causes infinite recursion.
- New
time_ago_timestampandtime_ago_timestamp_with_overrideshelpers that takegleam_time/timestamp.Timestampvalues. These build on top of the existing Unix-based APIs and enable seamless integration with thegleam_timeecosystem. - Dependency on
gleam_timefor the new timestamp functions. The classictime_ago_unix*APIs remain dependency‑free for users who don't need them. - Developer convenience: colored output in the
dev/humanize_dev.gleamplayground using awoof.Customformatter.
listbehaved incorrectly for two elements ("ab") and failed to insert the conjunction before the last element when there were three or more items.duration_precise(0)returned an empty string; now prints "0 seconds".- Time‑ago locale data did not support languages where the "ago" word is a
prefix (e.g. French, Spanish); added
ago_prefix: Boolfield and fixed built‑in locales accordingly.
percent_rationow handles negative numerators and denominators and always prints the requested number of decimal places.- Refactored internal helpers (
pow10,pow_int,join_*) to be tail-recursive or iterative to avoid stack overflows.
- Added comprehensive tests for signed and large values in
percent_ratio.
- Initial stable release candidate with public API:
- number, number_with, number_with_opts
- bytes_decimal, bytes_binary (supports up to YB/YiB)
- percent, percent_with, percent_ratio
- duration, duration_precise
- list, list_with_oxford, list_with_ampersand
- ordinal
- time_ago_unix, time_ago_unix_with_overrides, make_locale
- Locale table: built-in locales (it, en, es, fr, de, pt).
- Extensive unit tests covering edge cases, rounding boundaries, negative values, percent spacing, and locale overrides.
- Rounding promotion logic: numbers/bytes now promote to the next unit when rounding overflows (e.g., 999_950 -> 1.0M).
- README updated with examples for edge cases and overrides.
- Ensure percent spacing preserves decimals correctly (e.g. "12.0 %").