-
Notifications
You must be signed in to change notification settings - Fork 357
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Parse time zones when creating schedules from ICAL; fix DST test bug #295
Conversation
I'm not seeing the CI errors in my test environment. I'll look closer. |
af3522c
to
8db090e
Compare
I'd love to see this merged - what's stopping it from getting included? |
FYI I found a bug in that PR which I fixed and added a spec for here: togglepro#1 |
Change offset without changing time
Without time zone it falls back to Time.parse which uses system time zone, ignoring zone configured in ActiveSupport. IceCube docs mention using ActiveSupport time zone support, so would be great to try Time.zone.parse first, and then fall back to Time.parse. UPDATE: Actually, IceCube seems to ignore time zone too, so I suppose the problem it's beyond scope of this PR.
|
What's blocking this from being merged? This is a really bad bug, the Example:
As you can see, it changes the time anytime you deserialize the value. |
def self._parse_in_tzid(value, tzid) | ||
time_parser = Time | ||
if tzid | ||
time_parser = ActiveSupport::TimeZone.new(tzid.split('=')[1]) || Time |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is actually inconsistent with ice_cube's behavior for to_ical
. Ice_cube's to_ical uses the %Z
strftime string which (at least for en_US based locale's, behavior may be different elsewhere) outputs a string like PDT
which is effectively a utc offset not a timezone (PDT= UTC - 7 hours vs PST = UTC - 8 hours).
But ActiveSupport::TimeZone.new
requires an actual timezone, either the Olson format timezone such as America/Los_Angeles
or the other version of Pacific Time (US & Canada)
(which is some US only format that I don't even know if it's a standard with a name). Furthermore, there's not an ActiveSupport method for going from a timezone offset like PDT to a region's timezone because they're not the same thing.
So, in order for this PR to really make sense in the library, the to_ical
method should be changed to use the .time_zone.name
property of ActiveSupport::TimeWithZone instead of the strftime string.
I checked the ical RFC and it does not specify timezone identifiers, but says Implementers may want to use the naming conventions defined in existing time zone specifications such as the public-domain TZ database [TZDB]
and links to the olson timzone database
Any new news regarding getting this PR updated and merged? I just ran into this problem in a project of mine creating an event system. I was about to fork the repo but found this PR does what I need! EDIT: Nevermind to this comment, I missed the reference to the PR that expands on this topic: #335 |
No description provided.