I'm using Liferay 7.4 GA 24 CE and I want to change the default hours view in the calendar portlet from 24 hours to just working hours (8 am - to 7 pm).
I've looked into the configuration and couldn't find anything related.
How could I change this?
In the Liferay source code, I've examined the scheduler.jsp file to load the calendar hours.
<c:if test="<%= !hideWeekView %>">
window.<portlet:namespace />weekView = new Liferay.SchedulerWeekView({
headerViewConfig: {
displayDaysInterval: A.DataType.DateMath.WEEK_LENGTH,
eventsOverlayConstrain: '#p_p_id<portlet:namespace />',
strings: showMoreStrings,
},
height: 700,
isoTime: <%= useIsoTimeFormat %>,
readOnly: <%= readOnly %>,
strings: {
allDay: '<liferay-ui:message key="all-day" />',
},
});
</c:if>
<c:if test="<%= !hideMonthView %>">
window.<portlet:namespace />monthView = new Liferay.SchedulerMonthView({
eventsOverlayConstrain: '#p_p_id<portlet:namespace />',
height: 'auto',
isoTime: <%= useIsoTimeFormat %>,
readOnly: <%= readOnly %>,
strings: showMoreStrings,
});
</c:if>
And above code is call js function
const SchedulerDayView = A.Component.create({
ATTRS: {
navigationDateFormatter: {
validator: isFunction,
value(date) {
const instance = this;
const scheduler = instance.get('scheduler');
return A.DataType.Date.format(date, {
format: Liferay.Language.get('a-b-d-y'),
locale: scheduler.get('locale'),
});
},
},
syncCurrentTimeUI() {
const instance = this;
const scheduler = instance.get('scheduler');
const currentTime = scheduler.get('currentTime');
instance._moveCurrentTimeNode(currentTime);
},
},
EXTENDS: A.SchedulerDayView,
NAME: 'scheduler-day-view',
});
Liferay.SchedulerDayView = SchedulerDayView;
Liferay.SchedulerWeekView = A.Component.create({
ATTRS: {
headerDateFormatter: {
validator: isFunction,
value(date) {
const instance = this;
const scheduler = instance.get('scheduler');
return A.DataType.Date.format(date, {
format: Liferay.Language.get('a-d'),
locale: scheduler.get('locale'),
});
},
},
navigationDateFormatter: {
validator: isFunction,
value(date) {
const instance = this;
const scheduler = instance.get('scheduler');
const locale = scheduler.get('locale');
const startDate = instance._firstDayOfWeek(date);
const endDate = DateMath.add(
startDate,
DateMath.DAY,
instance.get('days') - 1
);
const startDateFormat = Liferay.Language.get('b-d');
let endDateFormat;
if (DateMath.isMonthOverlapWeek(startDate)) {
endDateFormat = Liferay.Language.get('b-d-y');
}
else {
endDateFormat = Liferay.Language.get('d-y');
}
const startDateLabel = A.DataType.Date.format(
startDate,
{
format: startDateFormat,
locale,
}
);
const endDateLabel = A.DataType.Date.format(endDate, {
format: endDateFormat,
locale,
});
return [startDateLabel, '—', endDateLabel].join(
' '
);
},
},
},
EXTENDS: A.SchedulerWeekView,
NAME: 'scheduler-week-view',
});