Sha256: fc2e7e44bd53ca90ef47f389c18b57d43bc26104c537681b803569b5e93d9248

Contents?: true

Size: 417 Bytes

Versions: 61

Compression:

Stored size: 417 Bytes

Contents

require 'date'
require 'time'

# Monkey-patched conversions to Date and DateTime
class Time
    def lformat(format = :default, locale=nil)
        locale ||= Spider.locale
        Spider::I18n.localize(locale, self, format)
    end
    
    def to_date
        ::Date.new(year, month, day)
    end
    def to_datetime
        ::DateTime.civil(year, month, day, hour, min, sec, Rational(utc_offset, 86400))
    end
end

Version data entries

61 entries across 61 versions & 1 rubygems

Version Path
spiderfw-1.0.1 lib/spiderfw/utils/monkey/time.rb
spiderfw-1.0.0 lib/spiderfw/utils/monkey/time.rb
spiderfw-0.6.39 lib/spiderfw/utils/monkey/time.rb
spiderfw-0.6.38 lib/spiderfw/utils/monkey/time.rb
spiderfw-0.6.37 lib/spiderfw/utils/monkey/time.rb
spiderfw-0.6.35 lib/spiderfw/utils/monkey/time.rb
spiderfw-0.6.34 lib/spiderfw/utils/monkey/time.rb
spiderfw-0.6.33 lib/spiderfw/utils/monkey/time.rb
spiderfw-0.6.32 lib/spiderfw/utils/monkey/time.rb
spiderfw-0.6.31 lib/spiderfw/utils/monkey/time.rb
spiderfw-0.6.30 lib/spiderfw/utils/monkey/time.rb
spiderfw-0.6.29 lib/spiderfw/utils/monkey/time.rb
spiderfw-0.6.28 lib/spiderfw/utils/monkey/time.rb
spiderfw-0.6.27 lib/spiderfw/utils/monkey/time.rb
spiderfw-0.6.26 lib/spiderfw/utils/monkey/time.rb
spiderfw-0.6.26.pre1 lib/spiderfw/utils/monkey/time.rb
spiderfw-0.6.25 lib/spiderfw/utils/monkey/time.rb
spiderfw-0.6.24 lib/spiderfw/utils/monkey/time.rb
spiderfw-0.6.23 lib/spiderfw/utils/monkey/time.rb
spiderfw-0.6.22 lib/spiderfw/utils/monkey/time.rb