-
Notifications
You must be signed in to change notification settings - Fork 0
Home
javarome edited this page Nov 8, 2024
·
4 revisions
Welcome to the time wiki!
To reflect the EDTF standard levels, the API is split in level-specific sub-packages.
classDiagram
namespace level0 {
class Level0Date {
}
class Level0Duration {
}
class Level0Interval {
}
}
namespace level1 {
class Level1Date {
uncertain: boolean
approximate: boolean
}
class Level1Duration {
}
class Level1Interval {
}
}
namespace level2 {
class Level2Date {
}
class Level2Duration {
}
class Level2Interval {
}
}
Level0Date <|-- Level1Date
Level1Date <|-- Level2Date
Level1Duration <|-- Level2Duration
Level0Interval <|-- Level1Interval
Level1Interval <|-- Level2Interval
You can use Level0Date only for instance, but using Level2Date will implicitly rely on Level1Date which implicitly rely on Level0Date,
as each of those standards are extending one on another.
classDiagram
namespace level0 {
class Level0Duration {
}
class Level0Date {
year?
month?
day?
hour?
minute?
second?
getTime(): number
compare(otherDate): number
isEqual(otherDate): boolean
isBefore(otherDate): boolean
isAfter(otherDate): boolean
delta(otherDate): Duration
toString(): string
fromString(str)$: Level0Date
newInstance()$: Level0Date
}
class Level0Component {
value: number
}
class Level0Year {
}
class Level0Month {
}
class Level0Day {
}
class Level0Hour {
}
class Level0Minute {
}
class Level0Second {
}
}
namespace level1 {
class Level1Date {
uncertain: boolean
approximate: boolean
}
}
namespace level2 {
class Level2Date {
}
}
Level0Component <|-- Level0Year
Level0Component <|-- Level0Month
Level0Component <|-- Level0Day
Level0Component <|-- Level0Hour
Level0Component <|-- Level0Minute
Level0Component <|-- Level0Second
Level0Component --> TimeUnit: unit
TimeUnit --> TimeUnit: subUnit
TimeUnit --> EDTFValidator: validator
Level0Date --> Level0Year: year?
Level0Date --> Level0Month: month?
Level0Date --> Level0Day: day?
Level0Date --> Level0Hour: hour?
Level0Date --> Level0Minute: minute?
Level0Date --> Level0Second: second?
Level0Date <|-- Level1Date
Level1Date <|-- Level2Date
To allow using only what you need, the API is exported per level.
You can import a type from its precise location:
import { Level2Date } from "@rr0/time/src/level2/date/Level2Date.mjs"or from package root (but it will load all code):
import { Level2Date } from "@rr0/time"You can also add the alias of your choice to an imported type:
import { Level2Date as EdtfDate } from "@rr0/time"