DateFromString constructor

DateFromString({
  1. @required dynamic dateString,
  2. dynamic format,
  3. dynamic timezone,
  4. dynamic onError,
  5. dynamic onNull,
})

Creates $dateFromString operator expression

Converts a date/time string to a date object.

  • dateString - The date/time string to convert to a date object.
  • format - Optional. The date format specification of the dateString. The format can be any expression that evaluates to a string literal, containing 0 or more format specifiers.
  • {timezone} - Optional. The time zone to use to format the date.
  • onError - Optional. If $dateFromString encounters an error while parsing the given dateString, it outputs the result value of the provided onError expression. This result value can be of any type. If you do not specify onError, $dateFromString throws an error if it cannot parse dateString.
  • onNull - Optional. If the dateString provided to $dateFromString is null or missing, it outputs the result value of the provided onNull expression. This result value can be of any type. If you do not specify onNull and dateString is null or missing, then $dateFromString outputs null.

Implementation

DateFromString({@required dateString, format, timezone, onError, onNull})
    : super(
          'dateFromString',
          AEObject({
            'dateString': dateString,
            'format': format,
            'timezone': timezone,
            'onError': onError,
            'onNull': onNull
          }));