ruby-changes:68157
From: Jeremy <ko1@a...>
Date: Tue, 28 Sep 2021 19:15:58 +0900 (JST)
Subject: [ruby-changes:68157] f9f7f3a75e (master): [ruby/date] Make %v strftime flag use uppercase month
https://git.ruby-lang.org/ruby.git/commit/?id=f9f7f3a75e From f9f7f3a75ec5af4a70e3332f8f5aa300c13432e2 Mon Sep 17 00:00:00 2001 From: Jeremy Evans <code@j...> Date: Tue, 27 Jul 2021 10:23:47 -0700 Subject: [ruby/date] Make %v strftime flag use uppercase month %v is supposed to be the VMS date, and VMS date format uses an uppercase month. Ruby 1.8 used an uppercase month for %v, but the behavior was changed without explanation in r31672. Time#strftime still uses an uppercase month for %v, so this change makes Date#strftime consistent with Time#strftime. Fixes [Bug #13810] https://github.com/ruby/date/commit/56c489fd7e --- ext/date/date_core.c | 4 ++-- ext/date/date_strftime.c | 2 +- test/date/test_date_strftime.rb | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/ext/date/date_core.c b/ext/date/date_core.c index f1017d22e9..4a2225fd2c 100644 --- a/ext/date/date_core.c +++ b/ext/date/date_core.c @@ -6900,7 +6900,7 @@ date_strftime_internal(int argc, VALUE *argv, VALUE self, https://github.com/ruby/ruby/blob/trunk/ext/date/date_core.c#L6900 * %c - date and time (%a %b %e %T %Y) * %D - Date (%m/%d/%y) * %F - The ISO 8601 date format (%Y-%m-%d) - * %v - VMS date (%e-%b-%Y) + * %v - VMS date (%e-%^b-%Y) * %x - Same as %D * %X - Same as %T * %r - 12-hour time (%I:%M:%S %p) @@ -8380,7 +8380,7 @@ dt_lite_to_s(VALUE self) https://github.com/ruby/ruby/blob/trunk/ext/date/date_core.c#L8380 * %c - date and time (%a %b %e %T %Y) * %D - Date (%m/%d/%y) * %F - The ISO 8601 date format (%Y-%m-%d) - * %v - VMS date (%e-%b-%Y) + * %v - VMS date (%e-%^b-%Y) * %x - Same as %D * %X - Same as %T * %r - 12-hour time (%I:%M:%S %p) diff --git a/ext/date/date_strftime.c b/ext/date/date_strftime.c index 9d8167b612..d7f28989d6 100644 --- a/ext/date/date_strftime.c +++ b/ext/date/date_strftime.c @@ -393,7 +393,7 @@ date_strftime_with_tmx(char *s, const size_t maxsize, const char *format, https://github.com/ruby/ruby/blob/trunk/ext/date/date_strftime.c#L393 continue; case 'v': - STRFTIME("%e-%b-%Y"); + STRFTIME("%e-%^b-%Y"); continue; case 'w': /* weekday, Sunday == 0, 0 - 6 */ diff --git a/test/date/test_date_strftime.rb b/test/date/test_date_strftime.rb index f82874d26d..be9354504a 100644 --- a/test/date/test_date_strftime.rb +++ b/test/date/test_date_strftime.rb @@ -48,7 +48,7 @@ class TestDateStrftime < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/date/test_date_strftime.rb#L48 '%t'=>["\t",{}], '%u'=>['6',{:cwday=>6}], '%V'=>['05',{:cweek=>5}], - '%v'=>[' 3-Feb-2001',{:mday=>3,:mon=>2,:year=>2001}], + '%v'=>[' 3-FEB-2001',{:mday=>3,:mon=>2,:year=>2001}], '%z'=>['+0000',{:zone=>'+0000',:offset=>0}], '%+'=>['Sat Feb 3 00:00:00 +00:00 2001', {:wday=>6,:mon=>2,:mday=>3, -- cgit v1.2.1 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/