-
Notifications
You must be signed in to change notification settings - Fork 6
Open
Description
I have a datetime in gmt and need to print it out in the local timezone.
I thought I could do something like:
var gmtTime = DateTime.parse('2020-10-27 06:10:05+00:00');
var offset = DateTime.now().timeZoneOffset; /// this is a duration
dateTimeToOffset(datetime: expiryDate, offset: offset) // this is a double?
I'm really not a big fan of using doubles as the lack a unit.
Dart has really formalised Duration so I would expect this type of library to also use it.
The above impedance mismatch also causes problems.
The doco also doesn't state what unit the double is in. I'm guessing its hours?
I end up with:
var gmtTime = DateTime.parse('2020-10-27 06:10:05+00:00');
var offset = DateTime.now().timeZoneOffset; /// this is a duration
var hours = offset.inHours + offset.inMinutes / 60;
dateTimeToOffset(datetime: expiryDate, offset: hours) // this is a double?
But given the library is meant to make things easier ;<
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels