Tapku 图书馆日历出现奇怪的时区问题
我在 Tapku 图书馆日历方面遇到了一个奇怪的问题。
我正在塔库图书馆日历中显示活动。我正在从美国/多伦多时区的服务器获取日期。 IE。 -500。
我的系统和日历时区在“设置”应用程序中设置为加拿大多伦多。
因此,问题在于日历在错误的日视图(日图块)中显示一个事件。活动日期为 2011 年 11 月 16 日,日历上显示为 17 日。
11/16/2011 17:00 -0500
所以我找到了将时区设置为 GMT 的解决方案。
[dateFormatter setTimeZone:[NSTimeZone timeZoneWithAbbreviation:@"GMT"]];
以上与多伦多时区配合良好。现在,我将时区设置为意大利罗马,它也应该在 16 日显示该事件,但它显示在 17 日。
所以,问题是,如果我保持上面的线,它适用于加拿大多伦多时区,但适用于意大利罗马时区,如果我删除这条线,那么它适用于意大利罗马,适用于意大利多伦多问题。
为此,我也尝试设置 systemTimeZone 和 localTimeZone 但仍然没有成功。
那么,我应该怎么做才能使所有时区的事件保持正确的日视图?
如果您需要更多详细信息,请告诉我。
I have a weird problem with the Tapku Library Calendar.
I am showing events in Tapku Library Calendar. I am getting date from my server in America/Toronto Time zone. ie. -500.
My system and calendar time zone set to Toronto,Canada in Setting app.
So, the problem is when Calendar show one event in wrong day view (day tiles). Event is on 16th November 2011 and it is showing on 17th on to the Calendar.
11/16/2011 17:00 -0500
So I found solution to make time zone as GMT.
[dateFormatter setTimeZone:[NSTimeZone timeZoneWithAbbreviation:@"GMT"]];
And above working fine with Toronto time zone. Now, I set my timezone to Rome,Italy and It suppose to show that event on 16th too but it is showing on 17th.
so, the problem is if I keep above line it works fine with the Toronto, Canada Timezone and problem with the Rome,Italy Timezone and If I remove this line then it works fine for Rome,Italy and problem with Toronto,Italy.
For this I tried to set systemTimeZone and localTimeZone as well but still no luck.
So, what should I do to keep event on correct day view for all the timezones ?
Please let me know if you require any further details.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
这是类似问题的答案:
https://stackoverflow.com/a/9405625/220154
我认为tapku日历将GMT:0设置为它的日期用于与您的日期进行比较,因此它会与时区混淆。当您检查要包含在日历中的日期时,可能需要将日期减少到 GMT 午夜。
希望有帮助。
Here is an answer to a similar problem:
https://stackoverflow.com/a/9405625/220154
I think the tapku calendar sets GMT:0 as the date it uses to compare against your dates, so it mess a lot with timezones. probably you would need to reduct the date to GMT midnight when you are checking what dates to include in the calendar.
hope it helps.
全部 [NSTimeZone timeZoneForSecondsFromGMT:0];应替换为 [NSTimeZone systemTimeZone];
当它不是 systemTimeZone 时,您必须编辑 UIDatePicker 中的日期以反映时区小时的变化,如果您不这样做,所有日期将在一天后显示。
这是问题:https://github.com/devinross/tapkulibrary/issues/40
All [NSTimeZone timeZoneForSecondsFromGMT:0]; should be replaced with [NSTimeZone systemTimeZone];
When it is not systemTimeZone you have to edit your dates coming out of the UIDatePicker to reflect time zone hour change, and all dates would be displayed a day later if you don't.
Here is the issue : https://github.com/devinross/tapkulibrary/issues/40