Module: Quickbooks::Support::DateTime

Defined in:
lib/quickbooks/ruby_ext.rb

Class Method Summary collapse

Class Method Details

.new(whatever) ⇒ Object



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

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