Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 8 additions & 7 deletions htdocs/js/DatePicker/datepicker.js
Original file line number Diff line number Diff line change
Expand Up @@ -119,13 +119,14 @@
],
onClick: (index, fp) => {
if (index === 0) {
const today = new Date();
// If there isn't a selected date, then use 12:00 am on the current date.
const selectedDate = fp.selectedDates[0] ?? new Date(new Date().toDateString());
selectedDate.setFullYear(today.getFullYear());
selectedDate.setMonth(today.getMonth());
selectedDate.setDate(today.getDate());
fp.setDate(selectedDate, true);
// The initial date represents 12:00 am on the current date.
const today = new Date(new Date().toDateString());
if (fp.selectedDates[0]) {
today.setHours(fp.selectedDates[0].getHours());
today.setMinutes(fp.selectedDates[0].getMinutes());
today.setSeconds(fp.selectedDates[0].getSeconds());
}
fp.setDate(today, true);
} else if (index === 1) {
fp.setDate(new Date(), true);
}
Expand Down
15 changes: 8 additions & 7 deletions htdocs/js/ProblemSetList/problemsetlist.js
Original file line number Diff line number Diff line change
Expand Up @@ -251,13 +251,14 @@
],
onClick: (index, fp) => {
if (index === 0) {
const today = new Date();
// If there isn't a selected date, then use 12:00 am on the current date.
const selectedDate = fp.selectedDates[0] ?? new Date(new Date().toDateString());
selectedDate.setFullYear(today.getFullYear());
selectedDate.setMonth(today.getMonth());
selectedDate.setDate(today.getDate());
fp.setDate(selectedDate);
// The initial date represents 12:00 am on the current date.
const today = new Date(new Date().toDateString());
if (fp.selectedDates[0]) {
today.setHours(fp.selectedDates[0].getHours());
today.setMinutes(fp.selectedDates[0].getMinutes());
today.setSeconds(fp.selectedDates[0].getSeconds());
}
fp.setDate(today, true);
} else if (index === 1) {
fp.setDate(new Date());
}
Expand Down
Loading