Sha256: 27cd9b5f13537b32e2da75b0960a5fd8442b5c20932828c59622f27295cca1d5
Contents?: true
Size: 520 Bytes
Versions: 1
Compression:
Stored size: 520 Bytes
Contents
module Tabs module Resolutions module Month extend Tabs::Resolutionable extend self PATTERN = "%Y-%m" def serialize(timestamp) timestamp.strftime(PATTERN) end def deserialize(str) dt = DateTime.strptime(str, PATTERN) self.normalize(dt) end def from_seconds(s) s / 1.month end def add(ts, num) ts + num.months end def normalize(ts) Time.utc(ts.year, ts.month) end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
tabs-0.9.1 | lib/tabs/resolutions/month.rb |