Skip to content

Commit 922c03a

Browse files
authored
Merge 3214d9d into 3674921
2 parents 3674921 + 3214d9d commit 922c03a

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

app/static/js/createEvents.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -101,11 +101,11 @@ function displayNotification(message) {
101101
});
102102
}
103103

104-
function isDateInPast(dateString) {
105-
const date = new Date(dateString);
106-
const today = new Date();
107-
today.setHours(0, 0, 0, 0);
108-
return date < today;
104+
function isDateInPast(dateString, timeString) {
105+
const combineDateTime = `${dateString}T${timeString}:00`;
106+
const setDate = new Date(combineDateTime).getTime();
107+
const today = Date.now();
108+
return setDate < today;
109109
}
110110

111111
function initializeFlatpickr(obj) {
@@ -233,7 +233,7 @@ $('#multipleOfferingSave').on('click', function() {
233233

234234
// Add past date validation
235235
datePickerInputs.each(function(index, element) {
236-
if (!allowPastStart && isDateInPast($(element).val())) {
236+
if (!allowPastStart && isDateInPast($(element).val(), startTimeInputs[index].value.trim())) {
237237
$(element).addClass('border-red');
238238
hasInvalidDates = true;
239239
} else {

0 commit comments

Comments
 (0)