donglin6659 2012-01-12 18:39
浏览 274
已采纳

jQuery FullCalendar时区同步

I am using the jQuery Fullcalendar plugin (http://arshaw.com/fullcalendar). I am only using it for "full day" events. When the user creates an event, I store it in my database via PHP as a date (2012-01-12). When sending the list of events to FullCalendar via AJAX, I convert the date to Unix time.

The problem I am foreseeing, is the case where say the server is in the US with a US timezone, and the client is in Europe. The server sends an event for 2012-01-12 00:00:00 (US Time), which gets converted to a Unix time. Then the client may see an event that is at 2012-01-12 08:00:00 (8 hours later).

How can I make sure that if an event is at midnight, then it's at midnight EVERYWHERE - no need adjust any timezone. If a user creates a full day event on January 12th, I need every user around the world to see it on that same date as well.

  • 写回答

1条回答

  • dongzhang8475 2012-01-13 18:09
    关注

    FullCalendar has a option for this, ignoreTimezone (see: http://arshaw.com/fullcalendar/docs/event_data/ignoreTimezone/ ), just make sure this is set to true (which it is by default*) and the user will see the same time that the server sends, regardless of user's timezone.

    (*personally I think the default is wrong, and the developer seems to acknowledge that in the docs, so it'd be worth setting explicitly.)

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 计组这些题应该咋做呀
  • ¥60 更换迈创SOL6M4AE卡的时候,驱动要重新装才能使用,怎么解决?
  • ¥15 让node服务器有自动加载文件的功能
  • ¥15 jmeter脚本回放有的是对的有的是错的
  • ¥15 r语言蛋白组学相关问题
  • ¥15 Python时间序列如何拟合疏系数模型
  • ¥15 求学软件的前人们指明方向🥺
  • ¥50 如何增强飞上天的树莓派的热点信号强度,以使得笔记本可以在地面实现远程桌面连接
  • ¥20 双层网络上信息-疾病传播
  • ¥50 paddlepaddle pinn