[英]How to get the 24 hours date format in Fullcalendar with Drupal 7
我知道官方文檔的選項。
除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
},
...
我正在使用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.