diff --git a/ChangeLog b/ChangeLog index 8601d659ce..e571d750ec 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +Tue Aug 11 23:12:31 2009 Tadayoshi Funaba + + * lib/date.rb (complete_frags): Monday must be suitable for %W's + default day. + Tue Aug 11 21:42:46 2009 Nobuyoshi Nakada * numeric.c (num_divmod): fixed rdoc. [ruby-core:24862] diff --git a/lib/date.rb b/lib/date.rb index ce1d327127..f3edb5374b 100644 --- a/lib/date.rb +++ b/lib/date.rb @@ -1,7 +1,7 @@ # # date.rb - date and time library # -# Author: Tadayoshi Funaba 1998-2008 +# Author: Tadayoshi Funaba 1998-2009 # # Documentation: William Webber # @@ -927,7 +927,7 @@ class Date elem[e] = d.__send__(e) end elem[:wnum1] ||= 0 - elem[:wday] ||= 0 + elem[:wday] ||= 1 end end diff --git a/test/date/test_date_strptime.rb b/test/date/test_date_strptime.rb index 572d1ea42a..d9904939e9 100644 --- a/test/date/test_date_strptime.rb +++ b/test/date/test_date_strptime.rb @@ -442,7 +442,7 @@ class TestDateStrptime < Test::Unit::TestCase assert_equal([n.year, 11, 6, 0, 0, 0], [d.year, d.strftime('%W').to_i, d.wday, d.hour, d.min, d.sec]) d = DateTime.strptime('2004-11', '%Y-%W') - assert_equal([2004, 11, 0, 0, 0, 0], + assert_equal([2004, 11, 1, 0, 0, 0], [d.year, d.strftime('%W').to_i, d.wday, d.hour, d.min, d.sec]) end