亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

顯示某些事件,但某些事件不在 FullCalendar 中

顯示某些事件,但某些事件不在 FullCalendar 中

陪伴而非守候 2022-06-14 10:09:39
我在嘗試在 FullCalendar 上顯示事件時遇到問題。有些事件會顯示,有些則不會。我通過JSON填充 FC ,到目前為止,即使分頁僅檢索所選月份的事件,它也能正常工作。...events: {    url: '/getEvents',    method: 'GET',    failure: function(error) {        console.log(error);        alerta("Error", "Ups...", "red");    },},...但是現在我正在嘗試從存儲在數據庫中的其他內容中添加更多事件,盡管以相同的方式構建它們,但它們并未顯示在日歷上。我構建這樣的事件(我已經清理了代碼):rows = connection.execute("SELECT...........")events = []for row in rows:    event = {"id": row['id'], "title": row['title'], "start": row['start'], "end": row['end'], "allDay": row['allDay'], "url": row['url'], "color": row['color'], "extendedProps": {"company": row['company'], "state": fila['state']}}    if row['groupId'] is not None:        event['groupId'] = str(row['groupId'])   events.append(event)現在,在程序的其他部分,我以類似的方式創建事件:more_rows = connection.execute("SELECT....")more_events = []for row in more_rows:    event = {"id": row['id'], "title": row['title'], "start": row['start'], "end": row['end'], "allDay": 1, "url": "", "color": row['color'], "extendedProps": {"company": row['company'], "description": row['description'], "type": row['type'], "tecnology": row['tecnology'], "state": row['state']}}    more_events.append(event)它們一起發送到瀏覽器:...events.extend(more_events)return jsonify(events), 200...將jsonify(events)這個 JSON 發送到瀏覽器(我在 python 代碼上使用雙引號,但 jsonify 將其替換為單引號):[{'allDay': 1, 'color': 'blue', 'end': '2019-10-24T00:00:00.000Z', 'extendedProps': {'company': 'Company test', 'state': 'Active'}, 'groupId': '48', 'id': 27, 'start': '2019-10-23T00:00:00.000Z', 'title': 'A title', 'url': ''}, {'allDay': 1, 'color': 'blue', 'end': '2019-10-11T00:00:00.00.000Z', 'extendedProps': {'company': 'Company test', 'description': 'oapisdva?klsjdhalksjdflaksjdf', 'state': 'Active', 'tecnology': 'javascript+html', 'type': 'Cool'}, 'id': 74, 'start': '2019-10-07T00:00:00.00.000Z', 'title': 'owqsakjdflh', 'url': ''}, 問題是......它作為事件打印的第一個元素,但 JSON 上的其余元素沒有打印。我看不出我的錯誤在哪里或我做錯了什么。
查看完整描述

1 回答

?
呼啦一陣風

TA貢獻1802條經驗 獲得超6個贊

我發現了問題(嗯,實際上是一個同事),它就在這里:


第一個元素:'end':'2019-10-24T00:00:00.000Z'||'start':'2019-10-23T00:00:00.000Z'


其他元素:'end': '2019-10-23T00:00:00.00.000Z'||'start': '2019-10-21T00:00:00.00.000Z'


事情是:2019-10-24T 00:00:00 .000Z 和 2019-10-23T 00:00:00.00 .000Z


我使用這個 SQL 來比較日期(它們沒有存儲在 ISO 8601 中):


SELECT id, ....., strftime('%Y-%m-%dT%H:%M:%fZ', start_date) AS start, strftime('%Y-%m-%dT%H:%M:%fZ', end_date) AS end, ...... 

FROM table 

WHERE state = 'Active' AND start > '....' AND end < '....'

我的問題是假設SQlite strftime它等于PYTHON strftime,但不是。


我使用的是這個(Python):'%Y-%m-%dT%H:%M: %S.%f Z'而不是這個(SQlite):'%Y-%m-%dT%H:% M: %f Z'


Python 文檔


%S Second as a zero-padded decimal number.

%f Microsecond as a decimal number, zero-padded on the left.

Sqlite 文檔


%S seconds: 00-59

%f fractional seconds: SS.SSS

所以要小心,不要將 python 格式與 sqlite 格式混淆。


查看完整回答
反對 回復 2022-06-14
  • 1 回答
  • 0 關注
  • 133 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號