Skip to content
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

Undefined method 'to_local' for #<TZInfo::TimezonePeriod:0x007fcbd3575d18> #62

Closed
secondstreetmedia opened this issue Dec 8, 2016 · 2 comments

Comments

@secondstreetmedia
Copy link

@secondstreetmedia secondstreetmedia commented Dec 8, 2016

Without (I believe) having changed my code, I'm now getting this error:

NoMethodError: undefined method `to_local' for #<TZInfo::TimezonePeriod:0x007fcbd3575d18>

This appears, at least at first glance, to be related to the change that was made in the latest update of the gem:

Move to_local and to_utc conversions into Timezone.
It doesn't really make sense to have methods on TimezonePeriod that can
convert times outside of the range of the period.

Any suggestions as to what I might do to resolve this. It's causing my database migration and seeding to fail.

Thanks,
Tim

@philr
Copy link
Member

@philr philr commented Dec 8, 2016

That change (873d4cd) is only in git at the moment. It is not part of a released version of the tzinfo gem.

I wouldn't recommend using the latest code in git for production purposes at the moment - I'm making some fairly substantial changes that will eventually end up in a v2 release.

If you're calling TZInfo::TimezonePeriod#to_local in your own code, then you should switch to TZInfo::Timezone#utc_to_local or TZInfo::Timezone#to_local instead (the latter is only available in git at the moment).

If you are using Rails (which currently uses TZInfo::TimezonePeriod#to_local), then you'll need to switch to a version of TZInfo that is compatible with Rails - either the latest release (currently v1.2.2) or an earlier commit from git.

@secondstreetmedia
Copy link
Author

@secondstreetmedia secondstreetmedia commented Dec 9, 2016

Thanks for the response. I have been using the git version, but I don't have anything in production, so no worries there. I am using Rails, so I'll switch to v1.2.2.

Looking forward to v2!

@philr philr closed this Dec 9, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.