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

ActiveSupport::TimeWithZone#dst? always returns true #40705

Closed
drssdinblck opened this issue Nov 28, 2020 · 2 comments
Closed

ActiveSupport::TimeWithZone#dst? always returns true #40705

drssdinblck opened this issue Nov 28, 2020 · 2 comments

Comments

@drssdinblck
Copy link

Steps to reproduce

Run rails c for a standard rails application.

Execute

Time.find_zone!('Berlin').parse('2020-01-01').dst?

Expected behavior

dst? should return false for January as this is not within daylight saving time.

Actual behavior

[29] pry(main)> Time.find_zone!('Berlin').parse('2020-01-01').dst?
=> true

System configuration

Rails version: 6.0.3.4

Ruby version: 2.7.2

OS: alpine3.12

The application is running in docker. This is the Dockerfile:

FROM ruby:2.7.2-alpine3.12
RUN apk add --no-cache --update build-base linux-headers git postgresql-dev tzdata less
WORKDIR /my-app
COPY Gemfile* ./
RUN bundle install
COPY . .
@composerinteralia
Copy link
Member

I am not able to reproduce this locally (Ruby 2.7.2 with Rails 6.0.3.4). This returned false for me in the Rails console, and this reproduction script is passing:

# frozen_string_literal: true

require "bundler/inline"

gemfile(true) do
  source "https://rubygems.org"

  git_source(:github) { |repo| "https://github.com/#{repo}.git" }

  gem "rails", "6.0.3.4"
end

require "active_support"
require "active_support/core_ext/time/zones"
require "minitest/autorun"

class BugTest < Minitest::Test
  def test_stuff
    refute Time.find_zone!("Berlin").parse('2020-01-01').dst?
  end
end

@composerinteralia composerinteralia added the more-information-needed When reporter needs to provide more information label Nov 28, 2020
@jonathanhefner
Copy link
Member

@drssdinblck It sounds like you may be experiencing tzinfo/tzinfo#120 (see also #40427). Can you upgrade your tzinfo gem, and see if that resolves the problem?

@composerinteralia composerinteralia removed the more-information-needed When reporter needs to provide more information label Nov 29, 2020
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

3 participants