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 树莓派与pix飞控通信
  • ¥15 自动转发微信群信息到另外一个微信群
  • ¥15 outlook无法配置成功
  • ¥30 这是哪个作者做的宝宝起名网站
  • ¥60 版本过低apk如何修改可以兼容新的安卓系统
  • ¥25 由IPR导致的DRIVER_POWER_STATE_FAILURE蓝屏
  • ¥50 有数据,怎么建立模型求影响全要素生产率的因素
  • ¥50 有数据,怎么用matlab求全要素生产率
  • ¥15 TI的insta-spin例程
  • ¥15 完成下列问题完成下列问题