Skip to content

Issue loading timezone when parsing ZonedDateTimePattern on web  #73

@ejlevin1

Description

@ejlevin1

I'm running into an issue where DateTimeZoneProviders.tzdb isn't loading timezones that aren't explicitly loaded at startup. Is there a way to have timezones dynamically load when trying to be parsed? I should note that if I do an explicit

await tzdb[<timezone name>];

on the timezone being parsed, it works perfectly. Any thoughts on what I'm doing wrong? Note, I'm only seeing this on flutter web.

pubspec:

dependencies:
  time_machine: ^0.9.17

....

  assets:
    - assets/images/
    - assets/svgs/
    - packages/time_machine/data/cultures/cultures.bin
    - packages/time_machine/data/tzdb/tzdb.bin
    - .env

main.dart:

    await TimeMachine.initialize({'rootBundle': rootBundle});
    var tzdb = await DateTimeZoneProviders.tzdb;
    final String currentTimeZone =
        await FlutterNativeTimezone.getLocalTimezone();
    log.info('Loading current timezone of [$currentTimeZone]');
    await tzdb[currentTimeZone];
Screen.Recording.2023-06-09.at.5.19.14.PM.mov

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