Closed MMauro94 closed 5 years ago
Sure!
Do you know why Java has duplicate method names here? toDays()
vs toDaysPart()
, toHours()
vs toHoursPart()
etc.?
Theirs docs are mostly copy/pastes, so I can just assume these methods are doing the same thing. The only difference being that the methods ending in Part()
have been introduced in Java 9, so maybe they plan to deprecated the old ones?
The toX()
functions return the total number of units, instead of their "part".
Example:
Duration d = Duration.parse("PT1H30M20S"); //1 hour, 30 minutes, 20 seconds
d.toHours(); // 1
d.toHoursPart(); // 1
d.toMinutes(); // 90
d.toMinutesPart(); // 30
d.toSeconds(); // 5420
d.toSecondsPart(); // 20
Oh right, this makes sense. I'll add both versions then!
Hi! First of all thanks for the great work!
Would it be possible to add the following functions to the
Duration
class:toDaysPart()
toHoursPart()
toMinutesPart()
toSecondsPart()
toNanosPart()
They should mimic the behavior of java.time.Duration.
As far as I can see the logic is already implemented in the
__toString()
function, so it should be quite easy to extract into functions.