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

Timezone is not correct #55

Closed
rotem443 opened this issue Sep 5, 2016 · 1 comment
Closed

Timezone is not correct #55

rotem443 opened this issue Sep 5, 2016 · 1 comment
Labels

Comments

@rotem443
Copy link

rotem443 commented Sep 5, 2016

I'm trying to get the offset from the UTC time at Israel timezone:

TZInfo::Timezone.get('Israel').current_period.utc_offset / (60*60)

The result is 2 hours when 3 hours is expected (http://www.timeanddate.com/time/zone/israel/jerusalem)

@philr
Copy link
Member

philr commented Sep 5, 2016

utc_offset gives the base offset of the time zone (not taking daylight savings time into account). For the total offset including daylight savings time, use utc_total_offset instead:

TZInfo::Timezone.get('Israel').current_period.utc_total_offset / (60*60)

@philr philr added the question label Sep 5, 2016
@philr philr closed this as completed Sep 5, 2016
philr added a commit that referenced this issue Jun 7, 2018
The #utc_offset and #utc_total_offset attributes are often confused
(#55, #89). Rename as #base_utc_offset and #current_utc_offset
respectively.

Retain the old names as aliases.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants