Module: Quickbooks::Support::DateTime

Defined in:
lib/quickbooks/ruby_ext.rb

Class Method Summary collapse

Class Method Details

.new(whatever) ⇒ Object



181
182
183
184
185
186
187
188
189
190
191
192
193
194
# File 'lib/quickbooks/ruby_ext.rb', line 181

def self.new(whatever)
  case
  when String
    ::DateTime.parse(whatever)
  when ::DateTime
    whatever
  when whatever.respond_to?(:to_datetime)
    whatever.to_datetime
  when whatever.respond_to?(:to_s)
    ::DateTime.parse(whatever.to_s)
  else
    ::DateTime.new(whatever)
  end
end