diff --git a/scripts/langindex.json b/scripts/langindex.json index eafbc0172..82e052166 100644 --- a/scripts/langindex.json +++ b/scripts/langindex.json @@ -1695,6 +1695,7 @@ "core.editor.underline": "atto_underline/pluginname", "core.editor.unorderedlist": "atto_unorderedlist/pluginname", "core.emptysplit": "local_moodlemobileapp", + "core.endingtime": "local_moodlemobileapp", "core.endonesteptour": "tool_usertours", "core.error": "moodle", "core.errorchangecompletion": "local_moodlemobileapp", @@ -2304,6 +2305,7 @@ "core.sort": "moodle", "core.sortby": "moodle", "core.start": "local_moodlemobileapp", + "core.startingtime": "local_moodlemobileapp", "core.storingfiles": "local_moodlemobileapp", "core.strftimedate": "langconfig", "core.strftimedatefullshort": "langconfig", diff --git a/src/addons/calendar/pages/event/event.html b/src/addons/calendar/pages/event/event.html index add0b9a28..e41c029cc 100644 --- a/src/addons/calendar/pages/event/event.html +++ b/src/addons/calendar/pages/event/event.html @@ -58,7 +58,7 @@ - +

{{ 'addon.calendar.when' | translate }}

{ + const getTimeHtml = (time: string, a11yLangKey: string): string => + `${time}`; + const getStartTimeHtml = (time: string): string => getTimeHtml(time, 'core.startingtime'); + const getEndTimeHtml = (time: string): string => getTimeHtml(time, 'core.endingtime'); + const start = event.timestart * 1000; const end = (event.timestart + event.timeduration) * 1000; let time: string; - if (!event.timeduration) { + if (event.timeduration) { if (moment(start).isSame(end, 'day')) { // Event starts and ends the same day. if (event.timeduration == CoreConstants.SECONDS_DAY) { time = Translate.instant('addon.calendar.allday'); } else { - time = CoreTimeUtils.userDate(start, format) + ' » ' + - CoreTimeUtils.userDate(end, format); + time = getStartTimeHtml(CoreTimeUtils.userDate(start, format)) + ' » ' + + getEndTimeHtml(CoreTimeUtils.userDate(end, format)); } } else { @@ -388,11 +393,12 @@ export class AddonCalendarProvider { await Promise.all(promises); - return dayStart + timeStart + ' » ' + dayEnd + timeEnd; + return getStartTimeHtml(dayStart + timeStart) + ' » ' + + getEndTimeHtml(dayEnd + timeEnd); } } else { // There is no time duration. - time = CoreTimeUtils.userDate(start, format); + time = getStartTimeHtml(CoreTimeUtils.userDate(start, format)); } if (showTime) { @@ -2173,6 +2179,7 @@ export type AddonCalendarSubmitCreateUpdateFormDataWSParams = Omit