utils.time: Add support for timezones without a slash.

eg. UTC, CET, ...
This commit is contained in:
Valentin Lorentz 2021-12-07 23:30:16 +01:00
parent ed9dffdd7f
commit e223b507dd
2 changed files with 2 additions and 1 deletions

View File

@ -96,6 +96,7 @@ class TimeTestCase(PluginTestCase):
def testTztime(self):
self.assertNotError('tztime Europe/Paris')
self.assertNotError('tztime America/Indiana/Knox')
self.assertNotError('tztime UTC')
self.assertError('tztime Europe/Gniarf')
@skipIf(not has_dateutil, 'python-dateutil is missing')

View File

@ -41,7 +41,7 @@ try:
except ImportError:
pytz = None
_IANA_TZ_RE = re.compile("([\w_-]+/)+[\w_-]+")
_IANA_TZ_RE = re.compile("([\w_-]+/)*[\w_-]+")
class TimezoneException(Exception):
pass