我正在使用AppointmentCalendar保存对AppointmentCalendar.SaveAppointmentAsync(...)的预约。此约会是包含信息的系列的主。
在保存约会之后,我再次通过使用约会的GetAppointmentAsync在同一日历上调用LocalId来检索完全相同的约会。
以下是意想不到的行为:加载的约会有一个不同之处:Recurrence.Until日期是由一个取消的。为什么会这样呢?
下面是被序列化为JSON的相关约会:
我保存的Appointment:
{
"Location": "",
"AllDay": false,
"Organizer": null,
"Duration": "00:45:00",
"Details": "",
"BusyStatus": 0,
"Recurrence": {
"Unit": 1,
"Occurrences": 260,
"Month": 1,
"Interval": 1,
"DaysOfWeek": 62,
"Day": 1,
"WeekOfMonth": 0,
"Until": "2016-12-31T01:00:00+01:00",
"TimeZone": "Europe/Budapest",
"RecurrenceType": 0,
"CalendarIdentifier": ""
},
"Subject": "test",
"Uri": null,
"StartTime": "2016-01-04T11:30:00+01:00",
"Sensitivity": 0,
"Reminder": null,
"Invitees": {},
"AllowNewTimeProposal": true,
"UserResponse": 0,
"RoamingId": "c,b,fd",
"ReplyTime": null,
"IsResponseRequested": true,
"IsOrganizedByUser": false,
"IsCanceledMeeting": false,
"OnlineMeetingLink": "",
"HasInvitees": false,
"CalendarId": "b,37,355",
"LocalId": "c,37,20a3",
"OriginalStartTime": null,
"RemoteChangeNumber": 0,
"DetailsKind": 0,
"ChangeNumber": 39537577
}下面是通过调用Appointment检索它之后的相同的GetAppointmentAsync
{
"Location": "",
"AllDay": false,
"Organizer": null,
"Duration": "00:45:00",
"Details": "",
"BusyStatus": 0,
"Recurrence": {
"Unit": 1,
"Occurrences": 260,
"Month": 1,
"Interval": 1,
"DaysOfWeek": 62,
"Day": 1,
"WeekOfMonth": 0,
"Until": "2016-12-30T01:00:00+01:00",
"TimeZone": "Europe/Budapest",
"RecurrenceType": 0,
"CalendarIdentifier": "GregorianCalendar"
},
"Subject": "test",
"Uri": null,
"StartTime": "2016-01-04T11:30:00+01:00",
"Sensitivity": 0,
"Reminder": null,
"Invitees": {},
"AllowNewTimeProposal": true,
"UserResponse": 0,
"RoamingId": "c,b,fd",
"ReplyTime": null,
"IsResponseRequested": true,
"IsOrganizedByUser": false,
"IsCanceledMeeting": false,
"OnlineMeetingLink": "",
"HasInvitees": false,
"CalendarId": "b,37,355",
"LocalId": "c,37,20a3",
"OriginalStartTime": null,
"RemoteChangeNumber": 0,
"DetailsKind": 0,
"ChangeNumber": 39537577
}对于这些JSON,在Recurrence部分中有两个不同之处:
CalendarIdentifier在原始约会中为空以保存(因为setter是私有的)。但更重要的是:Recurrence.Until不同!
Recurrence.Until预约保存:"2016-12-31T01:00:00+01:00“
装货后预约Recurrence.Until:"2016-12-30T01:00:00+01:00“
有一天不见了。
为什么会这样呢?在节约约会的时候还有什么需要做的吗?或者更糟的是:这仅仅是我的日历和约会的边缘案例,甚至可能与当前的日期相关吗?
(SDK版本10.0.14393.0,赢得10周年)
发布于 2016-09-21 01:20:34
我为自己做了很多测试。在我的测试中,如果我在上午8:00之前设置了最后一天的时间,recurrence.until的结果将像上面显示的那样在一天内结束,设置其他时间将得到正确的一天,但是无论您实际设置的时间是8:00,您得到的结果都是上午8:00。详情请参阅下列测试结果。

它似乎相对于时区(我的时区是UTC+8:00)。简单的解决方法是,当您设置until时,只需将日期设置为如下所示:recurrence.Until = UntilDatePicker.Date;,不要将特定时间设置为until。实际上,即使在日历应用程序中手动设置until,我们也不需要特定的时间设置它。

我还上传了一个演示,您可以下载进一步的测试。
https://stackoverflow.com/questions/39498068
复制相似问题