KubeJS (Old)

KubeJS (Old)

3M Downloads

`UtilsJS#getDuration` not adding up multiple temporal units

andriihorpenko opened this issue ยท 0 comments

commented

Minecraft Version

1.19.2

KubeJS Version

1902.6.2-build.63

Rhino Version

1902.2.3-build.284

Architectury Version

6.6.92

Forge/Fabric Version

Forge 43.3.7

Describe your issue

Description

Not sure if this is an intended behavior, but UtilsJS#getDuration (which acts as a type converter for java.time.Duration) does not add up multiple temporal units.

Example

UtilsJS.getDuration('1h') => return a Duration of 1 hour
UtilsJS#getDuration('1h30m') -> return a Duration of 30 minutes instead of 1 hour and 30 minutes

Notes

I think this function may be improved so that the above example would return a Duration instance of 1 hour and 30 minutes instead of stripping away the 1h bit and parsing 30m only.

Crash report/logs

No response