-
Notifications
You must be signed in to change notification settings - Fork 0
Duration
javarome edited this page Nov 1, 2024
·
2 revisions
A duration is a special type of component whose value has less restricted bounds;
classDiagram
class DateComponent {
value: number
unit: Unit
}
class Duration {
toString(): string
toSpec()
fromString(str)$: Duration
between(dateStart, dateEnd)$: Duration
}
DateComponent <|-- Duration
You can select the API level you want to use. For example using level 0:
import {Level2Duration as Duration} from "@rr0/time"
const aroundTenMinutes = Duration.fromString("P10M~")
aroundTenMinutes.value // 10 * GregorianCalendar.minute.duration
aroundTenMinutes.toSpec().minutes // 10