簡體   English   中英

FullCalendar 2.2.6時區被忽略

[英]FullCalendar 2.2.6 timezone ignored

我正在嘗試使用FullCalendar( http://fullcalendar.io/ ),除了時區之外,其他所有功能都很好。 由於某些原因,我沒有時間像在網站上的示例中那樣進行更改,並且我看不到代碼中的示例與此處的示例有什么不同:

http://fullcalendar.io/js/fullcalendar-2.2.6/demos/timezones.html

我項目上的代碼要復雜得多,因此我嘗試盡可能地復制該示例,但仍然無法正常工作:

<body>
    <h1>Calendar:</h1>
    <div class="calendar"></div>
</body>

<script>
    function renderCalendar() {
        $('.calendar').fullCalendar({
            header: {
                left: 'prev,next today',
                center: 'title',
                right: 'month,agendaWeek,agendaDay'
            },
            defaultDate: '2014-11-12',
            timezone: 'Europe\/London',
            editable: true,
            eventLimit: true, // allow "more" link when too many events
            events: [{"title":"All Day Event","start":"2014-11-01"},{"title":"Long Event","start":"2014-11-07","end":"2014-11-10"},{"id":"999","title":"Repeating Event","start":"2014-11-09T16:00:00-05:00"},{"id":"999","title":"Repeating Event","start":"2014-11-16T16:00:00-05:00"},{"title":"Conference","start":"2014-11-11","end":"2014-11-13"},{"title":"Meeting","start":"2014-11-12T10:30:00","end":"2014-11-12T12:30:00"},{"title":"Lunch","start":"2014-11-12T12:00:00-05:00"},{"title":"Meeting","start":"2014-11-12T14:30:00-05:00"},{"title":"Happy Hour","start":"2014-11-12T17:30:00-05:00"},{"title":"Dinner","start":"2014-11-12T20:00:00+00:00"},{"title":"Birthday Party","start":"2014-11-13T07:00:00-05:00"},{"url":"http:\/\/google.com\/","title":"Click for Google","start":"2014-11-28"}],
            loading: function(bool) {
                $('#loading').toggle(bool);
            },
            eventRender: function(event, el) {
                // render the timezone offset below the event title
                if (event.start.hasZone()) {
                    el.find('.fc-title').after(
                    $('<div class="tzo"/>').text(event.start.format('Z'))
                    );
                }
            }
        });
    }
    renderCalendar();
</script>

列出的事件是從FullCalendar.io網站上的示例中提取的確切事件。 日歷可以正常顯示,但是更改時區參數不會更改事件顯示的時間:

將時區設置為“無”會在事件下方顯示+00:00

將時區設置為“本地”會在事件下方顯示-05:00(EST,我的時區)

將時區設置為特定位置(例如,“美國/芝加哥”)會在事件下方顯示+00:00,無論指定了什么位置

在所有這些情況下,日歷上顯示的事件的時間都不會更改; 如果輸入的時間是14:00:00,則無論時區設置如何,它都將顯示為2p。 我可能在某處不見了某些東西,但是我看不到它。 任何幫助將不勝感激。 謝謝。

(請注意,這是FullCalendar v2,因此ignoreTimezone參數不存在。)

嘗試使用時區事件功能呈現事件

然后在選項中設置您的時區。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

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