mirror of
https://github.com/hcengineering/platform.git
synced 2025-01-23 20:13:20 +00:00
Fix calendar yearly events duplicates (#5874)
Signed-off-by: Denis Bykhov <bykhov.denis@gmail.com>
This commit is contained in:
parent
30753b4a7a
commit
7ea0a05f59
@ -206,20 +206,36 @@ function generateYearlyValues (
|
|||||||
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 (
|
if (
|
||||||
(byDay == null || matchesByDay(date, byDay)) &&
|
byDay == null &&
|
||||||
(byMonthDay == null || byMonthDay.includes(currentDate.getDate())) &&
|
byMonthDay == null &&
|
||||||
(byYearDay == null || byYearDay.includes(getYearDay(currentDate))) &&
|
byYearDay == null &&
|
||||||
(byWeekNo == null || byWeekNo.includes(getWeekNumber(currentDate))) &&
|
byWeekNo == null &&
|
||||||
(byMonth == null || byMonth.includes(currentDate.getMonth())) &&
|
byMonth == null &&
|
||||||
(bySetPos == null || bySetPos.includes(getSetPos(currentDate)))
|
bySetPos == null
|
||||||
) {
|
) {
|
||||||
|
date = new Date(next)
|
||||||
const res = currentDate.getTime()
|
const res = currentDate.getTime()
|
||||||
if (res >= from && res <= to) {
|
if (res >= from && res <= to) {
|
||||||
values.push(res)
|
values.push(res)
|
||||||
}
|
}
|
||||||
i++
|
i++
|
||||||
|
} else {
|
||||||
|
if (
|
||||||
|
(byDay == null || matchesByDay(date, byDay)) &&
|
||||||
|
(byMonthDay == null || byMonthDay.includes(currentDate.getDate())) &&
|
||||||
|
(byYearDay == null || byYearDay.includes(getYearDay(currentDate))) &&
|
||||||
|
(byWeekNo == null || byWeekNo.includes(getWeekNumber(currentDate))) &&
|
||||||
|
(byMonth == null || byMonth.includes(currentDate.getMonth())) &&
|
||||||
|
(bySetPos == null || bySetPos.includes(getSetPos(currentDate)))
|
||||||
|
) {
|
||||||
|
const res = currentDate.getTime()
|
||||||
|
if (res >= from && res <= to) {
|
||||||
|
values.push(res)
|
||||||
|
}
|
||||||
|
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)
|
||||||
|
Loading…
Reference in New Issue
Block a user