Skip to content

Commit

Permalink
fix define location for TZDateTime.toLocal()
Browse files Browse the repository at this point in the history
  • Loading branch information
Isaque Neves committed Jul 23, 2024
1 parent 0b1e037 commit 558f2ef
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions lib/src/types/binary_codec.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import 'dart:typed_data';

import 'package:buffer/buffer.dart';
import 'package:pg_timezone/pg_timezone.dart' as tz;
import 'package:pg_timezone/timezone.dart' as tzenv;
import 'package:postgres/src/types/generic_type.dart';

import '../buffer.dart';
Expand Down Expand Up @@ -839,6 +840,8 @@ class PostgresBinaryDecoder {
'Location with the name "$pgTimeZone" doesn\'t exist');
}
final tzLocation = tzLocations.first;
//define location for TZDateTime.toLocal()
tzenv.setLocalLocation(tzLocation);

final offsetInMilliseconds = tzLocation.currentTimeZone.offset;
// Conversion of milliseconds to hours
Expand Down

0 comments on commit 558f2ef

Please sign in to comment.