简体   繁体   English

ionic2-日历/日历时间差

[英]ionic2-calendar/calendar time difference

I'm developing an Ionic app and integrationg ionic2-calendar/calendar. 我正在开发一个Ionic应用程序并集成ionic2-calendar / calendar。 I have a problem with iOs. 我对iO有问题。 I retrieve data from our SQL database: 我从我们的SQL数据库检索数据:

start time: 2018-10-30 09:30:00.000 | 开始时间:2018-10-30 09:30:00.000 | end time: 2018-10-30 10:30:00.000. 结束时间:2018-10-30 10:30:00.000。

On Android devices and while running the application with ionic serve the start and end time is displayed correctly in the calendar. 在Android设备上以及使用ionic服务运行应用程序时,开始时间和结束时间会在日历中正确显示。 On iOs devices on the other hand the start time is displayed as 11:30 and the end time as 12:30. 另一方面,在iOs设备上,开始时间显示为11:30,结束时间显示为12:30。 I get a 2 hour difference in time. 我的时间差了2小时。

Has anyone encountered this issue as well? 有人也遇到过这个问题吗?

If you are doing this 如果你这样做

startTime: new Date('2019-09-19T10:30.000Z')

This format is not supported in Safari. Safari不支持此格式。 You'll have to replace '-' with '/', remove the T and everything after the dot (.000Z) 您必须将'-'替换为'/',删除T和点号(.000Z)之后的所有内容

startTime: new Date(('2019-09-19T10:30.000Z').replace(/-/g, '/').replace('T', ' ').replace(/\..*|\+.*/, ''))

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM