Skip to content

Learnpath: Display localized short date format in list - refs #6135 #6231

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 15, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions public/main/inc/lib/internationalization.lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
define('DATE_TIME_FORMAT_SHORT_TIME_FIRST', 7); // 03:28 PM, Aug 25 2009
define('DATE_FORMAT_NUMBER_NO_YEAR', 8); // 25.08 dd-mm
define('DATE_FORMAT_ONLY_DAYNAME', 9); // Monday, Sunday, etc
define('DATE_TIME_FORMAT_SHORT_LOCALIZED', 11);

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

break;
case DATE_TIME_FORMAT_SHORT_LOCALIZED:
$datetype = IntlDateFormatter::SHORT;
$timetype = IntlDateFormatter::SHORT;
break;
default:
$datetype = IntlDateFormatter::FULL;
Expand Down
14 changes: 5 additions & 9 deletions public/main/lp/lp_add.php
Original file line number Diff line number Diff line change
Expand Up @@ -102,13 +102,9 @@ function activate_end_date() {
// accumulate_scorm_time
$form->addCheckBox(
'accumulate_scorm_time',
[
null,
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.'
),
],
get_lang('Accumulate SCORM session time')
null,
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.'),
[]
);

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

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

$subscriptionSettings = learnpath::getSubscriptionSettings();
Expand Down
4 changes: 2 additions & 2 deletions public/main/lp/lp_list.php
Original file line number Diff line number Diff line change
Expand Up @@ -279,10 +279,10 @@ function confirmation(name) {
$start_time = $end_time = '';
if ($is_allowed_to_edit) {
if (!empty($details['published_on'])) {
$start_time = api_convert_and_format_date($details['published_on'], DATE_TIME_FORMAT_SHORT);
$start_time = api_convert_and_format_date($details['published_on'], DATE_TIME_FORMAT_SHORT_LOCALIZED);
}
if (!empty($details['expired_on'])) {
$end_time = api_convert_and_format_date($details['expired_on'], DATE_TIME_FORMAT_SHORT);
$end_time = api_convert_and_format_date($details['expired_on'], DATE_TIME_FORMAT_SHORT_LOCALIZED);
}
} else {
$time_limits = false;
Expand Down
Loading