Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UTC time not correctly parsed #14

Open
vanlooverenkoen opened this issue Feb 29, 2024 · 1 comment
Open

UTC time not correctly parsed #14

vanlooverenkoen opened this issue Feb 29, 2024 · 1 comment

Comments

@vanlooverenkoen
Copy link

vanlooverenkoen commented Feb 29, 2024

The F1 ics returns utc date times:

DTSTART:20240302T150000Z
DTEND:20240302T170000Z
SUMMARY:🏁 FORMULA 1 GULF AIR BAHRAIN GRAND PRIX 2024 - Race

URL: webcal://ics.ecal.com/ecal-sub/65d5e5b6532bea0008b2ee55/Formula%201.ics

But they are not parsed correctly. They are parsed as local time. I live in belgium so I get:

20240302T150000
20240302T170000

If I convert this to utc it becomes:

20240302T150000Z
20240302T160000Z

The output for my local time should be:

20240302T160000
20240302T180000
@robert-virkus
Copy link
Member

Hey, thanks for your report! I believe this still works as expected after verifying this with the following test case:

test(
        'UTC time parsing test',
        () {
          const text = '''BEGIN:VCALENDAR
VERSION:3.0
BEGIN:VEVENT
UID:[email protected]
DTSTAMP:20240302T150000Z
DTSTART:20240302T150000Z
DTEND:20240302T170000Z
SUMMARY:🏁 FORMULA 1 GULF AIR BAHRAIN GRAND PRIX 2024 - Race
END:VEVENT
END:VCALENDAR''';
          final calendar = VComponent.parse(text);
          expect(calendar, isA<VCalendar>());
          expect(calendar.children, isNotEmpty);
          expect(calendar.children.length, 1);
          expect(calendar.version, '3.0');
          final event = calendar.children.first;
          expect(event, isA<VEvent>());
          expect(
            (event as VEvent).summary,
            '🏁 FORMULA 1 GULF AIR BAHRAIN GRAND PRIX 2024 - Race',
          );
          expect(event.start, DateTime.utc(2024, 03, 02, 15, 00, 00));
          expect(event.end, DateTime.utc(2024, 03, 02, 17, 00, 00));
        },
      );

All date times given by the API are returned in UTC. Can you show me your code how you handle the dates?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants