Skip to content

Commit

Permalink
fix #4094 メールフォームの和暦日付で、入力画面と確認画面の表示に差異がある問題を修正 (#4095)
Browse files Browse the repository at this point in the history
Co-authored-by: kawase <[email protected]>
  • Loading branch information
RyoK513 and kawaseryoma authored Dec 29, 2024
1 parent d74f7b1 commit 6ba23d5
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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'],
Expand Down
4 changes: 3 additions & 1 deletion lib/Baser/View/Helper/BcFormHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -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':
Expand Down Expand Up @@ -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;
}
}
Expand Down
2 changes: 1 addition & 1 deletion lib/Baser/View/Helper/BcTextHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -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'] . '';
}

/**
Expand Down
2 changes: 1 addition & 1 deletion lib/Baser/View/Helper/BcTimeHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -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']);
}

/**
Expand Down

0 comments on commit 6ba23d5

Please sign in to comment.