jQuery FullCalendar时区同步

我使用的是jQuery Fullcalendar插件(http://arshaw.com/fullcalendar)。 我只将它用于“全天”活动。 当用户创建事件时,我将其作为日期存储在我的数据库中(2012-01-12)。 当通过AJAX将事件列表发送到FullCalendar时,我将日期转换为Unix时间。</ p>

我预见到的问题是服务器在美国和美国的情况 时区,客户在欧洲。 服务器发送2012-01-12 00:00:00(美国时间)的事件,该事件将转换为Unix时间。 然后,客户可能会看到2012-01-12 08:00:00(8小时后)的事件。</ p>

如果事件是在午夜,我如何确保 然后它是在任何地方的午夜 - 不需要调整任何时区。 如果用户在1月12日创建了一整天的活动,我需要世界各地的每个用户在同一天也看到它。 </ p>
</ div>

展开原文

原文

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个回答



FullCalendar有一个选项,ignoreTimezone(参见: http://arshaw.com/fullcalendar/docs/event_data/ignoreTimezone/ ),只需确保将其设置为true(默认情况下为*)并且 用户将看到服务器发送的同一时间,无论用户的时区如何。</ p>

(*我个人认为默认是错误的,开发人员似乎在文档中承认,所以 值得明确设置。)</ p>
</ div>

展开原文

原文

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.)

dtv11049
dtv11049 我需要更新哪个文件?
大约 4 年之前 回复
Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
立即提问
相关内容推荐