Sha256: 98533740a087b92bef087a6ffc0ff593c45883a7299775d745d65258b62daacf

Contents?: true

Size: 357 Bytes

Versions: 301

Compression:

Stored size: 357 Bytes

Contents

require 'date'
require 'active_support/core_ext/time/zones'

class Date
  # Converts Date to a TimeWithZone in the current zone if Time.zone or Time.zone_default
  # is set, otherwise converts Date to a Time via Date#to_time
  def to_time_in_current_zone
    if ::Time.zone
      ::Time.zone.local(year, month, day)
    else
      to_time
    end
  end
end

Version data entries

301 entries across 257 versions & 26 rubygems

Version Path
mdg-1.0.1 vendor/bundle/ruby/2.3.0/gems/activesupport-3.2.22.5/lib/active_support/core_ext/date/zones.rb
activesupport-3.2.22.5 lib/active_support/core_ext/date/zones.rb
activesupport-3.2.22.4 lib/active_support/core_ext/date/zones.rb
activesupport-3.2.22.3 lib/active_support/core_ext/date/zones.rb
activesupport-3.2.22.2 lib/active_support/core_ext/date/zones.rb
activesupport-3.2.22.1 lib/active_support/core_ext/date/zones.rb
classiccms-0.7.5 vendor/bundle/gems/activesupport-3.2.3/lib/active_support/core_ext/date/zones.rb
classiccms-0.7.4 vendor/bundle/gems/activesupport-3.2.3/lib/active_support/core_ext/date/zones.rb
classiccms-0.7.3 vendor/bundle/gems/activesupport-3.2.3/lib/active_support/core_ext/date/zones.rb
active_mailer-0.0.10 test/fixtures/dummyapp_rails_3.2/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.12/lib/active_support/core_ext/date/zones.rb
activesupport-3.2.22 lib/active_support/core_ext/date/zones.rb
judge-2.0.5 vendor/bundle/ruby/2.1.0/gems/activesupport-3.2.12/lib/active_support/core_ext/date/zones.rb
activesupport-3.2.21 lib/active_support/core_ext/date/zones.rb
apl-library-0.0.90 vendor/bundle/ruby/1.8/gems/activesupport-3.2.18/lib/active_support/core_ext/date/zones.rb
apl-library-0.0.90 vendor/bundle/ruby/2.1.0/gems/apl-library-0.0.90/vendor/bundle/ruby/2.1.0/gems/activesupport-3.2.18/lib/active_support/core_ext/date/zones.rb
apl-library-0.0.90 vendor/bundle/ruby/2.1.0/gems/apl-library-0.0.90/vendor/bundle/ruby/1.8/gems/activesupport-3.2.18/lib/active_support/core_ext/date/zones.rb
apl-library-0.0.90 vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.18/lib/active_support/core_ext/date/zones.rb
apl-library-0.0.90 vendor/bundle/ruby/2.1.0/gems/activesupport-3.2.18/lib/active_support/core_ext/date/zones.rb
apl-library-0.0.90 vendor/bundle/ruby/2.1.0/gems/apl-library-0.0.90/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.18/lib/active_support/core_ext/date/zones.rb
activesupport-3.2.20 lib/active_support/core_ext/date/zones.rb