Fix calendar yearly events duplicates (#5874)

Signed-off-by: Denis Bykhov <bykhov.denis@gmail.com>
This commit is contained in:
Denis Bykhov 2024-06-20 21:09:56 +05:00 committed by GitHub
parent 30753b4a7a
commit 7ea0a05f59
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -205,6 +205,21 @@ function generateYearlyValues (
while (date < end) { while (date < end) {
if (endDate != null && date.getTime() > endDate) return if (endDate != null && date.getTime() > endDate) return
if (date.getTime() > to) return if (date.getTime() > to) return
if (
byDay == null &&
byMonthDay == null &&
byYearDay == null &&
byWeekNo == null &&
byMonth == null &&
bySetPos == null
) {
date = new Date(next)
const res = currentDate.getTime()
if (res >= from && res <= to) {
values.push(res)
}
i++
} else {
if ( if (
(byDay == null || matchesByDay(date, byDay)) && (byDay == null || matchesByDay(date, byDay)) &&
(byMonthDay == null || byMonthDay.includes(currentDate.getDate())) && (byMonthDay == null || byMonthDay.includes(currentDate.getDate())) &&
@ -220,6 +235,7 @@ function generateYearlyValues (
i++ i++
} }
date = new Date(date.setDate(date.getDate() + 1)) date = new Date(date.setDate(date.getDate() + 1))
}
if (count !== undefined && i === count) return if (count !== undefined && i === count) return
} }
currentDate = new Date(next) currentDate = new Date(next)