Project

General

Profile

Bug #11037 ยป time_parse.patch

nkmrya (Yasuhiro Nakamura), 09/06/2015 01:56 AM

View differences:

lib/time.rb
off = nil
off = zone_offset(zone, off_year) if zone
if off
now = now.getlocal(off) if now.utc_offset != off
else
now = now.getlocal
if now.kind_of?(Time)
if off
now = now.getlocal(off) if now.utc_offset != off
else
now = now.getlocal
end
end
usec = nil
test/test_time.rb
define_method(test) {__send__(sub, :xmlschema)}
define_method(test.sub(/xmlschema/, 'iso8601')) {__send__(sub, :iso8601)}
end
def test_parse_with_various_object
d = Date.new(2010, 10, 28)
dt = DateTime.new(2010, 10, 28)
md = MyDate.new(10, 28, 2010)
t = Time.local(2010, 10, 28, 21, 26, 00)
assert_equal(t, Time.parse("21:26", d))
assert_equal(t, Time.parse("21:26", dt))
assert_equal(t, Time.parse("21:26", md))
end
class MyDate
attr_reader :mon, :day, :year
def initialize(mon, day, year)
@mon, @day, @year = mon, day, year
end
end
end
    (1-1/1)