Commit d256801
authored
fix(ui5-date-picker): performance of selecting is improved when there are min and max date. (#13550)
When minDate/maxDate is set on date-related components (ui5-date-picker, ui5-daterange-picker, ui5-date-time-picker), selecting a date caused ~90 redundant parse() calls per render. The _minDate and _maxDate getters were recomputed from scratch on every access —
calling parse() 2–3 times and constructing a new CalendarDate each time — even though the values hadn't changed.
Similarly, disabledDates ranges were re-parsed on every cell in the 42-day loop (42 × N times per render).
Changes:
DateFormat.ts — added a module-level Map cache for getDateInstance(). Repeated calls with the same options return the cached instance instead of constructing a new one.
DateComponentBase.ts — _minDate and _maxDate now cache their parsed CalendarDate result. Re-parsing only happens when minDate, maxDate, or primaryCalendarType actually changes.
DayPicker.ts — _minDate, _maxDate, and disabled date timestamps are resolved once before the 42-cell render loop and passed into _isDateEnabled().1 parent cfa6155 commit d256801
3 files changed
Lines changed: 56 additions & 22 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
27 | 27 | | |
28 | 28 | | |
29 | 29 | | |
| 30 | + | |
| 31 | + | |
30 | 32 | | |
31 | 33 | | |
32 | 34 | | |
33 | 35 | | |
| 36 | + | |
| 37 | + | |
34 | 38 | | |
35 | 39 | | |
36 | 40 | | |
37 | | - | |
38 | | - | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
39 | 49 | | |
40 | 50 | | |
41 | 51 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
121 | 121 | | |
122 | 122 | | |
123 | 123 | | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
124 | 127 | | |
125 | 128 | | |
126 | 129 | | |
| |||
135 | 138 | | |
136 | 139 | | |
137 | 140 | | |
138 | | - | |
139 | | - | |
140 | | - | |
141 | | - | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
142 | 145 | | |
143 | | - | |
144 | | - | |
| 146 | + | |
145 | 147 | | |
146 | 148 | | |
147 | 149 | | |
148 | | - | |
149 | | - | |
150 | | - | |
151 | | - | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
152 | 154 | | |
153 | | - | |
154 | | - | |
| 155 | + | |
155 | 156 | | |
156 | 157 | | |
157 | 158 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
241 | 241 | | |
242 | 242 | | |
243 | 243 | | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
244 | 248 | | |
245 | 249 | | |
246 | 250 | | |
| |||
262 | 266 | | |
263 | 267 | | |
264 | 268 | | |
265 | | - | |
| 269 | + | |
266 | 270 | | |
267 | 271 | | |
268 | 272 | | |
| |||
825 | 829 | | |
826 | 830 | | |
827 | 831 | | |
| 832 | + | |
| 833 | + | |
| 834 | + | |
| 835 | + | |
| 836 | + | |
| 837 | + | |
| 838 | + | |
| 839 | + | |
| 840 | + | |
| 841 | + | |
| 842 | + | |
| 843 | + | |
828 | 844 | | |
829 | 845 | | |
830 | 846 | | |
831 | 847 | | |
832 | 848 | | |
833 | 849 | | |
834 | 850 | | |
| 851 | + | |
| 852 | + | |
| 853 | + | |
835 | 854 | | |
836 | 855 | | |
837 | 856 | | |
838 | | - | |
839 | | - | |
840 | | - | |
| 857 | + | |
| 858 | + | |
| 859 | + | |
| 860 | + | |
| 861 | + | |
| 862 | + | |
841 | 863 | | |
842 | 864 | | |
843 | 865 | | |
844 | 866 | | |
| 867 | + | |
| 868 | + | |
| 869 | + | |
| 870 | + | |
845 | 871 | | |
846 | | - | |
847 | | - | |
848 | | - | |
849 | | - | |
| 872 | + | |
850 | 873 | | |
851 | 874 | | |
852 | 875 | | |
| |||
0 commit comments