|
68 | 68 | /** Wait with updating the date until a date is selected */ |
69 | 69 | export let browseWithoutSelecting = false |
70 | 70 |
|
71 | | - let browseYear = browseDate.getFullYear() |
72 | | - function getBrowseYear(d: Date) { |
73 | | - browseYear = d.getFullYear() |
74 | | - } |
75 | | - $: getBrowseYear(browseDate) |
| 71 | + $: browseYear = browseDate.getFullYear() |
76 | 72 | function setYear(newYear: number) { |
77 | 73 | browseDate.setFullYear(newYear) |
78 | 74 | browseDate = browseDate |
79 | 75 | browse(browseDate) |
80 | 76 | } |
81 | | - $: setYear(browseYear) |
82 | 77 |
|
83 | | - let browseMonth = browseDate.getMonth() |
84 | | - function getBrowseMonth(d: Date) { |
85 | | - browseMonth = d.getMonth() |
86 | | - } |
87 | | - $: getBrowseMonth(browseDate) |
| 78 | + $: browseMonth = browseDate.getMonth() |
88 | 79 | function setMonth(newMonth: number) { |
89 | 80 | let newYear = browseDate.getFullYear() |
90 | 81 | if (newMonth === 12) { |
|
109 | 100 | ) |
110 | 101 | ) |
111 | 102 | } |
112 | | - $: setMonth(browseMonth) |
113 | 103 |
|
114 | 104 | $: calendarDays = getCalendarDays(browseDate, iLocale.weekStartsOn) |
115 | 105 |
|
|
226 | 216 | > |
227 | 217 | </div> |
228 | 218 | <div class="dropdown month"> |
229 | | - <select bind:value={browseMonth} on:keydown={monthKeydown}> |
| 219 | + <select |
| 220 | + value={browseMonth} |
| 221 | + on:keydown={monthKeydown} |
| 222 | + on:input={(e) => setMonth(parseInt(e.currentTarget.value))} |
| 223 | + > |
230 | 224 | {#each iLocale.months as monthName, i} |
231 | 225 | <option |
232 | 226 | disabled={new Date(browseYear, i, getMonthLength(browseYear, i), 23, 59, 59, 999) < |
|
252 | 246 | > |
253 | 247 | </div> |
254 | 248 | <div class="dropdown year"> |
255 | | - <select bind:value={browseYear} on:keydown={yearKeydown}> |
| 249 | + <select |
| 250 | + value={browseYear} |
| 251 | + on:input={(e) => setYear(parseInt(e.currentTarget.value))} |
| 252 | + on:keydown={yearKeydown} |
| 253 | + > |
256 | 254 | {#each years as v} |
257 | 255 | <option value={v}>{v}</option> |
258 | 256 | {/each} |
|
0 commit comments