From 689438a2950a9b8577337f8a1cd293e9137b0f40 Mon Sep 17 00:00:00 2001 From: katutxakurra Date: Mon, 30 Mar 2020 22:17:47 +0100 Subject: [PATCH] Include sign in offset Time in locations with negative offset are wrongly adding the offset to datetime. --- world_time_app/lib/services/world_time.dart | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/world_time_app/lib/services/world_time.dart b/world_time_app/lib/services/world_time.dart index 5cb5f96..a060855 100644 --- a/world_time_app/lib/services/world_time.dart +++ b/world_time_app/lib/services/world_time.dart @@ -17,7 +17,7 @@ class WorldTime { // get properties from json String datetime = data['datetime']; - String offset = data['utc_offset'].substring(1,3); + String offset = data['utc_offset'].substring(0,3); // create DateTime object DateTime now = DateTime.parse(datetime); @@ -31,4 +31,4 @@ class WorldTime { } -// WorldTime instance = WorldTime(location: 'Berlin', flag: 'germany.png', url: 'Europe/Berlin'); \ No newline at end of file +// WorldTime instance = WorldTime(location: 'Berlin', flag: 'germany.png', url: 'Europe/Berlin');