perf(webcal): Optimised the resolve process.

According to RFC-5545 Specification, the timezone is marked in the field
DTEND.
This commit is contained in:
Zihlu Wang
2023-08-07 08:13:09 +08:00
parent e5a89af04f
commit fdd9d435a2
2 changed files with 3 additions and 2 deletions
@@ -272,7 +272,8 @@ public final class WebCalendarEvent extends WebCalendarNode {
Optional.ofNullable(duration)
.map((item) -> "DURATION:PT" + item.getSeconds() + "S\n").orElse("") +
Optional.ofNullable(end)
.map((item) -> "DTEND:" + end.format(DateTimeFormatter.ISO_LOCAL_DATE_TIME) + "\n").orElse("") +
.map((item) -> "DTEND" + Optional.ofNullable(timezone).map(tz -> ";TZID=" + tz).orElse("") + ":" +
end.format(DateTimeFormatter.ISO_LOCAL_DATE_TIME) + "\n").orElse("") +
Optional.ofNullable(classification)
.map((item) -> "CLASS:" + item.getClassification() + "\n").orElse("") +
Optional.ofNullable(comment).map((item) -> "COMMENT:" + item + "\n").orElse("") +
@@ -46,7 +46,7 @@ public class TestWebCalendar {
.setClassification(Classification.PUBLIC)
.setStart(LocalDateTime.of(2023, 8, 6, 0, 0, 0))
.setEnd(LocalDateTime.of(2023, 8, 6, 8, 0, 0))
.setLocation("湖南省长沙市天心区碧云路60号")
.setLocation("Hong Kong University, Pokfulam, Central West, Hong Kong S.A.R")
.setUid(UUID.randomUUID().toString())
.setTimezone("Asia/Hong_Kong"));