File tree Expand file tree Collapse file tree 2 files changed +15
-4
lines changed Expand file tree Collapse file tree 2 files changed +15
-4
lines changed Original file line number Diff line number Diff line change @@ -255,13 +255,24 @@ class PostgresTextDecoder {
255255
256256 case TypeOid .timestampWithTimezone:
257257 case TypeOid .timestampWithoutTimezone:
258- return DateTime .parse (di.asText);
258+ final raw = DateTime .parse (di.asText);
259+ return DateTime .utc (
260+ raw.year,
261+ raw.month,
262+ raw.day,
263+ raw.hour,
264+ raw.minute,
265+ raw.second,
266+ raw.millisecond,
267+ raw.microsecond,
268+ );
259269
260270 case TypeOid .numeric:
261271 return di.asText;
262272
263273 case TypeOid .date:
264- return DateTime .parse (di.asText);
274+ final raw = DateTime .parse (di.asText);
275+ return DateTime .utc (raw.year, raw.month, raw.day);
265276
266277 case TypeOid .json:
267278 case TypeOid .jsonb:
Original file line number Diff line number Diff line change @@ -29,7 +29,7 @@ void main() {
2929 final rs = await conn
3030 .execute ("SELECT '1999-01-08 04:05:06'::TIMESTAMP WITHOUT TIME ZONE" );
3131 final item = rs.single.single as DateTime ;
32- expect (item.toIso8601String (), '1999-01-08T04:05:06.000 ' );
32+ expect (item.toIso8601String (), '1999-01-08T04:05:06.000Z ' );
3333 });
3434
3535 test ('interval' , () async {
@@ -51,7 +51,7 @@ void main() {
5151 test ('date' , () async {
5252 final rs = await conn.execute ("SELECT '1999-01-08'::DATE" );
5353 final item = rs.single.single as DateTime ;
54- expect (item.toIso8601String (), '1999-01-08T00:00:00.000 ' );
54+ expect (item.toIso8601String (), '1999-01-08T00:00:00.000Z ' );
5555 });
5656
5757 test ('json' , () async {
You can’t perform that action at this time.
0 commit comments