Sha256: 6b2912a3334feb1b56ecb10798bb3c9cd7d8745261e075154ddf91e00301a875
Contents?: true
Size: 406 Bytes
Versions: 2
Compression:
Stored size: 406 Bytes
Contents
# frozen_string_literal: true module SoapyCake class TimeConverter def initialize(time_zone) @zone = ActiveSupport::TimeZone[time_zone] end def to_cake(date) date = date.to_datetime if date.is_a?(Date) date.in_time_zone(zone).strftime('%Y-%m-%dT%H:%M:%S') end def from_cake(value) zone.parse(value).utc end private attr_reader :zone end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
soapy_cake-2.3.1 | lib/soapy_cake/time_converter.rb |
soapy_cake-2.3.0 | lib/soapy_cake/time_converter.rb |