是否有一个 jQuery 日期格式化插件可以处理多个时区和适当的夏令时?
我住在夏威夷,那里没有夏令时。我试图展示一个显示不同时区的日期和时间的世界时钟,但我还需要它来正确计算 DST 偏移量。限制是我必须使用客户端时间,因为应用程序将无法访问互联网。有没有一个 jQuery 插件可以处理这个问题,还是我必须手动编写它?
I live in Hawaii where there is no Daylight Savings Time. I'm trying to show a world clock that displays dates and times from different time zones, but I also need it to properly calculate the DST offset. The limitation is that I must use the client time, as the application will not be able to get internet access. Is there a jQuery plugin that can handle this, or do I have to write it manually?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
它必须是 jQuery 插件吗?
github 上有一个项目,它对 Javascript Date 对象进行原型设计,使其能够处理 时区键,
无论如何做到这一点,您必须让 tzinfo 数据库与您的脚本一起使用(嗯,这是我所知道的唯一可以为您提供有关世界各地 DST 的可靠信息的方法)。我对上面链接的库没有个人经验,但人们似乎时不时地提到它,它是我在 tzinfo 数据库中找到的唯一纯 JavaScript 库。
Does it HAVE to be a jQuery plugin?
There is a project on github that prototypes the Javascript Date object to be able to handle timezone keys
Regardless of how you do it, you will have to get the tzinfo database to work with your script (well, that's the only way I know of that will give you robust information about DST around the world). I have no personal experience of the library I linked above, but people seem to mention it from time to time, and it is the only pure JavaScript lib I have found to the tzinfo database.