module PactBroker::Api::Decorators::FormatDateTime

Constants

DATE_TIME_CLASS

Keep this in sync with Sequel.datetime_class. Needs to be upgraded from DateTime to Time as Time is deprecated

Public Class Methods

call(date_time) click to toggle source
# File lib/pact_broker/api/decorators/format_date_time.rb, line 9
def self.call(date_time)
  if date_time.is_a?(String)
    Sequel.string_to_datetime(date_time).to_time.utc.to_datetime.xmlschema
  elsif date_time
    date_time.to_time.utc.to_datetime.xmlschema if date_time
  end
end

Public Instance Methods

format_date_time(date_time) click to toggle source
# File lib/pact_broker/api/decorators/format_date_time.rb, line 17
def format_date_time(date_time)
  FormatDateTime.call(date_time)
end