Expression Language Reference
    Preparing search index...

    Interface IDateFunctions

    interface IDateFunctions {
        now: Date;
        parse: (
            dateString: string,
            formatString: string,
            referenceDate: number | Date,
            options?: {
                firstWeekContainsDate?: 1 | 2 | 3 | 4 | 5 | 6 | 7;
                locale?: Locale;
                useAdditionalDayOfYearTokens?: boolean;
                useAdditionalWeekYearTokens?: boolean;
                weekStartsOn?: 0 | 1 | 2 | 3 | 4 | 5 | 6;
            },
        ) => Date;
        parseISO: (
            argument: string,
            options?: { additionalDigits?: 0 | 1 | 2 },
        ) => Date;
        toAbsolute: (x: string | Date, defValue?: string) => string;
        today: string;
        dateTimeFromSerial(days: number): Date;
        format(dt: Date, fmt?: string): string;
        fromISO(value: string): string;
        fromSerial(days: number): string;
        fromString(
            value: string,
            format?: string | DateFmtEntry[],
            refDate?: Date,
        ): Date;
    }
    Index

    Properties

    now: Date

    Get the current date and time as a date object

    Date

    parse: (
        dateString: string,
        formatString: string,
        referenceDate: number | Date,
        options?: {
            firstWeekContainsDate?: 1 | 2 | 3 | 4 | 5 | 6 | 7;
            locale?: Locale;
            useAdditionalDayOfYearTokens?: boolean;
            useAdditionalWeekYearTokens?: boolean;
            weekStartsOn?: 0 | 1 | 2 | 3 | 4 | 5 | 6;
        },
    ) => Date

    Parse date from a string

    Type declaration

      • (
            dateString: string,
            formatString: string,
            referenceDate: number | Date,
            options?: {
                firstWeekContainsDate?: 1 | 2 | 3 | 4 | 5 | 6 | 7;
                locale?: Locale;
                useAdditionalDayOfYearTokens?: boolean;
                useAdditionalWeekYearTokens?: boolean;
                weekStartsOn?: 0 | 1 | 2 | 3 | 4 | 5 | 6;
            },
        ): Date
      • Parameters

        • dateString: string

          a string with a date value

        • formatString: string

          The date format expected

        • referenceDate: number | Date

          The reference date to handle ambiguity or relative dates

        • Optionaloptions: {
              firstWeekContainsDate?: 1 | 2 | 3 | 4 | 5 | 6 | 7;
              locale?: Locale;
              useAdditionalDayOfYearTokens?: boolean;
              useAdditionalWeekYearTokens?: boolean;
              weekStartsOn?: 0 | 1 | 2 | 3 | 4 | 5 | 6;
          }

          additional parsing options

        Returns Date

        Date

    parseISO: (argument: string, options?: { additionalDigits?: 0 | 1 | 2 }) => Date

    Parse a date currently in ISO format

    Type declaration

      • (argument: string, options?: { additionalDigits?: 0 | 1 | 2 }): Date
      • Parameters

        • argument: string

          ISO format date to convert to date object

        • Optionaloptions: { additionalDigits?: 0 | 1 | 2 }

        Returns Date

        Date string

    toAbsolute: (x: string | Date, defValue?: string) => string

    Extra the "Day" of a date object and return it as a string in YYYY-MM-DD format.

    Type declaration

      • (x: string | Date, defValue?: string): string
      • Convert a date value to a string containing only the date parts Throws an exception if the input date cannot be parsed.

        Parameters

        • x: string | Date

          Date object or a parseable date string (parsing is done using parseISO)

        • defValue: string = "---"

          Default value to a return if input date is null or undefined

        Returns string

        A string containing a formatted date or the defValue

    string

    today: string

    Get the current date in YYYY-MM-DD format

    string

    Methods

    • Convert an excel compatible serial to a Date object

      Parameters

      • days: number

        Excel serial value

      Returns Date

      Date The equivalent date as a Date object

    • Format a date as a string

      Parameters

      • dt: Date

        The date to format

      • Optionalfmt: string

        The date format

      Returns string

      string The formatted date

    • Given a string value in ISO format

      Parameters

      • value: string

      Returns string

      string in YYYY-MM-DD foramt

    • convert an excel compatibitl date serial into a string date in the format YYYY-MM-DD

      Parameters

      • days: number

        excel serial value

      Returns string

      string