Sha256: d888ef3f9bdbc488a152422935d168771155c047c80f561f369895e21d6e32fe

Contents?: true

Size: 458 Bytes

Versions: 13

Compression:

Stored size: 458 Bytes

Contents

# frozen_string_literal: true

module Dsu
  module Support
    module TimeComparable
      TIME_COMPARABLE_FORMAT_SPECIFIER = '%Y%m%d'

      def time_equal?(other_time:)
        time_equal_compare_string_for(time: time) == time_equal_compare_string_for(time: other_time)
      end

      def time_equal_compare_string_for(time:)
        time = time.localtime if time.utc?

        time.strftime(TIME_COMPARABLE_FORMAT_SPECIFIER)
      end
    end
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
dsu-2.1.4 lib/dsu/support/time_comparable.rb
dsu-2.1.3 lib/dsu/support/time_comparable.rb
dsu-2.1.2 lib/dsu/support/time_comparable.rb
dsu-2.1.1 lib/dsu/support/time_comparable.rb
dsu-2.0.8 lib/dsu/support/time_comparable.rb
dsu-2.0.7 lib/dsu/support/time_comparable.rb
dsu-2.0.6 lib/dsu/support/time_comparable.rb
dsu-2.0.5 lib/dsu/support/time_comparable.rb
dsu-2.0.4 lib/dsu/support/time_comparable.rb
dsu-2.0.3 lib/dsu/support/time_comparable.rb
dsu-2.0.2 lib/dsu/support/time_comparable.rb
dsu-2.0.1 lib/dsu/support/time_comparable.rb
dsu-2.0.0.alpha.1 lib/dsu/support/time_comparable.rb