core/utils/format library

Functions

durationToLocalMidnight(DateTime now, int daysLeft) → Duration
Time remaining until DEVICE-LOCAL midnight daysLeft days from today.
fmtDur(Duration d) → String
Formats a Duration as "mm:ss" (minutes:seconds, each part 2 digits). Used for the reconnect countdown on Home / Level Select / World Map.
fmtDurLong(Duration d) → String
Formats Duration as "mm:ss" when under an hour (same as fmtDur), or "hh:mm:ss" once it reaches an hour — for longer timers (energy/lives refill, boss events) where fmtDur would wrap and understate the time left. fmtDur itself is untouched (kept for its existing short-timer contract); use this one for anything that can run past 60 minutes.
fmtNum(int n) → String
Formats a large integer (coins, score, price, boss HP…) with a THOUSANDS SEPARATOR matching the CURRENT LANGUAGE: vi → "10.000", en → "10,000", de → "10.000"… Uses NumberFormat (intl) keyed on Get.locale; if the locale is unknown/has no data, falls back to manual grouping with '.' (Vietnamese-style) so it NEVER throws.
fmtNumCompact(num n) → String
Abbreviates large numbers (idle/tycoon-scale coin balances) as 1.5K/2.4M/10.8B/1T, one decimal place, trailing .0 dropped. Below 1000 falls back to fmtNum (locale-aware thousands separator).