Options
All
  • Public
  • Public/Protected
  • All
Menu

Interface Parser

An abstraction for Chrono Parser.

Each parser should recognize and handle a certain date format. Chrono uses multiple parses (and refiners) together for parsing the input.

The parser implementation must provide pattern() for the date format.

The extract() method is called with the pattern's match. The matching and extracting is controlled and adjusted to avoid for overlapping results.

Hierarchy

  • Parser

Index

Methods

Methods

extract

  • extract(context: ParsingContext, match: RegExpMatchArray): ParsingComponents | ParsingResult | { day: any; hour: any; meridiem: any; millisecond: any; minute: any; month: any; second: any; timezoneOffset: any; weekday: any; year: any }
  • Parameters

    • context: ParsingContext
    • match: RegExpMatchArray

    Returns ParsingComponents | ParsingResult | { day: any; hour: any; meridiem: any; millisecond: any; minute: any; month: any; second: any; timezoneOffset: any; weekday: any; year: any }

pattern

  • pattern(context: ParsingContext): RegExp
  • Parameters

    • context: ParsingContext

    Returns RegExp

Generated using TypeDoc