NepaliTimeFormatter

Parse and format SimpleTime as the library's canonical time-of-day wire string, HH:mm:ss with an optional nine-digit fractional part.

This is the shape a SimpleTime takes on the wire everywhere the library is published. The optional nepali-date-picker-serialization artifact's SimpleTimeSerializer emits and accepts exactly these strings, so a Kotlin backend, a Swift client and a JavaScript client agree on the payload without any of them depending on kotlinx-serialization.

Times are always read as Asia/Kathmandu, the zone every SimpleTime in this library is anchored to. No zone offset is written or accepted.

For display output (12-hour clocks, Devanagari digits, locale-aware wording) use NepaliDateConverter.getFormattedTimeInEnglish, getFormattedTimeInNepali, or NepaliDateConverter.formatTimeByUnicodePattern. This formatter is for persistence and transport, and is fixed to Latin digits and 24-hour form on purpose.

See also

for the matching YYYY-MM-DD date wire form.

Functions

Link copied to clipboard

Format time as HH:mm:ss, appending .nnnnnnnnn only when SimpleTime.nanosecond is non-zero, so whole-second payloads stay compact.

Link copied to clipboard
fun parse(input: String): SimpleTime?

Parse input as HH:mm:ss or HH:mm:ss.nnnnnnnnn, returning null when it is not a time this formatter would have produced.