Skip to content

Error when parsing date with timezone offset #79

Description

@EugenIvanushkin

Hello!
I'm trying to parse date time with timezone offset:

await TimeMachine.initialize({'rootBundle': rootBundle});
var localClone =
      ZonedDateTimePattern.createWithInvariantCulture('yyyy-MM-ddTHH:mm z')
          .parse("2024-01-31T06:13 +02:00");

And get the following error:

E/flutter (13788): [ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: The specified time zone identifier is not recognized. Value being parsed: '2024-01-31T06:13 ^+02:00'. (^ indicates error position.)
E/flutter (13788): #0      ParseResult.getValueOrThrow (package:time_machine/src/text/parse_result.dart:62:5)
E/flutter (13788): #1      ParseResult.value (package:time_machine/src/text/parse_result.dart:36:18)
E/flutter (13788): #2      main (package:alean_travel/main.dart:45:20)
E/flutter (13788): <asynchronous suspension>

What a proper way to parse date with offset?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions