From fdec5c75c7d5db7725b16f20f27b23159c126c0d Mon Sep 17 00:00:00 2001 From: zawn Date: Fri, 21 Aug 2026 14:09:53 -0400 Subject: [PATCH 1/3] Hotfix: mozilla browser and readonly changed clash with browser input date type and datepicker jquery --- app/static/js/userProfile.js | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/app/static/js/userProfile.js b/app/static/js/userProfile.js index acb9ec51c..0ff6ceb04 100644 --- a/app/static/js/userProfile.js +++ b/app/static/js/userProfile.js @@ -96,14 +96,13 @@ $(document).ready(function(){ } // This function is to disable all the dates before current date in the ban modal End Date picker - $(function(){ - var banEndDatepicker = $("#banEndDatepicker"); - banEndDatepicker.datepicker({ - changeYear: true, - changeMonth: true, - minDate:+1, - dateFormat: "yy-mm-dd", - }).attr('readonly','readonly'); + $(function () { + const tomorrow = new Date(); + tomorrow.setDate(tomorrow.getDate() + 1); + const year = tomorrow.getFullYear(); + const month = String(tomorrow.getMonth() + 1).padStart(2, "0"); + const day = String(tomorrow.getDate()).padStart(2, "0"); + $("#banEndDatepicker").attr("min",`${year}-${month}-${day}`); }); /* From 3c0751333e89aeb98cb846a2c1dfeb390e844abc Mon Sep 17 00:00:00 2001 From: zawn Date: Mon, 24 Aug 2026 14:01:48 -0400 Subject: [PATCH 2/3] the cross broswer date time input is working because .val() no matter the input is as the checkvalidity and reportvalidity is use it is adopted in all four broswer Chrome, Edge, Firefox, and Safari. So originally the data is getting correct now we also have cover the edge case of user being able to input old dates --- app/static/js/userProfile.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/app/static/js/userProfile.js b/app/static/js/userProfile.js index 0ff6ceb04..ba9eaa629 100644 --- a/app/static/js/userProfile.js +++ b/app/static/js/userProfile.js @@ -122,6 +122,7 @@ $(document).ready(function(){ banButton.data("programID", programID) banButton.data("username", $(".banEdit").data("username")) banButton.data("banOrUnban", banValue); + console.log(banButton) banEndDateDiv.show(); banEndDatepicker.val("") $(".modal-title-ban").text("Mark Volunteer as " + banValue + " from "+ $(this).data("name") + "?"); @@ -144,7 +145,14 @@ $(document).ready(function(){ }); $("#banButton").click(function (){ - $("#banButton").prop("disabled", true) + if ($("#banButton").data('banOrUnban') == "Ineligible"){ + const endDateInput = $("#banEndDatepicker")[0]; + if (!endDateInput.checkValidity()) { + endDateInput.reportValidity(); + return; + }; + }; + $("#banButton").prop("disabled", true) var username = $(this).data("username") //Expected to be the unique username of a user in the database var route = ($(this).data("banOrUnban")).toLowerCase() //Expected to be "ban" or "unban" From b21237edbf6ffc77a1121cfdf28d903dafdea973 Mon Sep 17 00:00:00 2001 From: zawn Date: Mon, 24 Aug 2026 14:03:06 -0400 Subject: [PATCH 3/3] remove console.log --- app/static/js/userProfile.js | 1 - 1 file changed, 1 deletion(-) diff --git a/app/static/js/userProfile.js b/app/static/js/userProfile.js index ba9eaa629..ddfda7d37 100644 --- a/app/static/js/userProfile.js +++ b/app/static/js/userProfile.js @@ -122,7 +122,6 @@ $(document).ready(function(){ banButton.data("programID", programID) banButton.data("username", $(".banEdit").data("username")) banButton.data("banOrUnban", banValue); - console.log(banButton) banEndDateDiv.show(); banEndDatepicker.val("") $(".modal-title-ban").text("Mark Volunteer as " + banValue + " from "+ $(this).data("name") + "?");