@date-io/date-fns

  • Version 3.0.0
  • Published
  • 50 kB
  • 1 dependency
  • MIT license

Install

npm i @date-io/date-fns
yarn add @date-io/date-fns
pnpm add @date-io/date-fns

Overview

Abstraction over common javascript date management libraries

Index

Classes

class DateFnsUtils

class DateFnsUtils implements IUtils<Date, Locale> {}

    constructor

    constructor({
    locale,
    formats,
    }?: {
    formats?: DateIOFormats;
    locale?: any;
    instance?: any;
    });

      property addDays

      addDays: (value: Date, count: number) => Date;

        property addHours

        addHours: (value: Date, count: number) => Date;

          property addMinutes

          addMinutes: (value: Date, count: number) => Date;

            property addMonths

            addMonths: (value: Date, count: number) => Date;

              property addSeconds

              addSeconds: (value: Date, count: number) => Date;

                property addWeeks

                addWeeks: (value: Date, count: number) => Date;

                  property addYears

                  addYears: (value: Date, count: number) => Date;

                    property endOfDay

                    endOfDay: (value: Date) => Date;

                      property endOfMonth

                      endOfMonth: (value: Date) => Date;

                        property endOfWeek

                        endOfWeek: (value: Date) => Date;

                          property endOfYear

                          endOfYear: (value: Date) => Date;

                            property format

                            format: (date: Date, formatKey: keyof DateIOFormats) => string;

                              property formatByString

                              formatByString: (date: Date, formatString: string) => string;

                                property formatNumber

                                formatNumber: (numberToFormat: string) => string;

                                  property formats

                                  formats: DateIOFormats;

                                    property getCurrentLocaleCode

                                    getCurrentLocaleCode: () => string;

                                      property getDate

                                      getDate: (date: Date) => number;

                                        property getDaysInMonth

                                        getDaysInMonth: (date: Date) => number;

                                          property getDiff

                                          getDiff: (value: Date, comparing: Date | string, unit?: Unit) => number;

                                            property getFormatHelperText

                                            getFormatHelperText: (format: string) => string;

                                              property getHours

                                              getHours: (value: Date) => number;

                                                property getMeridiemText

                                                getMeridiemText: (ampm: 'am' | 'pm') => 'AM' | 'PM';

                                                  property getMinutes

                                                  getMinutes: (date: Date) => number;

                                                    property getMonth

                                                    getMonth: (date: Date) => number;

                                                      property getMonthArray

                                                      getMonthArray: (date: Date) => Date[];

                                                        property getNextMonth

                                                        getNextMonth: (date: Date) => Date;

                                                          property getPreviousMonth

                                                          getPreviousMonth: (date: Date) => Date;

                                                            property getSeconds

                                                            getSeconds: (value: Date) => number;

                                                              property getWeekArray

                                                              getWeekArray: (date: Date) => Date[][];

                                                                property getWeekdays

                                                                getWeekdays: () => string[];

                                                                  property getYear

                                                                  getYear: (value: Date) => number;

                                                                    property getYearRange

                                                                    getYearRange: (start: Date, end: Date) => Date[];

                                                                      property is12HourCycleInCurrentLocale

                                                                      is12HourCycleInCurrentLocale: () => boolean;

                                                                        property isAfter

                                                                        isAfter: (value: Date, comparing: Date) => boolean;

                                                                          property isAfterDay

                                                                          isAfterDay: (date: Date, value: Date) => boolean;

                                                                            property isAfterYear

                                                                            isAfterYear: (date: Date, value: Date) => boolean;

                                                                              property isBefore

                                                                              isBefore: (value: Date, comparing: Date) => boolean;

                                                                                property isBeforeDay

                                                                                isBeforeDay: (date: Date, value: Date) => boolean;

                                                                                  property isBeforeYear

                                                                                  isBeforeYear: (date: Date, value: Date) => boolean;

                                                                                    property isEqual

                                                                                    isEqual: (date: any, comparing: any) => boolean;

                                                                                      property isNull

                                                                                      isNull: (date: Date) => boolean;

                                                                                        property isSameDay

                                                                                        isSameDay: (value: Date, comparing: Date) => boolean;

                                                                                          property isSameHour

                                                                                          isSameHour: (value: Date, comparing: Date) => boolean;

                                                                                            property isSameMonth

                                                                                            isSameMonth: (value: Date, comparing: Date) => boolean;

                                                                                              property isSameYear

                                                                                              isSameYear: (value: Date, comparing: Date) => boolean;

                                                                                                property isValid

                                                                                                isValid: (value: any) => boolean;

                                                                                                  property isWithinRange

                                                                                                  isWithinRange: (date: Date, [start, end]: [Date, Date]) => boolean;

                                                                                                    property lib

                                                                                                    lib: string;

                                                                                                      property locale

                                                                                                      locale?: any;

                                                                                                        property mergeDateAndTime

                                                                                                        mergeDateAndTime: (date: Date, time: Date) => Date;

                                                                                                          property parse

                                                                                                          parse: (value: string, formatString: string) => Date | null;

                                                                                                            property parseISO

                                                                                                            parseISO: (isoString: string) => Date;

                                                                                                              property setDate

                                                                                                              setDate: (date: Date, count: number) => Date;

                                                                                                                property setHours

                                                                                                                setHours: (value: Date, count: number) => Date;

                                                                                                                  property setMinutes

                                                                                                                  setMinutes: (value: Date, count: number) => Date;

                                                                                                                    property setMonth

                                                                                                                    setMonth: (date: Date, count: number) => Date;

                                                                                                                      property setSeconds

                                                                                                                      setSeconds: (value: Date, count: number) => Date;

                                                                                                                        property setYear

                                                                                                                        setYear: (value: Date, count: number) => Date;

                                                                                                                          property startOfDay

                                                                                                                          startOfDay: (value: Date) => Date;

                                                                                                                            property startOfMonth

                                                                                                                            startOfMonth: (value: Date) => Date;

                                                                                                                              property startOfWeek

                                                                                                                              startOfWeek: (value: Date) => Date;

                                                                                                                                property startOfYear

                                                                                                                                startOfYear: (value: Date) => Date;

                                                                                                                                  property toISO

                                                                                                                                  toISO: (value: Date) => string;

                                                                                                                                    property toJsDate

                                                                                                                                    toJsDate: (value: Date) => Date;

                                                                                                                                      method date

                                                                                                                                      date: <
                                                                                                                                      TArg extends unknown = undefined,
                                                                                                                                      TRes extends unknown = TArg extends null
                                                                                                                                      ? null
                                                                                                                                      : TArg extends undefined
                                                                                                                                      ? Date
                                                                                                                                      : Date
                                                                                                                                      >(
                                                                                                                                      value?: TArg
                                                                                                                                      ) => TRes;

                                                                                                                                        method isAfterMonth

                                                                                                                                        isAfterMonth: (value: Date, comparing: Date) => boolean;

                                                                                                                                          method isBeforeMonth

                                                                                                                                          isBeforeMonth: (value: Date, comparing: Date) => boolean;

                                                                                                                                            Package Files (2)

                                                                                                                                            Dependencies (1)

                                                                                                                                            Dev Dependencies (3)

                                                                                                                                            Peer Dependencies (1)

                                                                                                                                            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/@date-io/date-fns.

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