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

Discrepancies in README#Usage #1

Open
artem-mindrov opened this issue Mar 4, 2013 · 0 comments
Open

Discrepancies in README#Usage #1

artem-mindrov opened this issue Mar 4, 2013 · 0 comments

Comments

@artem-mindrov
Copy link

The code selecting the default option for time_zone_input doesn't work. TZInfo::Timezone.get will return a loaded TZInfo::DataTimezone object while zone.tzinfo is a TZInfo::TimezoneProxy, they are not equal so the reject criteria is always false.

What worked for me was the following:

ActiveSupport::TimeZone.all.reject {|zone| zone.utc_offset != TZInfo::Timezone.get(cookies["time_zone"] || "America/Los_Angeles").current_period.utc_offset }.first.name

Using just

TZInfo::Timezone.get(cookies["time_zone"] || "America/Los_Angeles").name

works as well.

Also, jstz.determine().timezone.name() raises an exception because determine() returns an object with a single property name so the timezone part should be removed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant