Ical4j Exdate 属性拒绝从 ical 文件解析的 utc EXDATE 末尾的 Z。如何让它保留 Z。我尝试删除 EXDATE 并设置具有所需格式的新 EXDATE,但它仍然不起作用并且 Z 仍然被拒绝。请在下面找到我编写的代码:
Iterator<Property> iterator = cal.getComponents().get(0).getProperties().iterator();
//This iterator iterates over the properties of the one component in a parsed out calendar "cal"
DateList list = new DateList(net.fortuna.ical4j.model.parameter.Value.DATE_TIME);
while (iterator.hasNext()) {
Property p = iterator.next();
if (p.getName().equals("EXDATE")) {
StringBuilder value = new StringBuilder(p.getValue());
value.append("Z");
System.out.println("New ExDate :" + value.toString());
Date date = new Date(value.toString(), "yyyyMMdd'T'hhmmss'Z'");
list.add(date);
iterator.remove();
}
}
if (!list.isEmpty()) {
cal.getComponents().get(0).getProperties().add(new ExDate(list));
}
for (final Property p : cal.getComponents().get(0).getProperties()) {
System.out.println(p.getName() + ":" + p.getValue());
}
获得的结果格式为 EXDATE:20151117T190000,20151118T190000
我如何让它在像“20151117T190000Z”这样的时间戳末尾保留 Z,因为它导致我的客户不理解 exdate 并完全忽略它。这些值在客户端从那里拉取之前存储在 caldav 服务器中