You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When giving a date math expression to datemath.dm with a timezone argument there are two inconsistent behiavors regarding timezone parsing:
if there is a now in the expression, the timezone is parsed using the Arrow.to() method. This method accepts plenty of timezone formats (Europe/Paris, CET, +01:00, +01, +0100, UTC+1, etc.)
if there is a date to parse as anchor (or if the argument is already a fully qualified date without date math logic), the function datemath.helpers.parseTime() is used which uses in turn dateutil.tz.gettz() to parse the timezone. Although doing almost the same job, gettz() does not handle timezone in those formats: +01:00, +01, +0100.
A (very) quick fix would to replace in datemath.helpers.parseTime() ts = ts.replace(tzinfo=tz.gettz(timezone))
by ts = ts.replace(tzinfo=timezone)
since Arrow.replace() is perfectly happy with a string timezone expression and the behaviour would be perfectly consistent with Arrow.to()
The text was updated successfully, but these errors were encountered:
Hi @AbelThorne , I went ahead and made this change for you in v1.4.9. Can you give the latest version a try and let me know if that fixes issue for you? Thank you!
When giving a date math expression to
datemath.dm
with a timezone argument there are two inconsistent behiavors regarding timezone parsing:now
in the expression, the timezone is parsed using theArrow.to()
method. This method accepts plenty of timezone formats (Europe/Paris, CET, +01:00, +01, +0100, UTC+1, etc.)datemath.helpers.parseTime()
is used which uses in turndateutil.tz.gettz()
to parse the timezone. Although doing almost the same job,gettz()
does not handle timezone in those formats: +01:00, +01, +0100.A (very) quick fix would to replace in
datemath.helpers.parseTime()
ts = ts.replace(tzinfo=tz.gettz(timezone))
by
ts = ts.replace(tzinfo=timezone)
since
Arrow.replace()
is perfectly happy with a string timezone expression and the behaviour would be perfectly consistent withArrow.to()
The text was updated successfully, but these errors were encountered: