Scheduler — Add hiddenDays option to hide arbitrary days of the week#33188
Scheduler — Add hiddenDays option to hide arbitrary days of the week#33188aleksei-semikozov wants to merge 43 commits intoDevExpress:26_1from
Conversation
| nextDate: (date: Date) => Date, | ||
| ): Date => { | ||
| let date = new Date(start); | ||
| while (isDateSkipped(date, skippedDays)) { |
There was a problem hiding this comment.
Infinite loop risk: if skippedDays contains all 7 days (bypassing normalizeHiddenWeekDays), this loops forever. Add a safety counter:
while (isDateSkipped(date, skippedDays) && ++guard < 8)or rewrite to for...
There was a problem hiding this comment.
The risk is theoretical, because skippedDays can't have all days because of our validation, but still makes sense. I added if condition which checks additionally if the skippedDays is 7 and fixes the potential issue
|
|
||
| protected incrementDate(date) { | ||
| date.setDate(date.getDate() + 1); | ||
| while ((this.option('skippedDays') ?? []).includes(date.getDay())) { |
There was a problem hiding this comment.
Same infinite loop risk — while loop skipping days has no max iterations guard.
| "Thu 5", | ||
| "Fri 6", | ||
| "Sat 7", | ||
| "Mon 9", |
There was a problem hiding this comment.
Snapshot changed "Sat 7" → "Mon 9" in TimelineWorkWeek — is this intentional? Old snapshot had Mon-Sat (7 days), now skips Sat/Sun. Please confirm the new incrementDate logic correctly handles TimelineWorkWeek headers.
There was a problem hiding this comment.
This is intended. This is bug not related with timezone. In the snapshot we saved a buggy state that no one noticed is buggy. In timelineWorkWeek we can't have weekend days. You can see the bug here: https://codepen.io/sjbur/pen/Kwgbqdr
Also attaching two screenshots: the first is original state with bug, second one is current implementation without bug.
| "Thu 5", | ||
| "Fri 6", | ||
| "Sat 7", | ||
| "Mon 9", |
There was a problem hiding this comment.
This is intended. This is bug not related with timezone. In the snapshot we saved a buggy state that no one noticed is buggy. In timelineWorkWeek we can't have weekend days. You can see the bug here: https://codepen.io/sjbur/pen/Kwgbqdr
Also attaching two screenshots: the first is original state with bug, second one is current implementation without bug.
No description provided.