Skip to content

Commit 94ebd87

Browse files
Merge pull request #6231 from christianbeeznest/GH-6135
Learnpath: Display localized short date format in list - refs #6135
2 parents d96768d + d9f3b4c commit 94ebd87

File tree

3 files changed

+12
-11
lines changed

3 files changed

+12
-11
lines changed

public/main/inc/lib/internationalization.lib.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
define('DATE_TIME_FORMAT_SHORT_TIME_FIRST', 7); // 03:28 PM, Aug 25 2009
3131
define('DATE_FORMAT_NUMBER_NO_YEAR', 8); // 25.08 dd-mm
3232
define('DATE_FORMAT_ONLY_DAYNAME', 9); // Monday, Sunday, etc
33+
define('DATE_TIME_FORMAT_SHORT_LOCALIZED', 11);
3334

3435
// Formatting person's name.
3536
// Formatting a person's name using the pattern as it has been
@@ -478,6 +479,10 @@ function api_format_date($time, $format = null, $language = null)
478479
$datetype = IntlDateFormatter::FULL;
479480
$timetype = IntlDateFormatter::SHORT;
480481

482+
break;
483+
case DATE_TIME_FORMAT_SHORT_LOCALIZED:
484+
$datetype = IntlDateFormatter::SHORT;
485+
$timetype = IntlDateFormatter::SHORT;
481486
break;
482487
default:
483488
$datetype = IntlDateFormatter::FULL;

public/main/lp/lp_add.php

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -102,13 +102,9 @@ function activate_end_date() {
102102
// accumulate_scorm_time
103103
$form->addCheckBox(
104104
'accumulate_scorm_time',
105-
[
106-
null,
107-
get_lang(
108-
'When enabled, the session time for SCORM Learning Paths will be cumulative, otherwise, it will only be counted from the last update time.'
109-
),
110-
],
111-
get_lang('Accumulate SCORM session time')
105+
null,
106+
get_lang('When enabled, the session time for SCORM Learning Paths will be cumulative, otherwise, it will only be counted from the last update time.'),
107+
[]
112108
);
113109

114110
// Start date
@@ -119,7 +115,7 @@ function activate_end_date() {
119115
['onclick' => 'activate_start_date()']
120116
);
121117
$form->addElement('html', '<div id="start_date_div" style="display:block;">');
122-
$form->addDatePicker('published_on', get_lang('Publication date'));
118+
$form->addDateTimePicker('published_on', get_lang('Publication date'));
123119
$form->addElement('html', '</div>');
124120

125121
//End date
@@ -130,7 +126,7 @@ function activate_end_date() {
130126
['onclick' => 'activate_end_date()']
131127
);
132128
$form->addElement('html', '<div id="end_date_div" style="display:none;">');
133-
$form->addDatePicker('expired_on', get_lang('Expiration date'));
129+
$form->addDateTimePicker('expired_on', get_lang('Expiration date'));
134130
$form->addElement('html', '</div>');
135131

136132
$subscriptionSettings = learnpath::getSubscriptionSettings();

public/main/lp/lp_list.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -279,10 +279,10 @@ function confirmation(name) {
279279
$start_time = $end_time = '';
280280
if ($is_allowed_to_edit) {
281281
if (!empty($details['published_on'])) {
282-
$start_time = api_convert_and_format_date($details['published_on'], DATE_TIME_FORMAT_SHORT);
282+
$start_time = api_convert_and_format_date($details['published_on'], DATE_TIME_FORMAT_SHORT_LOCALIZED);
283283
}
284284
if (!empty($details['expired_on'])) {
285-
$end_time = api_convert_and_format_date($details['expired_on'], DATE_TIME_FORMAT_SHORT);
285+
$end_time = api_convert_and_format_date($details['expired_on'], DATE_TIME_FORMAT_SHORT_LOCALIZED);
286286
}
287287
} else {
288288
$time_limits = false;

0 commit comments

Comments
 (0)