Offset.parse constructor

  1. @Possible({FormatException, RangeError})
Offset.parse(
  1. String offset
)

Creates an Offset from the formatted offset.

The following formats, including the result of toString, are accepted:

  • Z - for UTC
  • +h
  • +hh
  • +hh:mm
  • -hh:mm
  • +hhmm
  • -hhmm
  • +hh:mm:ss
  • -hh:mm:ss
  • +hhmmss
  • -hhmmss

Contract

Throws RangeError if offset is outside the valid range. Throws FormatException if offset is malformed.

Example

Offset.parse('-01:02:03'); // '-01:02:03'

Offset.parse('-1:2:3') // throws FormatException

Offset.parse('-19:00:00'); // throws RangeError

Implementation

@Possible({FormatException, RangeError})
factory Offset.parse(String offset) => _Offset.parse(offset);