chrono-node

  • Version 2.3.2
  • Published
  • 1.35 MB
  • 1 dependency
  • MIT license

Install

npm i chrono-node
yarn add chrono-node
pnpm add chrono-node

Overview

A natural language date parser in Javascript

Index

Variables

variable casual

const casual: Chrono;

    variable strict

    const strict: Chrono;

      Functions

      function parse

      parse: (
      text: string,
      ref?: ParsingReference | Date,
      option?: ParsingOption
      ) => ParsedResult[];

        function parseDate

        parseDate: (
        text: string,
        ref?: ParsingReference | Date,
        option?: ParsingOption
        ) => Date;

          Classes

          class Chrono

          class Chrono {}

            constructor

            constructor(configuration?: Configuration);

              property parsers

              parsers: Parser[];

                property refiners

                refiners: Refiner[];

                  method clone

                  clone: () => Chrono;

                    method parse

                    parse: (
                    text: string,
                    referenceDate?: ParsingReference | Date,
                    option?: ParsingOption
                    ) => ParsedResult[];

                      method parseDate

                      parseDate: (
                      text: string,
                      referenceDate?: ParsingReference | Date,
                      option?: ParsingOption
                      ) => Date | null;

                        Interfaces

                        interface ParsedComponents

                        interface ParsedComponents {}

                          method date

                          date: () => Date;

                            method get

                            get: (component: Component) => number | null;

                              method isCertain

                              isCertain: (component: Component) => boolean;

                                interface ParsedResult

                                interface ParsedResult {}

                                  property end

                                  readonly end?: ParsedComponents;

                                    property index

                                    readonly index: number;

                                      property refDate

                                      readonly refDate: Date;

                                        property start

                                        readonly start: ParsedComponents;

                                          property text

                                          readonly text: string;

                                            method date

                                            date: () => Date;

                                              interface Parser

                                              interface Parser {}

                                                method extract

                                                extract: (
                                                context: ParsingContext,
                                                match: RegExpMatchArray
                                                ) =>
                                                | ParsingComponents
                                                | ParsingResult
                                                | {
                                                year?: number;
                                                month?: number;
                                                day?: number;
                                                weekday?: number;
                                                hour?: number;
                                                minute?: number;
                                                second?: number;
                                                millisecond?: number;
                                                meridiem?: number;
                                                timezoneOffset?: number;
                                                };

                                                  method pattern

                                                  pattern: (context: ParsingContext) => RegExp;

                                                    interface ParsingOption

                                                    interface ParsingOption {}

                                                      property forwardDate

                                                      forwardDate?: boolean;

                                                        property timezones

                                                        timezones?: {
                                                        [tzKeyword: string]: number;
                                                        };

                                                          interface ParsingReference

                                                          interface ParsingReference {}

                                                            property instant

                                                            instant?: Date;

                                                              property timezone

                                                              timezone?: string | number;

                                                                interface Refiner

                                                                interface Refiner {}

                                                                  property refine

                                                                  refine: (context: ParsingContext, results: ParsingResult[]) => ParsingResult[];

                                                                    Enums

                                                                    enum Meridiem

                                                                    enum Meridiem {
                                                                    AM = 0,
                                                                    PM = 1,
                                                                    }

                                                                      member AM

                                                                      AM = 0

                                                                        member PM

                                                                        PM = 1

                                                                          Type Aliases

                                                                          type Component

                                                                          type Component =
                                                                          | 'year'
                                                                          | 'month'
                                                                          | 'day'
                                                                          | 'weekday'
                                                                          | 'hour'
                                                                          | 'minute'
                                                                          | 'second'
                                                                          | 'millisecond'
                                                                          | 'meridiem'
                                                                          | 'timezoneOffset';

                                                                            Namespaces

                                                                            namespace de

                                                                            module 'dist/locales/de/index.d.ts' {}

                                                                              variable casual

                                                                              const casual: Chrono;

                                                                                variable strict

                                                                                const strict: Chrono;

                                                                                  function createCasualConfiguration

                                                                                  createCasualConfiguration: (littleEndian?: boolean) => Configuration;

                                                                                    function createConfiguration

                                                                                    createConfiguration: (
                                                                                    strictMode?: boolean,
                                                                                    littleEndian?: boolean
                                                                                    ) => Configuration;

                                                                                      function parse

                                                                                      parse: (text: string, ref?: Date, option?: ParsingOption) => ParsedResult[];

                                                                                        function parseDate

                                                                                        parseDate: (text: string, ref?: Date, option?: ParsingOption) => Date;

                                                                                          namespace en

                                                                                          module 'dist/locales/en/index.d.ts' {}

                                                                                            variable casual

                                                                                            const casual: Chrono;

                                                                                              variable GB

                                                                                              const GB: Chrono;

                                                                                                variable strict

                                                                                                const strict: Chrono;

                                                                                                  function createCasualConfiguration

                                                                                                  createCasualConfiguration: (littleEndian?: boolean) => Configuration;

                                                                                                    function createConfiguration

                                                                                                    createConfiguration: (
                                                                                                    strictMode?: boolean,
                                                                                                    littleEndian?: boolean
                                                                                                    ) => Configuration;

                                                                                                      function parse

                                                                                                      parse: (text: string, ref?: Date, option?: ParsingOption) => ParsedResult[];

                                                                                                        function parseDate

                                                                                                        parseDate: (text: string, ref?: Date, option?: ParsingOption) => Date;

                                                                                                          namespace fr

                                                                                                          module 'dist/locales/fr/index.d.ts' {}

                                                                                                            variable casual

                                                                                                            const casual: Chrono;

                                                                                                              variable strict

                                                                                                              const strict: Chrono;

                                                                                                                function createCasualConfiguration

                                                                                                                createCasualConfiguration: (littleEndian?: boolean) => Configuration;

                                                                                                                  function createConfiguration

                                                                                                                  createConfiguration: (
                                                                                                                  strictMode?: boolean,
                                                                                                                  littleEndian?: boolean
                                                                                                                  ) => Configuration;

                                                                                                                    function parse

                                                                                                                    parse: (text: string, ref?: Date, option?: ParsingOption) => ParsedResult[];

                                                                                                                      function parseDate

                                                                                                                      parseDate: (text: string, ref?: Date, option?: ParsingOption) => Date;

                                                                                                                        namespace ja

                                                                                                                        module 'dist/locales/ja/index.d.ts' {}

                                                                                                                          variable casual

                                                                                                                          const casual: Chrono;

                                                                                                                            variable strict

                                                                                                                            const strict: Chrono;

                                                                                                                              function createCasualConfiguration

                                                                                                                              createCasualConfiguration: () => Configuration;

                                                                                                                                function createConfiguration

                                                                                                                                createConfiguration: () => Configuration;

                                                                                                                                  function parse

                                                                                                                                  parse: (text: string, ref?: Date, option?: ParsingOption) => ParsedResult[];

                                                                                                                                    function parseDate

                                                                                                                                    parseDate: (text: string, ref?: Date, option?: ParsingOption) => Date;

                                                                                                                                      namespace nl

                                                                                                                                      module 'dist/locales/nl/index.d.ts' {}

                                                                                                                                        variable casual

                                                                                                                                        const casual: Chrono;

                                                                                                                                          variable strict

                                                                                                                                          const strict: Chrono;

                                                                                                                                            function createCasualConfiguration

                                                                                                                                            createCasualConfiguration: (littleEndian?: boolean) => Configuration;

                                                                                                                                              function createConfiguration

                                                                                                                                              createConfiguration: (
                                                                                                                                              strictMode?: boolean,
                                                                                                                                              littleEndian?: boolean
                                                                                                                                              ) => Configuration;

                                                                                                                                                function parse

                                                                                                                                                parse: (text: string, ref?: Date, option?: ParsingOption) => ParsedResult[];

                                                                                                                                                  function parseDate

                                                                                                                                                  parseDate: (text: string, ref?: Date, option?: ParsingOption) => Date;

                                                                                                                                                    namespace pt

                                                                                                                                                    module 'dist/locales/pt/index.d.ts' {}

                                                                                                                                                      variable casual

                                                                                                                                                      const casual: Chrono;

                                                                                                                                                        variable strict

                                                                                                                                                        const strict: Chrono;

                                                                                                                                                          function createCasualConfiguration

                                                                                                                                                          createCasualConfiguration: (littleEndian?: boolean) => Configuration;

                                                                                                                                                            function createConfiguration

                                                                                                                                                            createConfiguration: (
                                                                                                                                                            strictMode?: boolean,
                                                                                                                                                            littleEndian?: boolean
                                                                                                                                                            ) => Configuration;

                                                                                                                                                              function parse

                                                                                                                                                              parse: (text: string, ref?: Date, option?: ParsingOption) => ParsedResult[];

                                                                                                                                                                function parseDate

                                                                                                                                                                parseDate: (text: string, ref?: Date, option?: ParsingOption) => Date;

                                                                                                                                                                  Package Files (8)

                                                                                                                                                                  Dependencies (1)

                                                                                                                                                                  Dev Dependencies (12)

                                                                                                                                                                  Peer Dependencies (0)

                                                                                                                                                                  No peer dependencies.

                                                                                                                                                                  Badge

                                                                                                                                                                  To add a badge like this onejsDocs.io badgeto your package's README, use the codes available below.

                                                                                                                                                                  You may also use Shields.io to create a custom badge linking to https://www.jsdocs.io/package/chrono-node.

                                                                                                                                                                  • Markdown
                                                                                                                                                                    [![jsDocs.io](https://img.shields.io/badge/jsDocs.io-reference-blue)](https://www.jsdocs.io/package/chrono-node)
                                                                                                                                                                  • HTML
                                                                                                                                                                    <a href="https://www.jsdocs.io/package/chrono-node"><img src="https://img.shields.io/badge/jsDocs.io-reference-blue" alt="jsDocs.io"></a>