def Iso8601.show_duration.go
bend-time-lib@0.4.0.1 · iso8601.bend:133
import bend-time-lib@0.4.0.1/iso8601.bend as Iso8601
import Base
133def Iso8601.show_duration.go(
134 +days: U32, +h: U32, +mi: U32, +s: U32, +nanos: U32, has_d: Bool, has_t: Bool
135) -> String:
136 match has_d has_t:
137 case False{} False{}:
138 "PT0S"
139 case True{} False{}:
140 String.append("P", String.append(Iso8601.show_u32(days), "D"))
141 case False{} True{}:
142 String.append("PT", Iso8601.show.t(h, mi, s, nanos))
143 case True{} True{}:
144 String.append(
145 "P",
146 String.append(
147 Iso8601.show_u32(days),
148 String.append("DT", Iso8601.show.t(h, mi, s, nanos))
149 )
150 )