[英]How to get the 24 hours date format in Fullcalendar with Drupal 7
I know the options of the official documentation. 我知道官方文档的选项。
All OTHER options than the timeFormat
and the axisFormat
works very well but my timeFormat
is always displaying as am/pm where I need 24 hours format. 除
timeFormat
和axisFormat
之外的所有其他选项axisFormat
运行良好,但我的timeFormat
始终显示为am / pm,我需要24小时格式。
/**
* @file
* Processes the FullCalendar options and passes them to the integration.
*/
(function ($) {
Drupal.fullcalendar.plugins.fullcalendar = {
options: function (fullcalendar) {
var settings = Drupal.settings.fullcalendar[fullcalendar.dom_id];
var options = {
dragOpacity: 0.5, /* This option IS working*/
timeFormat: { '': 'H:mm' }, /* This is NOT working */
axisFormat: { '': 'H:mm' },
columnFormat: {
month: 'ddd', // Mon
week: 'ddd d/M', // Mon 9/7
day: 'dddd d/M' // Monday 9/7
},
...
I'm using Drupal 7, module which embed Fullcalendar library (version 1.5.1) 我正在使用Drupal 7,嵌入Fullcalendar库的模块(版本1.5.1)
If you are using the Drupal 7 module Fullcalendar then you can set the time format in the configuration of the View. 如果您使用的是Drupal 7模块Fullcalendar,则可以在View的配置中设置时间格式。
Edit the View and check Settings in the Format section. 编辑视图并在“ 格式”部分中选中“设置” 。 Inn the Time/date Settings fieldset you can change the format.
在时间/日期设置字段集中,您可以更改格式。
Default is h:mm{ - h:mm}. 默认值为h:mm { - h:mm}。 Change this to HH:mm{ - HH:mm} for the 24 hour time notation.
将其更改为HH:mm { - HH:mm} 24小时时间表示法。
According to the documentation for timeFormat
the 24 hour format is denoted by HH
. 根据
timeFormat
的文档, 24小时格式由HH
表示。 Try changing your code to this: 尝试将代码更改为:
(function ($) {
Drupal.fullcalendar.plugins.fullcalendar = {
options: function (fullcalendar) {
var settings = Drupal.settings.fullcalendar[fullcalendar.dom_id];
var options = {
dragOpacity: 0.5, /* This option IS working*/
timeFormat: { '': 'HH:mm' }, /* This is NOT working */
axisFormat: { '': 'HH:mm' },
columnFormat: {
month: 'ddd', // Mon
week: 'ddd d/M', // Mon 9/7
day: 'dddd d/M' // Monday 9/7
},
...
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.