Sha256: d28901fb4911c81ecdad024affa660925dccc80e2f67655bde46f0c28028f701

Contents?: true

Size: 444 Bytes

Versions: 38

Compression:

Stored size: 444 Bytes

Contents

require 'active_support/time'

class Time
  def to_json(*a)
    %("#{as_json}")
  end
  
  def as_json(*args)
    getutc.strftime("%Y/%m/%d %H:%M:%S +0000")
  end
  
  def self.json_create string
    return nil if string.nil?
    d = DateTime.parse(string.to_s).new_offset
    self.utc(d.year, d.month, d.day, d.hour, d.min, d.sec).in_time_zone
  end
end

ActiveSupport::TimeWithZone.class_eval do
  def as_json(*args)
    utc.as_json
  end
end

Version data entries

38 entries across 38 versions & 2 rubygems

Version Path
couch_potato-1.18.0 lib/core_ext/time.rb
couch_potato-1.17.0 lib/core_ext/time.rb
couch_potato-1.16.0 lib/core_ext/time.rb
couch_potato-1.15.0 lib/core_ext/time.rb
couch_potato-1.14.0 lib/core_ext/time.rb
couch_potato-1.13.0 lib/core_ext/time.rb
couch_potato-1.12.1 lib/core_ext/time.rb
couch_potato-1.12.0 lib/core_ext/time.rb
couch_potato-1.11.0 lib/core_ext/time.rb
couch_potato-1.10.1 lib/core_ext/time.rb
couch_potato-1.10.0 lib/core_ext/time.rb
couch_potato-1.9.0 lib/core_ext/time.rb
couch_potato-1.7.1 lib/core_ext/time.rb
couch_potato-1.7.0 lib/core_ext/time.rb
couch_potato-1.6.5 lib/core_ext/time.rb
couch_potato-1.6.4 lib/core_ext/time.rb
couch_potato-1.6.3 lib/core_ext/time.rb
couch_potato-1.4.0 lib/core_ext/time.rb
couch_potato-1.3.0 lib/core_ext/time.rb
couch_potato-1.2.0 lib/core_ext/time.rb