Sha256: f8d51d5a355e1b2bfc5965c9268a25ec28a4f4d91876c2383b78418a35e01925

Contents?: true

Size: 585 Bytes

Versions: 10

Compression:

Stored size: 585 Bytes

Contents

class Time

  unless method_defined?(:dst_adjustment)

    # Adjust DST
    #
    # TODO: Can't seem to get this to pass ActiveSupport tests,
    # even though it is essentially identical to the ActiveSupport
    # code (see Time#since in time/calculations.rb). It handles
    # all but 4 tests.
    def dst_adjustment(time)
      self_dst = self.dst? ? 1 : 0
      time_dst = time.dst? ? 1 : 0
      seconds  = (self - time).abs
      if (seconds >= 86400 && self_dst != time_dst)
        time + ((self_dst - time_dst) * 60 * 60)
      else
        time
      end
    end

  end

end

Version data entries

10 entries across 9 versions & 2 rubygems

Version Path
facets-glimmer-3.2.0 lib/core/facets/time/dst_adjustment.rb
facets-3.1.0 lib/core/facets/time/dst_adjustment.rb
facets-3.0.0 lib/core/facets/time/dst_adjustment.rb
facets-2.9.3 lib/core/facets/time/dst_adjustment.rb
facets-2.9.2 lib/core/facets/time/dst_adjustment.rb
facets-2.9.2 src/core/facets/time/dst_adjustment.rb
facets-2.9.1 lib/core/facets/time/dst_adjustment.rb
facets-2.9.0 lib/core/facets/time/dst_adjustment.rb
facets-2.9.0.pre.2 lib/core/facets/time/dst_adjustment.rb
facets-2.9.0.pre.1 lib/core/facets/time/dst_adjustment.rb