Sha256: 42f880a146686de7c7683790fd9eaa1f11c7794c0ad77b5a0cfa53070ab44f70

Contents?: true

Size: 748 Bytes

Versions: 3

Compression:

Stored size: 748 Bytes

Contents

class ::Date
  def to_tc_date
    TimeCrisis::Date.civil(year, month, day)
  end

  def to_tc_datetime
    TimeCrisis::DateTime.civil(year, month, day, 0, 0, 0, 0)
  end
end

class ::Time
  def to_tc_date
    TimeCrisis::Date.civil(year, month, day)
  end

  def to_tc_datetime
    TimeCrisis::DateTime.civil(year, month, day, hour, min, sec, 0, utc_offset)
  end
end

class ::DateTime
  def to_tc_date
    TimeCrisis::Date.civil(year, month, day)
  end

  def to_tc_datetime
    TimeCrisis::DateTime.civil(year, month, day, hour, min, sec, 0, (offset * 86400).to_i)
  end
end

class ::String
  def to_tc_date(opts={})
    TimeCrisis::Date.parse(self, opts)
  end

  def to_tc_datetime(opts={})
    TimeCrisis::DateTime.parse(self, opts)
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
time_crisis-0.3.2 lib/time_crisis/conversions.rb
time_crisis-0.3.1 lib/time_crisis/conversions.rb
time_crisis-0.3.0 lib/time_crisis/conversions.rb