Tempo API
    Preparing search index...

    Interface TermPlugin

    Interface for term-driven parsing and resolution.

    interface TermPlugin {
        aliases?: string[] | readonly string[];
        define: (
            this: Tempo,
            keyOnly?: boolean,
            anchor?: any,
            alias?: string,
        ) =>
            | string
            | Range
            | ResolvedRange
            | readonly (Range | ResolvedRange)[]
            | (Range | ResolvedRange)[]
            | null
            | undefined;
        description?: string;
        groups?: any;
        key: string;
        locale?: Record<string, string | Function>;
        options?: any;
        ranges?: any[] | readonly any[];
        resolve?: (
            this: Tempo,
            anchor?: any,
            alias?: string,
        ) => readonly (Range | ResolvedRange)[] | (Range | ResolvedRange)[];
        scope?: string;
        version?: string;
        [key: string]: any;
        [key: symbol]:
            | (
                (
                    input: string,
                    context?: TermParseContext,
                ) => ZonedDateTime | Tempo | undefined
            )
            | (
                (
                    groups: Record<string, any>,
                    anchor: Tempo,
                    context?: TermParseContext,
                ) => ZonedDateTime | Tempo | undefined
            )
            | (
                (
                    unit: string,
                    count: number,
                    tempo: Tempo,
                ) => ZonedDateTime | Tempo | undefined
            )
            | ((other: Tempo, unit: string, tempo: Tempo) => number | undefined)
            | (
                (
                    boundary: "start" | "mid" | "end",
                    unit: string,
                    tempo: Tempo,
                ) => ZonedDateTime | Tempo | undefined
            )
            | ((token: string, tempo: Tempo) => string | undefined)
            | undefined;
    }

    Hierarchy (View Summary)

    Indexable

    • [key: string]: any
    • [key: symbol]:
          | (
              (
                  input: string,
                  context?: TermParseContext,
              ) => ZonedDateTime | Tempo | undefined
          )
          | (
              (
                  groups: Record<string, any>,
                  anchor: Tempo,
                  context?: TermParseContext,
              ) => ZonedDateTime | Tempo | undefined
          )
          | (
              (
                  unit: string,
                  count: number,
                  tempo: Tempo,
              ) => ZonedDateTime | Tempo | undefined
          )
          | ((other: Tempo, unit: string, tempo: Tempo) => number | undefined)
          | (
              (
                  boundary: "start" | "mid" | "end",
                  unit: string,
                  tempo: Tempo,
              ) => ZonedDateTime | Tempo | undefined
          )
          | ((token: string, tempo: Tempo) => string | undefined)
          | undefined
    Index
    aliases?: string[] | readonly string[]

    Optional secondary alias keys for the term

    define: (
        this: Tempo,
        keyOnly?: boolean,
        anchor?: any,
        alias?: string,
    ) =>
        | string
        | Range
        | ResolvedRange
        | readonly (Range | ResolvedRange)[]
        | (Range | ResolvedRange)[]
        | null
        | undefined

    Defines the term's value or range

    description?: string

    Human-readable description of the term

    groups?: any

    Grouping information for the term

    key: string

    Unique identifier for the term

    locale?: Record<string, string | Function>

    Locale-specific term translations

    options?: any

    Colocated or runtime configuration options

    ranges?: any[] | readonly any[]

    Array of time ranges this term represents

    resolve?: (
        this: Tempo,
        anchor?: any,
        alias?: string,
    ) => readonly (Range | ResolvedRange)[] | (Range | ResolvedRange)[]

    Resolves the term to concrete time ranges

    scope?: string

    Scope or category of the term

    version?: string

    Version of the term plugin