1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

%[EO]U didn't denote %U.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@10688 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
tadf 2006-08-06 11:41:12 +00:00
parent 6839b72dc5
commit 50ef71fa1e
2 changed files with 6 additions and 2 deletions

View file

@ -1,3 +1,7 @@
Sun Aug 6 20:34:24 2006 Tadayoshi Funaba <tadf@dotrb.org>
* lib/date/format.rb (str[fp]time): %[EO]U didn't denote %U.
Sun Aug 6 17:12:12 2006 Tanaka Akira <akr@fsij.org> Sun Aug 6 17:12:12 2006 Tanaka Akira <akr@fsij.org>
* io.c (io_reopen): STDERR.reopen(open("/dev/tty", "w")) should not * io.c (io_reopen): STDERR.reopen(open("/dev/tty", "w")) should not

View file

@ -148,7 +148,7 @@ class Date
return unless str.sub!(/\A(\d+)/o, '') return unless str.sub!(/\A(\d+)/o, '')
val = $1.to_i val = $1.to_i
return unless (0..53) === val return unless (0..53) === val
elem[if c == '%U' then :wnum0 else :wnum1 end] = val elem[if c[-1,1] == 'U' then :wnum0 else :wnum1 end] = val
when '%u' when '%u'
return unless str.sub!(/\A(\d+)/o, '') return unless str.sub!(/\A(\d+)/o, '')
val = $1.to_i val = $1.to_i
@ -533,7 +533,7 @@ class Date
when '%t'; o << "\t" # P2,ID when '%t'; o << "\t" # P2,ID
when '%U', '%W' when '%U', '%W'
a = self.class.civil_to_jd(year, 1, 1, ns?) + 6 a = self.class.civil_to_jd(year, 1, 1, ns?) + 6
k = if c == '%U' then 0 else 1 end k = if c[-1,1] == 'U' then 0 else 1 end
w = (jd - (a - ((a - k) + 1) % 7) + 7) / 7 w = (jd - (a - ((a - k) + 1) % 7) + 7) / 7
o << '%02d' % w o << '%02d' % w
when '%u'; o << '%d' % cwday # P2,ID when '%u'; o << '%d' % cwday # P2,ID