module CoreExtensions
  module Time
    module EpochWeek
      EPOCH_BASE = -262800 # ::Time.at(0).utc.beginning_of_week # MONDAY!!!!!
      def epoch_week
        ((to_i + EPOCH_BASE) / 604800).floor
      end
    end
  end
end

Time.include CoreExtensions::Time::EpochWeek
