This is a java.text.SimpleDateFormat wrapper for Moment.js.

Hierarchy

  • SimpleDateFormat

Methods

Methods

  • Formats the date with the specified format to it's string representation.

    Parameters

    • Optional input: Date

    Returns string

    Example

    new ix.text.SimpleDateFormat("dd.MM.yyyy").format(new Date(2021, 1 - 1, 01));
    // returns "01.01.2021"
  • Parses the given string to date, if possible.

    Parameters

    • input: string

      A string which should be parsed to date.

    • Optional baseDate: Date

      The base date which sould be used for parsing.

    Returns undefined | Date

    Example

    new ix.text.SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'").parse("2021-01-01T20:55:43.000Z");
    // returns a Date object `Fri Jan 01 2021 20:55:43 GMT+0100 (Central European Standard Time)`