#116 Re-added previous date formats that no longer exist
This commit is contained in:
parent
1015ffa46d
commit
b18f4347cb
1 changed files with 6 additions and 2 deletions
|
@ -230,7 +230,11 @@ class element extends \mod_customcert\element {
|
||||||
public static function get_date_formats() {
|
public static function get_date_formats() {
|
||||||
$date = time();
|
$date = time();
|
||||||
|
|
||||||
|
$suffix = self::get_ordinal_number_suffix(userdate($date, '%d'));
|
||||||
|
|
||||||
$dateformats = array(
|
$dateformats = array(
|
||||||
|
1 => userdate($date, '%B %d, %Y'),
|
||||||
|
2 => userdate($date, '%B %d' . $suffix . ', %Y'),
|
||||||
'strftimedate' => userdate($date, get_string('strftimedate', 'langconfig')),
|
'strftimedate' => userdate($date, get_string('strftimedate', 'langconfig')),
|
||||||
'strftimedatefullshort' => userdate($date, get_string('strftimedatefullshort', 'langconfig')),
|
'strftimedatefullshort' => userdate($date, get_string('strftimedatefullshort', 'langconfig')),
|
||||||
'strftimedateshort' => userdate($date, get_string('strftimedateshort', 'langconfig')),
|
'strftimedateshort' => userdate($date, get_string('strftimedateshort', 'langconfig')),
|
||||||
|
@ -264,7 +268,7 @@ class element extends \mod_customcert\element {
|
||||||
$certificatedate = userdate($date, '%B %d, %Y');
|
$certificatedate = userdate($date, '%B %d, %Y');
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
$suffix = $this->get_ordinal_number_suffix(userdate($date, '%d'));
|
$suffix = self::get_ordinal_number_suffix(userdate($date, '%d'));
|
||||||
$certificatedate = userdate($date, '%B %d' . $suffix . ', %Y');
|
$certificatedate = userdate($date, '%B %d' . $suffix . ', %Y');
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
|
@ -293,7 +297,7 @@ class element extends \mod_customcert\element {
|
||||||
* @param int $day the day of the month
|
* @param int $day the day of the month
|
||||||
* @return string the suffix.
|
* @return string the suffix.
|
||||||
*/
|
*/
|
||||||
protected function get_ordinal_number_suffix($day) {
|
protected static function get_ordinal_number_suffix($day) {
|
||||||
if (!in_array(($day % 100), array(11, 12, 13))) {
|
if (!in_array(($day % 100), array(11, 12, 13))) {
|
||||||
switch ($day % 10) {
|
switch ($day % 10) {
|
||||||
// Handle 1st, 2nd, 3rd.
|
// Handle 1st, 2nd, 3rd.
|
||||||
|
|
Loading…
Reference in a new issue