-
Notifications
You must be signed in to change notification settings - Fork 0
Unit
javarome edited this page Feb 4, 2025
·
1 revision
Time units are referenced by calendar values.
classDiagram
class TimeUnit {
name: string
min: number
max: number
duration: number
validate(value)
}
class EDTFValidator {
name: string
validate(value)
}
TimeUnit --> TimeUnit: subUnit
TimeUnit --> EDTFValidator: validator
A time unit is Iterable
, which means you can get all its possible values:
// Will output 0 to 9999
for (let year of level0YearUnit) {
const isLeap = GregorianCalendar.isLeap(year)
console.log(year, isLeap)
}
classDiagram
class TimeUnit {
}
class YearUnit {
}
TimeUnit <|-- YearUnit
class MonthUnit {
}
TimeUnit <|-- MonthUnit
class DayUnit {
}
TimeUnit <|-- DayUnit
class HourUnit {
}
TimeUnit <|-- HourUnit
class MinuteUnit {
}
TimeUnit <|-- MinuteUnit
class SecondUnit {
}
TimeUnit <|-- SecondUnit
classDiagram
class YearUnit {
isLeap()$: boolean
}
classDiagram
class MonthUnit {
create(monthValue, yearValue): MonthUnit$
}
There is a validator implementation that checks that a value is inside an allowed range of values:
classDiagram
class EDTFValidator {
}
class MinMaxValidator {
min: number
max: number
}
EDTFValidator <|-- MinMaxValidator
classDiagram
class TimeUnit {
}
class YearUnit {
}
TimeUnit <|-- YearUnit
class MonthUnit {
}
TimeUnit <|-- MonthUnit
class DayUnit {
}
TimeUnit <|-- DayUnit
class HourUnit {
}
TimeUnit <|-- HourUnit
class MinuteUnit {
}
TimeUnit <|-- MinuteUnit
class SecondUnit {
}
TimeUnit <|-- SecondUnit
class TimeUnits {
}
TimeUnit --> TimeUnit: subUnit
TimeUnits --> TimeUnit: millisecond
TimeUnits --> TimeUnit: second
TimeUnits --> TimeUnit: minute
TimeUnits --> TimeUnit: hour
TimeUnits --> TimeUnit: day
TimeUnits --> TimeUnit: month
TimeUnits --> TimeUnit: year