From 642d84a1cef13835830d036dd997a7c8635c1030 Mon Sep 17 00:00:00 2001 From: Karl Jansen <6225628+karjanme@users.noreply.github.com> Date: Sun, 1 Oct 2023 22:37:58 -0700 Subject: [PATCH 1/2] Fixed bug with timezone mapping --- CHANGELOG.md | 3 +++ airnowpy/api.py | 8 ++++---- tests/test_api.py | 8 ++++---- 3 files changed, 11 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 595ec07..6b97b1b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,9 @@ This project uses [Semantic Versioning](https://semver.org/spec/v2.0.0.html). ## Unreleased +### Fixed +- Bug with how timezones are applied to observation timestamps + ## Release 2.2.1 [2023-10-01] ### Fixed - Bug with how the observation date/time is read from the response diff --git a/airnowpy/api.py b/airnowpy/api.py index ad907dd..8ed4374 100644 --- a/airnowpy/api.py +++ b/airnowpy/api.py @@ -140,11 +140,11 @@ def _convertResponseToObservation(self, @staticmethod def convertLocalTimeZone(localTimeZone: str) -> tzinfo: if (localTimeZone == 'EST'): - return timezone('Etc/GMT-5') + return timezone('Etc/GMT+5') if (localTimeZone == 'CST'): - return timezone('Etc/GMT-6') + return timezone('Etc/GMT+6') if (localTimeZone == 'MST'): - return timezone('Etc/GMT-7') + return timezone('Etc/GMT+7') if (localTimeZone == 'PST'): - return timezone('Etc/GMT-8') + return timezone('Etc/GMT+8') raise LookupError("Local Time Zone '" + localTimeZone + "' is not supported.") diff --git a/tests/test_api.py b/tests/test_api.py index 826e234..d40cc6b 100644 --- a/tests/test_api.py +++ b/tests/test_api.py @@ -158,10 +158,10 @@ def _assertObservations(self, observations: List[Observation]) -> None: self.assertEqual(Category.GOOD, observations[1].category) def test_convertLocalTimeZone_withGoodTimeZoneString(self): - self.executeConvertLocalTimeZoneTest("EST", timezone("Etc/GMT-5")) - self.executeConvertLocalTimeZoneTest("CST", timezone("Etc/GMT-6")) - self.executeConvertLocalTimeZoneTest("MST", timezone("Etc/GMT-7")) - self.executeConvertLocalTimeZoneTest("PST", timezone("Etc/GMT-8")) + self.executeConvertLocalTimeZoneTest("EST", timezone("Etc/GMT+5")) + self.executeConvertLocalTimeZoneTest("CST", timezone("Etc/GMT+6")) + self.executeConvertLocalTimeZoneTest("MST", timezone("Etc/GMT+7")) + self.executeConvertLocalTimeZoneTest("PST", timezone("Etc/GMT+8")) def test_convertLocalTimeZone_withBadTimeZoneString(self): badTimeZoneStr = "PDT" From 576a20e719e55c2417a306289147b13bad1ef5c6 Mon Sep 17 00:00:00 2001 From: Karl Jansen <6225628+karjanme@users.noreply.github.com> Date: Sun, 1 Oct 2023 22:46:54 -0700 Subject: [PATCH 2/2] Release 2.2.2 --- CHANGELOG.md | 1 + setup.py | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6b97b1b..3bfc868 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,7 @@ This project uses [Semantic Versioning](https://semver.org/spec/v2.0.0.html). ## Unreleased +## Release 2.2.2 [2023-10-01] ### Fixed - Bug with how timezones are applied to observation timestamps diff --git a/setup.py b/setup.py index 5a9ed8e..d56a53b 100644 --- a/setup.py +++ b/setup.py @@ -7,7 +7,7 @@ setup( name="airnowpy", - version="2.2.1", + version="2.2.2", description="Python Library for the AirNow API", long_description=long_description, long_description_content_type="text/markdown",