perf(webcal): Optimised the resolve process.
According to RFC-5545 Specification, the timezone is marked in the field DTEND.
This commit is contained in:
@@ -272,7 +272,8 @@ public final class WebCalendarEvent extends WebCalendarNode {
|
|||||||
Optional.ofNullable(duration)
|
Optional.ofNullable(duration)
|
||||||
.map((item) -> "DURATION:PT" + item.getSeconds() + "S\n").orElse("") +
|
.map((item) -> "DURATION:PT" + item.getSeconds() + "S\n").orElse("") +
|
||||||
Optional.ofNullable(end)
|
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)
|
Optional.ofNullable(classification)
|
||||||
.map((item) -> "CLASS:" + item.getClassification() + "\n").orElse("") +
|
.map((item) -> "CLASS:" + item.getClassification() + "\n").orElse("") +
|
||||||
Optional.ofNullable(comment).map((item) -> "COMMENT:" + item + "\n").orElse("") +
|
Optional.ofNullable(comment).map((item) -> "COMMENT:" + item + "\n").orElse("") +
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ public class TestWebCalendar {
|
|||||||
.setClassification(Classification.PUBLIC)
|
.setClassification(Classification.PUBLIC)
|
||||||
.setStart(LocalDateTime.of(2023, 8, 6, 0, 0, 0))
|
.setStart(LocalDateTime.of(2023, 8, 6, 0, 0, 0))
|
||||||
.setEnd(LocalDateTime.of(2023, 8, 6, 8, 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())
|
.setUid(UUID.randomUUID().toString())
|
||||||
.setTimezone("Asia/Hong_Kong"));
|
.setTimezone("Asia/Hong_Kong"));
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user