Sha256: b20495c0d96c2e4697b733402779a7a451ed53966456743ef1fd10399c0b17db
Contents?: true
Size: 519 Bytes
Versions: 1
Compression:
Stored size: 519 Bytes
Contents
module Tabs module Resolutions module Day extend Resolutionable extend self PATTERN = "%Y-%m-%d" 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.day end def add(ts, num) ts + num.days end def normalize(ts) Time.utc(ts.year, ts.month, ts.day) end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
tabs-0.9.1 | lib/tabs/resolutions/day.rb |