簡體   English   中英

如何使用Drupal 7在Fullcalendar中獲取24小時日期格式

[英]How to get the 24 hours date format in Fullcalendar with Drupal 7

我知道官方文檔的選項。

timeFormataxisFormat之外的所有其他選項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
                },
...

我正在使用Drupal 7,嵌入Fullcalendar庫的模塊(版本1.5.1)

如果您使用的是Drupal 7模塊Fullcalendar,則可以在View的配置中設置時間格式。

編輯視圖並在“ 格式”部分中選中“設置” 時間/日期設置字段集中,您可以更改格式。

默認值為h:mm { - h:mm}。 將其更改為HH:mm { - HH:mm} 24小時時間表示法。 在此輸入圖像描述

根據timeFormat文檔, 24小時格式由HH表示。 嘗試將代碼更改為:

(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.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM