Commit b177cc93 authored by Mingsong's avatar Mingsong Committed by Mingsong Hu

Issue #3053438 by DuaelFr, Mingsong, pslcbs, maxstarkenburg: Add option to...

Issue #3053438 by DuaelFr, Mingsong, pslcbs, maxstarkenburg: Add option to edit timeFormat in month view
parent 64bc2f9f
# External libraries.
libraries.moment:
remote: https://github.com/moment/moment/
version: '2.26.0'
license:
name: MIT
url: https://raw.githubusercontent.com/moment/moment/develop/LICENSE
gpl-compatible: true
cdn:
https://unpkg.com/moment@2.26.0/min/moment.min.js
js:
/libraries/moment/2.26.0/moment.min.js: { minified: true }
libraries.rrule:
remote: https://github.com/jakubroztocil/rrule
version: '2.6.4'
......@@ -47,6 +59,7 @@ libraries.fullcalendar:
/libraries/fullcalendar/rrule/main.min.js: { minified: true }
dependencies:
- fullcalendar_view/libraries.fullcalendar-theme
- fullcalendar_view/libraries.moment
- fullcalendar_view/libraries.rrule
libraries.jsframe:
......
......@@ -56,6 +56,11 @@ function fullcalendar_view_library_info_alter(array &$libraries, $module) {
if ($cdn_library) {
$libraries['libraries.jsframe']['js'] = $cdn_library;
}
// Moment.js
$cdn_library = _fullcalendar_view_use_cdn_full_path($libraries, 'libraries.moment', 'js');
if ($cdn_library) {
$libraries['libraries.moment']['js'] = $cdn_library;
}
// RRule js.
$cdn_library = _fullcalendar_view_use_cdn_full_path($libraries, 'libraries.rrule', 'js');
if ($cdn_library) {
......
......@@ -313,7 +313,7 @@ class FullcalendarViewPreprocess {
'center' => 'title',
'right' => $right_buttons
],
'timeFormat' => $timeFormat,
'eventTimeFormat' => $timeFormat,
'firstDay' => $first_day,
'locale' => $default_lang,
'events' => $entries,
......
......@@ -84,7 +84,7 @@ class FullCalendarDisplay extends StylePluginBase {
];
$options['default_view'] = ['default' => 'dayGridMonth'];
$options['nav_links'] = ['default' => 1];
$options['timeFormat'] = ['default' => 'H(:mm)'];
$options['timeFormat'] = ['default' => 'hh:mm a'];
$options['defaultLanguage'] = ['default' => 'en'];
$options['languageSelector'] = ['default' => 0];
$options['allowEventOverlap'] = ['default' => 1];
......@@ -225,9 +225,8 @@ class FullCalendarDisplay extends StylePluginBase {
'#fieldset' => 'display',
'#type' => 'textfield',
'#title' => $this->t('Time Format settings for month view'),
'#default_value' => (isset($this->options['timeFormat'])) ? $this->options['timeFormat'] : 'HH:mm',
'#description' => $this->t('See the %fullcalendar_doc and %momentjs_doc for available formatting options. <br />Leave it blank to default format.', array(
'%fullcalendar_doc' => Link::fromTextAndUrl($this->t('Fullcalendar documentation'), Url::fromUri('https://fullcalendar.io/docs/v3/timeFormat', array('attributes' => array('target' => '_blank'))))->toString(),
'#default_value' => (isset($this->options['timeFormat'])) ? $this->options['timeFormat'] : 'hh:mm a',
'#description' => $this->t('See %momentjs_doc for available formatting options. <br />Leave it blank to use the default format "hh:mm a".', array(
'%momentjs_doc' => Link::fromTextAndUrl($this->t('MomentJS’s formatting characters'), Url::fromUri('http://momentjs.com/docs/#/displaying/format/', array('attributes' => array('target' => '_blank'))))->toString(),
)),
'#size' => 20,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment