how am I supposed to create a `kotlin.time.Duratio...
# getting-started
e
how am I supposed to create a
kotlin.time.Duration
from something like
d-hh:mm:ss
? Combining
d.toDuration(DAYS) + hh.toDuration(HOURS)
and so on? If yes, I find java
Duration
better in this regards, because you can parse it from a `String`:
Duration.parse("..")
j
There are
Duration.parse
and
Duration.parseIsoString
methods on Kotlin's Duration, but they only support specific formats for now (not custom). You need to pass an ISO string such as
P1DT13H
, or something more human friendly that's the output of Kotlin
Duration.toString()
like
1h 30m
e
I don't see any parsing function, 1.5.21
j
I think this may have been introduced in 1.5.30
e
damn, you are right
e
I prefer to stay aligned with the embedded kotlin in gradle for the moment
I'd profit of the bridge conversion methods between kotlin and java `Duration`s
j
If you're writing a Gradle plugin I understand, otherwise you really don't need to stick with the Kotlin version used by Gradle
e
I'm writing a lib for scripts and ki
I was bitten hard by a misalignment in the recent past
j
I see yes, but still this only applies to Gradle plugins (or
buildSrc
code which is kind of a plugin too)