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

Africa/Casablanca offset incorrect #98

Closed
lelelyons opened this Issue Feb 6, 2019 · 2 comments

Comments

Projects
None yet
2 participants
@lelelyons
Copy link

lelelyons commented Feb 6, 2019

The offset seems to be incorrect (see below), I believe it should be 3600? Or am I misunderstanding something?

screenshot 2019-02-06 at 14 04 23

@philr

This comment has been minimized.

Copy link
Member

philr commented Feb 6, 2019

Your time zone data is probably out of date. Morocco's change to permanent UTC+1 was included in the 2018g release of the IANA Time Zone Database. Further changes were made to include fallbacks for Ramadan in 2018h.

With the latest data, I get the expected result:

tz = TZInfo::Timezone.get('Africa/Casablanca')
# => #<TZInfo::DataTimezone: Africa/Casablanca>
tz.current_period.utc_offset
# => 3600

If you are using ZoneinfoDataSource, check to see if there is an updated tzdata package available for your operating system. Otherwise, you can add tzinfo-data version 1.2018.7 or later to your Gemfile and use RubyDataSource.

@philr

This comment has been minimized.

Copy link
Member

philr commented Feb 6, 2019

The 2018h 'main' definition of Africa/Casablanca uses a base offset of UTC+1 throughout the year and observes negative daylight savings during Ramadan. There is a 'rearguard' version of the IANA Time Zone Database that changes this around so that a base offset of UTC+0 is used throughout the year and positive daylight savings is observed at all times other than during Ramadan.

If you are using ZoneinfoDataSource and have up to date zoneinfo files built from the 'rearguard' definitions, then utc_offset will return 0, but utc_total_offset will return 3600 for most of the year.

Note also that utc_offset and utc_total_offset have been renamed base_utc_offset and observed_utc_offset respectively in tzinfo version 2.0.0.

@lelelyons lelelyons closed this Feb 7, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment