From 6ba23d5d6623a110a5c6c99e4a0050a446b46890 Mon Sep 17 00:00:00 2001 From: ryoma_kawase <137789417+RyoK513@users.noreply.github.com> Date: Sun, 29 Dec 2024 14:46:15 +0900 Subject: [PATCH] =?UTF-8?q?fix=20#4094=20=E3=83=A1=E3=83=BC=E3=83=AB?= =?UTF-8?q?=E3=83=95=E3=82=A9=E3=83=BC=E3=83=A0=E3=81=AE=E5=92=8C=E6=9A=A6?= =?UTF-8?q?=E6=97=A5=E4=BB=98=E3=81=A7=E3=80=81=E5=85=A5=E5=8A=9B=E7=94=BB?= =?UTF-8?q?=E9=9D=A2=E3=81=A8=E7=A2=BA=E8=AA=8D=E7=94=BB=E9=9D=A2=E3=81=AE?= =?UTF-8?q?=E8=A1=A8=E7=A4=BA=E3=81=AB=E5=B7=AE=E7=95=B0=E3=81=8C=E3=81=82?= =?UTF-8?q?=E3=82=8B=E5=95=8F=E9=A1=8C=E3=82=92=E4=BF=AE=E6=AD=A3=20(#4095?= =?UTF-8?q?)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: kawase --- .../Plugin/Mail/Test/Case/View/Helper/MaildataHelperTest.php | 4 ++-- lib/Baser/View/Helper/BcFormHelper.php | 4 +++- lib/Baser/View/Helper/BcTextHelper.php | 2 +- lib/Baser/View/Helper/BcTimeHelper.php | 2 +- 4 files changed, 7 insertions(+), 5 deletions(-) diff --git a/lib/Baser/Plugin/Mail/Test/Case/View/Helper/MaildataHelperTest.php b/lib/Baser/Plugin/Mail/Test/Case/View/Helper/MaildataHelperTest.php index 0b6bef938d..5cd98dc2fe 100644 --- a/lib/Baser/Plugin/Mail/Test/Case/View/Helper/MaildataHelperTest.php +++ b/lib/Baser/Plugin/Mail/Test/Case/View/Helper/MaildataHelperTest.php @@ -91,8 +91,8 @@ public function toDisplayStringProvider() ['date_time_calender', '2100/08/32', true, ' 1970年 01月 01日'], ['date_time_calender', '', true, ''], ['date_time_wareki', 'hoge', true, ''], - ['date_time_wareki', '20200828', true, ' 令和 2年 08月 28日'], - ['date_time_wareki', '19950828', true, ' 平成 7年 08月 28日'], + ['date_time_wareki', '20200828', true, ' 令和 02年 08月 28日'], + ['date_time_wareki', '19950828', true, ' 平成 07年 08月 28日'], ['date_time_wareki', '19500828', true, ' 昭和 25年 08月 28日'], ['date_time_wareki', '1950/08/28', true, ' 昭和 25年 08月 28日'], ['autozip', '888-0000', true, ' 888-0000'], diff --git a/lib/Baser/View/Helper/BcFormHelper.php b/lib/Baser/View/Helper/BcFormHelper.php index f26edcf2cd..e1d0edeec3 100644 --- a/lib/Baser/View/Helper/BcFormHelper.php +++ b/lib/Baser/View/Helper/BcFormHelper.php @@ -1349,7 +1349,7 @@ protected function _generateOptions($name, $options = []) break; case 'day': for($i = 1; $i <= 31; $i++) { - $data[sprintf('%02d', $i)] = $i; + $data[sprintf('%02d', $i)] = sprintf('%02d', $i); } break; case 'month': @@ -1422,6 +1422,8 @@ protected function _generateOptions($name, $options = []) if ($wyears) { foreach($wyears as $value) { list($w, $year) = explode('-', $value); + $year = sprintf('%02d', $year); + $value = $w . '-' . $year; $data[$value] = $this->BcTime->nengo($w) . ' ' . $year; } } diff --git a/lib/Baser/View/Helper/BcTextHelper.php b/lib/Baser/View/Helper/BcTextHelper.php index 12dd9ed8a3..7061091d08 100755 --- a/lib/Baser/View/Helper/BcTextHelper.php +++ b/lib/Baser/View/Helper/BcTextHelper.php @@ -255,7 +255,7 @@ public function dateTimeWareki($arrDate) } list($w, $year) = explode('-', $arrDate['year']); $wareki = $this->BcTime->nengo($w); - return $wareki . " " . $year . "年 " . $arrDate['month'] . "月 " . $arrDate['day'] . '日'; + return $wareki . " " . sprintf('%02d', $year) . "年 " . $arrDate['month'] . "月 " . $arrDate['day'] . '日'; } /** diff --git a/lib/Baser/View/Helper/BcTimeHelper.php b/lib/Baser/View/Helper/BcTimeHelper.php index f41b168e54..232670ffef 100755 --- a/lib/Baser/View/Helper/BcTimeHelper.php +++ b/lib/Baser/View/Helper/BcTimeHelper.php @@ -83,7 +83,7 @@ public function wyear($date) if (!preg_match($this->warekiRegex, $date, $matches)) { return false; } - return $matches['year']; + return sprintf('%02d', $matches['year']); } /**