API reference / @evolu/common / Time / DurationString
Type Alias: DurationString
type DurationString =
| `${D}ms`
| `${D}${D}ms`
| `${D}${D}${D}ms`
| `${MmSs}s`
| `${MmSs}m`
| `${Hours}h`
| `${Days}d`
| `${MmSs}s ${D}ms`
| `${MmSs}s ${D}${D}ms`
| `${MmSs}s ${D}${D}${D}ms`
| `${MmSs}m ${MmSs}s`
| `${Hours}h ${MmSs}m`
| `${Days}d ${Hours}h`;
Defined in: packages/common/src/Time.ts:95
Template literal type for compile-time validated duration strings.
Allowed patterns: basic units (ms, s, m, h, d) and logical combinations (s+ms, m+s, h+m, d+h).
Supported formats:
- Milliseconds:
0ms,1ms,500ms,999ms - Seconds:
5s,30s(1-59, single digit for 1-9) - Minutes:
5m,30m(1-59, single digit for 1-9) - Hours:
1h,12h,23h(1-23) - Days:
1d,30d,99d(1-99) - Combinations:
1s 250ms,30m 15s,2h 45m,7d 12h
Note: Duration strings are for developer experience only - they provide readable, compile-time validated expressions but should never be persisted or parsed from users as they are not localized. Always convert to NonNegativeInt (milliseconds) for storage and APIs.