File tree Expand file tree Collapse file tree 2 files changed +16
-0
lines changed Expand file tree Collapse file tree 2 files changed +16
-0
lines changed Original file line number Diff line number Diff line change 1
1
import 'package:flutter/foundation.dart' ;
2
2
import 'package:flutter/material.dart' ;
3
+ import 'package:timezone/data/latest.dart' as tz;
3
4
4
5
import 'licenses.dart' ;
5
6
import 'log.dart' ;
@@ -13,5 +14,6 @@ void main() {
13
14
}());
14
15
LicenseRegistry .addLicense (additionalLicenses);
15
16
LiveZulipBinding .ensureInitialized ();
17
+ tz.initializeTimeZones ();
16
18
runApp (const ZulipApp ());
17
19
}
Original file line number Diff line number Diff line change
1
+ import 'package:timezone/timezone.dart' as tz;
2
+
3
+ DateTime ? getNowInTimezone (String timezone) {
4
+ if (timezone.isEmpty) {
5
+ return null ;
6
+ }
7
+ final tz.Location location;
8
+ try {
9
+ location = tz.getLocation (timezone);
10
+ } on tz.LocationNotFoundException {
11
+ return null ;
12
+ }
13
+ return tz.TZDateTime .now (location);
14
+ }
You can’t perform that action at this time.
0 commit comments