Skip to content

Interval

javarome edited this page Nov 1, 2024 · 2 revisions

An interval is an aggregation of one or two dates:

classDiagram
    class Date {
        
    }
    class Interval {
        toString(): string
        fromString(str)$: Interval
    }
    Interval --> Date: start?
    Interval --> Date: end?
Loading

Parsing

Date intervals can be parsed:

import { Level2Interval as EdtfInterval } from "@rr0/time/level2/interval/index.mjs"

const maybeAugust = EdtfDate.fromString("2024/2025-~06")
maybeAugust.start.year      // 2024
maybeAugust.end.year        // 2025
maybeAugust.end.month       // 6
maybeAugust.end.approximate // true
Clone this wiki locally