@types/dateformat

  • Version 5.0.2
  • Published
  • 5.24 kB
  • No dependencies
  • MIT license

Install

npm i @types/dateformat
yarn add @types/dateformat
pnpm add @types/dateformat

Overview

TypeScript definitions for dateformat

Index

Variables

variable i18n

let i18n: DateFormatI18n;
  • Internationalization strings

    Example 1

    import { i18n } from 'dateformat';

    i18n.dayNames = [ 'Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday' ]; i18n.monthNames = [ 'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec', 'January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December' ]; i18n.timeNames = [ 'a', 'p', 'am', 'pm', 'A', 'P', 'AM', 'PM' ];

variable masks

let masks: DateFormatMasks;
  • Predefined Formats

Functions

function dateFormat

dateFormat: {
(
date?: Date | string | number,
mask?: string,
utc?: boolean,
gmt?: boolean
): string;
(mask?: string, utc?: boolean, gmt?: boolean): string;
};
  • Parameter date

    Defaults to the current date/time.

    Parameter mask

    Defaults to masks.default.

    Returns

    A formatted version of the given date.

function formatTimezone

formatTimezone: (date: string | Date) => string;
  • Get proper timezone abbreviation or timezone offset.

    This will fall back to GMT+xxxx if it does not recognize the timezone within the timezone RegEx above. Currently only common American and Australian timezone abbreviations are supported.

Interfaces

interface DateFormatI18n

interface DateFormatI18n {}

    property dayNames

    dayNames: string[];

      property monthNames

      monthNames: string[];

        property timeNames

        timeNames: string[];

          interface DateFormatMasks

          interface DateFormatMasks {}

            property default

            default: string;
            • "ddd mmm dd yyyy HH:MM:ss"

            property expiresHeaderFormat

            expiresHeaderFormat: string;
            • "ddd, dd mmm yyyy HH:MM:ss Z"

            property fullDate

            fullDate: string;
            • "dddd, mmmm d, yyyy"

            property isoDate

            isoDate: string;
            • "yyyy-mm-dd"

            property isoDateTime

            isoDateTime: string;
            • "yyyy-mm-dd'T'HH:MM:sso"

            property isoTime

            isoTime: string;
            • "HH:MM:ss"

            property isoUtcDateTime

            isoUtcDateTime: string;
            • "UTC:yyyy-mm-dd'T'HH:MM:ss'Z'"

            property longDate

            longDate: string;
            • "mmmm d, yyyy"

            property longTime

            longTime: string;
            • "h:MM:ss TT Z"

            property mediumDate

            mediumDate: string;
            • "mmm d, yyyy"

            property mediumTime

            mediumTime: string;
            • "h:MM:ss TT"

            property paddedShortDate

            paddedShortDate: string;
            • "mm/dd/yyyy"

            property shortDate

            shortDate: string;
            • "m/d/yy"

            property shortTime

            shortTime: string;
            • "h:MM TT"

            index signature

            [key: string]: string;

              Package Files (1)

              Dependencies (0)

              No dependencies.

              Dev Dependencies (0)

              No dev dependencies.

              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/@types/dateformat.

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