Sha256: e69a0c7fcf91e3e20a5d1697c1695aee38249da9f32623aefc7eeb0472d71e8f

Contents?: true

Size: 613 Bytes

Versions: 20

Compression:

Stored size: 613 Bytes

Contents

module XeroGateway
  module Dates
    def self.included(base)
      base.extend(ClassMethods)
    end
    
    module ClassMethods
      def format_date(time)
        return time.strftime("%Y-%m-%d")
      end
      
      def format_date_time(time)
        return time.strftime("%Y%m%d%H%M%S")
      end
      
      def parse_date(time)
        Date.civil(time[0..3].to_i, time[5..6].to_i, time[8..9].to_i)
      end
      
      def parse_date_time(time)
        Time.local(time[0..3].to_i, time[5..6].to_i, time[8..9].to_i, time[11..12].to_i, time[14..15].to_i, time[17..18].to_i)
      end
    end
  end
end

Version data entries

20 entries across 20 versions & 2 rubygems

Version Path
xero_gateway-2.1.0 lib/xero_gateway/dates.rb
xero_gateway-n8vision-2.0.20 lib/xero_gateway/dates.rb
xero_gateway-2.0.19 lib/xero_gateway/dates.rb
xero_gateway-2.0.18 lib/xero_gateway/dates.rb
xero_gateway-2.0.17 lib/xero_gateway/dates.rb
xero_gateway-2.0.16 lib/xero_gateway/dates.rb
xero_gateway-2.0.15 lib/xero_gateway/dates.rb
xero_gateway-2.0.14 lib/xero_gateway/dates.rb
xero_gateway-2.0.13 lib/xero_gateway/dates.rb
xero_gateway-2.0.12 lib/xero_gateway/dates.rb
xero_gateway-2.0.11 lib/xero_gateway/dates.rb
xero_gateway-2.0.10 lib/xero_gateway/dates.rb
xero_gateway-2.0.9 lib/xero_gateway/dates.rb
xero_gateway-2.0.8 lib/xero_gateway/dates.rb
xero_gateway-2.0.7 lib/xero_gateway/dates.rb
xero_gateway-2.0.6 lib/xero_gateway/dates.rb
xero_gateway-2.0.5 lib/xero_gateway/dates.rb
xero_gateway-2.0.4 lib/xero_gateway/dates.rb
xero_gateway-2.0.3 lib/xero_gateway/dates.rb
xero_gateway-2.0.2 lib/xero_gateway/dates.rb