gpt4 book ai didi

javascript - FullCalendar 在设置为本地但不在欧洲/雅典时调整时区

转载 作者:行者123 更新时间:2023-12-03 11:32:02 35 4
gpt4 key购买 nike

您好,我正在使用 FullCalendar 2.1.1,但我遇到时区问题。该应用程序正在使用 Yii 框架 开发,当我将时区设置为欧洲/雅典

'timezone' => 'Europe/Athens'

时区设置为 GMT 0000 它会忽略该设置,而如果我设置

'timezone' => 'local'

时区按预期设置为 GMT 0200。问题是应用程序中使用的日期基于欧洲/雅典区域,因此我认为依赖本地时间并不安全。

最佳答案

实际上,您的机器不知道“欧洲/雅典”时区,因此您必须定义它。

如何做到这一点?

引用这里:

http://fullcalendar.io/docs/timezone/timezone/

Timezone string (like "America/Chicago")

Use this mode if you store timezone information for your events and you want them displayed in a timezone that can be customized.

{ title: "event1", start: "2013-10-20T02:00:00+09:00" }
// ^ ^
// will display as 2:00 |
// |
// timezone offset will always be +09:00

如果您想获取 TZ 设置,通常是在服务器端完成,但使用 node.js + moment.js 对您来说会更容易,请检查:

http://momentjs.com/timezone/docs/#/using-timezones/

关于javascript - FullCalendar 在设置为本地但不在欧洲/雅典时调整时区,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26695604/

35 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com