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

New Release & FFI #76

Open
dickermoshe opened this issue Jan 23, 2025 · 11 comments
Open

New Release & FFI #76

dickermoshe opened this issue Jan 23, 2025 · 11 comments

Comments

@dickermoshe
Copy link

Timezones have changed in the past 19 months
@Pante Can we get another release?

Additionally, would you be interested in a PR which would get Timezones from the system using FFI.

Having to update software whenever the tz databases changes is a big pain.
On the other hand, sugar works on devices that don't get system updates.

@Pante
Copy link
Member

Pante commented Jan 24, 2025

Sure! I'll be honest I'm surprised that there's people using Sugar. I'll probably skip 2024 and use the 2025 version.

Additionally, would you be interested in a PR which would get Timezones from the system using FFI.

Do you mean retrieving the TZ databases from the OS? I think having an option to do that would be awesome but I'm not too sure how difficult it will be.

@dickermoshe
Copy link
Author

I'm having a blast writing the FFI for it.

However, windows doesn't contain a full IANA database, so it won't be possible to add it to this package without breaking changes.

I'm going to add this to the timezone package instead because it doesn't expose all the info in the IANA db, after we'll see how it could be added here.

Also, because things in this package are int UintList to save space, it's hard to wrap my head around what goes where.

This is a great paackage, I'll try to add it here after.
ForUI is really nice too. Thanks!

(A Nested header widget wont show a title if a leading or trailing widget aren't provided tho. Too lazy to open a bug report)

@Pante
Copy link
Member

Pante commented Jan 24, 2025

Ah I think breaking changes are totally fine! The next slated release is actually Sugar 4.0.0 which introduces a couple of breaking changes, a few more won't hurt.

The UintList will probably change in the new release as I completely overlooked dart2js not supporting longs natively.

@dickermoshe
Copy link
Author

Also windows contains NO historical data

@dickermoshe
Copy link
Author

So i guess the ransition list is not super acurate

@Pante
Copy link
Member

Pante commented Jan 24, 2025

Perhaps it might make sense to default to the baked-in tzdb if the OS's tzdb cannot be found or something similar.

@dickermoshe
Copy link
Author

Also windows contains NO historical data

This means that windows thinks that there was DST in the USA in the year 1700.

@dickermoshe
Copy link
Author

This is more than just a breaking change in terms of syntax.
The timezone package already supports multiple timezone databases, one of which is one with no historical data.

@dickermoshe
Copy link
Author

Seems that sugar is the only library which even attempts to handle in-between DTS transitions, gonna work on this repo

@dickermoshe
Copy link
Author

Some issues near the transition point, but I think I've got it working!

@dickermoshe
Copy link
Author

@Pante
I found a bug in the the your library.

After the year 2038, DST is permanently set.

final ianaTz = Timezone.timezoneProvider['America/New_York']!;
var dt = DateTime.parse('2038-03-14 03:00:00.000');
while (dt.year < 2050) {
  final ianaSpan = ianaTz.span(at: dt.microsecondsSinceEpoch);
  print(ianaSpan.offset);
  dt = dt.add(const Duration(minutes: 30));
}

This will always print -5 hours.

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