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']); } /**