Skip to content

Commit

Permalink
年号の表記を前ゼロありに統一
Browse files Browse the repository at this point in the history
  • Loading branch information
kawaseryoma committed Dec 24, 2024
1 parent 03a8161 commit 553b5e6
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions lib/Baser/View/Helper/BcFormHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -1422,6 +1422,7 @@ protected function _generateOptions($name, $options = [])
if ($wyears) {
foreach($wyears as $value) {
list($w, $year) = explode('-', $value);
$year = sprintf('%02d', $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 553b5e6

Please sign in to comment.