Commit 70187c6
committed
Fix a minor issue with the datepicker.
With the current code if you are in a month that does not have a day
(such as April that does not have the 31st), one of those days is
selected in another month that does have that day, and you click the
"Today" button, then it doesn't go to today. Instead it goes to the
date of today in the next month. This is because the code sets the
year, month, and day for today on the selected date object and in that
order, and uses the modified selected date to set the flatpickr date.
So for example, if today is April 7, 2026, and the selected date is July
31, 2026, then the selected date's year is set to 2026, then the month
set to April. So at that point the selected date is April 31, 2026,
which really becomes May 1, 2026. Then the day is set, and so you get
May 7, 2026.
This fixes the issue by starting with todays date at 12:00 am, and then
setting the time of todays date to the time of the selected date, and
then using that to set the flatpickr date.1 parent fb3b720 commit 70187c6
File tree
2 files changed
+16
-14
lines changed- htdocs/js
- DatePicker
- ProblemSetList
2 files changed
+16
-14
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
119 | 119 | | |
120 | 120 | | |
121 | 121 | | |
122 | | - | |
123 | | - | |
124 | | - | |
125 | | - | |
126 | | - | |
127 | | - | |
128 | | - | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
129 | 130 | | |
130 | 131 | | |
131 | 132 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
251 | 251 | | |
252 | 252 | | |
253 | 253 | | |
254 | | - | |
255 | | - | |
256 | | - | |
257 | | - | |
258 | | - | |
259 | | - | |
260 | | - | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
261 | 262 | | |
262 | 263 | | |
263 | 264 | | |
| |||
0 commit comments