Class: Insulin::OnTrack::Date
- Inherits:
-
Hash
- Object
- Hash
- Insulin::OnTrack::Date
- Defined in:
- lib/insulin/on_track/date.rb
Overview
OnTrack uses really shitty date formats, including embedding a comma in the CSV export file. Christ on a crutch
Instance Method Summary collapse
-
#initialize(d) ⇒ Date
constructor
Parse the string ādā, looking for datetime information.
Constructor Details
#initialize(d) ⇒ Date
Parse the string ādā, looking for datetime information
13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/insulin/on_track/date.rb', line 13 def initialize d t = Time.parse d # We extract loads of stuff. Might be useful one day self["timestamp"] = t self["tzoffset"] = t.strftime "%z" self["timezone"] = t.zone self["unixtime"] = t.to_i self["day"] = t.strftime("%A").downcase self["date"] = t.strftime "%F" self["time"] = t.strftime "%T #{self['timezone']}" end |