Skip to content

Commit

Permalink
fix init Location By default with UTC
Browse files Browse the repository at this point in the history
  • Loading branch information
Isaque Neves committed Jul 23, 2024
1 parent 3ed3cd3 commit fc7576c
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 4 deletions.
6 changes: 5 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,4 +71,8 @@ queries Example:

## 3.1.1

- add more flexibility on how date, timestamp and timestaptz types are decoded by adding flags to the TimeZoneSettings
- add more flexibility on how date, timestamp and timestaptz types are decoded by adding flags to the TimeZoneSettings

## 3.1.2

- fix init Location By default with UTC
4 changes: 4 additions & 0 deletions lib/src/converters.dart
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import 'server_info.dart';
import 'utils/utils.dart';

import 'dependencies/timezone/pg_timezone.dart' as tz;
import 'dependencies/timezone/timezone.dart' as tzenv;

//enum
// class ArrayState {
Expand Down Expand Up @@ -454,6 +455,9 @@ class TypeConverter {
}

final tzLocation = tzLocations.first;
//define location for TZDateTime.toLocal()
tzenv.setLocalLocation(tzLocation);

final offsetInMilliseconds = tzLocation.currentTimeZone.offset;

// Conversion of milliseconds to hours
Expand Down
4 changes: 2 additions & 2 deletions lib/src/dependencies/timezone/src/env.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ const String tzDataDefaultFilename = 'latest.tzf';
final _UTC = Location('UTC', [minTime], [0], [TimeZone.UTC]);

final _database = LocationDatabase();
late Location _local;
Location _local = _UTC;

/// Global TimeZone database
LocationDatabase get timeZoneDatabase => _database;
Expand Down Expand Up @@ -48,7 +48,7 @@ void initializeDatabase(List<int> rawData) async {
for (final l in tzdbDeserialize(rawData)) {
// final name = l.name;
// final transitionAt = l.transitionAt;
// final transitionZone = l.transitionZone;
// final transitionZone = l.transitionZone;
// final zones = l.zones.map((z) => "TimeZone(${z.offset}, isDst: ${z.isDst}, abbreviation: '${z.abbreviation}')");
// final contents = ''' '$name': Location('$name',[${transitionAt.join(',')}],[${transitionZone.join(',')}],[${zones.join(',')}]), ''';
// await file.writeAsString(contents, mode: FileMode.append);
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: dargres
version: 3.1.1
version: 3.1.2
description: >
Dargres is a pure-Dart PostgreSQL driver based on Python pg8000
homepage: https://github.com/insinfo/pg8000
Expand Down

0 comments on commit fc7576c

Please sign in to comment.