From c1600c722e7e6808283484f0f0306ace4220a6d1 Mon Sep 17 00:00:00 2001 From: Nicole Date: Tue, 3 Feb 2026 18:26:33 +0000 Subject: [PATCH 1/3] update location of sample data --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 67dd15d..e36a77f 100644 --- a/README.md +++ b/README.md @@ -53,7 +53,7 @@ program. For an example, install the (which expands to just shy of a gigabyte): ```shell - wget https://exploreuk.uky.edu/fa/findingaid/xml.tar.gz + wget https://solrindex.uky.edu/fa/findingaid/xml.tar.gz tar zxf xml.tar.gz ``` From 76bc05061a89a3d84ba11be4d517a2ed17b77ed2 Mon Sep 17 00:00:00 2001 From: Neal Date: Thu, 5 Feb 2026 16:24:51 -0500 Subject: [PATCH 2/3] validate date client-side --- app/assets/js/requests.js | 87 ++++++++++++++++++++++++++++----------- 1 file changed, 64 insertions(+), 23 deletions(-) diff --git a/app/assets/js/requests.js b/app/assets/js/requests.js index ed4a3b3..810977d 100644 --- a/app/assets/js/requests.js +++ b/app/assets/js/requests.js @@ -235,32 +235,73 @@ var requests = (function() { return { init: function (id) { - $.getJSON("date.php", function (data) { - jid = '#' + id; - hidden = id + '-hidden'; - - /* Insert the fields which this subform must manage. */ - var subform_template = '
'; - $('.fa-request-fieldset').append( - subform_template.replace( - new RegExp('__HIDDEN__', 'g'), - hidden - ) - ); - - /* Add the datepicker. */ - $(jid).val(data.earliest); - $(jid).datepicker({ - showOn: "button", - minDate: new Date(data.earliest), - beforeShowDay: $.datepicker.noWeekends, - dateFormat: "mm/dd/yy" + // standardized to EST/EDT for the library timezone, regardless of client location + const current_date = () => { + const now = new Date().toLocaleString('en-US', { + timeZone: 'America/New_York', + year: 'numeric', month: '2-digit', day: '2-digit', + hour: '2-digit', minute: '2-digit', hour12: false }); - disable_form(); - /* And we're done. */ - initialized = true; + const parts = now.split(', '); + const dateParts = parts[0].split('/'); + const timeParts = parts[1].split(':'); + + return { + year: parseInt(dateParts[2]), + month: parseInt(dateParts[0]), + day: parseInt(dateParts[1]), + hour: parseInt(timeParts[0]), + minute: parseInt(timeParts[1]), + date: new Date(dateParts[2], dateParts[0] - 1, dateParts[1]) + }; + }; + + jid = '#' + id; + hidden = id + '-hidden'; + + const now = current_date(); + const watershedMinutes = 15 * 60 + 30; // 3:30 PM = 930 minutes + const currentMinutes = now.hour * 60 + now.minute; + const dayOfWeek = now.date.getDay(); // 0=Sun, 6=Sat + + const earliest = new Date(now.year, now.month - 1, now.day); + + // If after 3:30 PM ET or weekend, move to next day + if (currentMinutes >= watershedMinutes || dayOfWeek === 0 || dayOfWeek === 6) { + earliest.setDate(earliest.getDate() + 1); + } + + // Skip weekends + while (earliest.getDay() === 0 || earliest.getDay() === 6) { + earliest.setDate(earliest.getDate() + 1); + } + + const earliestStr = (earliest.getMonth() + 1).toString().padStart(2, '0') + '/' + + earliest.getDate().toString().padStart(2, '0') + '/' + + earliest.getFullYear(); + + /* Insert the fields which this subform must manage. */ + const subform_template = '
'; + $('.fa-request-fieldset').append( + subform_template.replace( + new RegExp('__HIDDEN__', 'g'), + hidden + ) + ); + + /* Add the datepicker. */ + $(jid).val(earliestStr); + $(jid).datepicker({ + showOn: "button", + minDate: earliest, + beforeShowDay: $.datepicker.noWeekends, + dateFormat: "mm/dd/yy" }); + disable_form(); + + /* And we're done. */ + initialized = true; }, enable: function () { for (var i = 0; i < hidden_fields.length; ++i) { From 090652575e9aac607fdd5f964d47df1f008dfc76 Mon Sep 17 00:00:00 2001 From: Neal Date: Thu, 5 Feb 2026 16:38:32 -0500 Subject: [PATCH 3/3] remove unused date functionality --- app/assets/js/requests.js | 92 +++++--------------------- app/views/findingaid/requests.mustache | 4 -- public/date.php | 49 -------------- 3 files changed, 15 insertions(+), 130 deletions(-) delete mode 100644 public/date.php diff --git a/app/assets/js/requests.js b/app/assets/js/requests.js index 810977d..2d6bac3 100644 --- a/app/assets/js/requests.js +++ b/app/assets/js/requests.js @@ -198,14 +198,6 @@ var requests = (function() { ]; var subforms = [ - /* TODO: remove the datepicker --mps 2022-08-03 */ - - /* Manage the datepicker. - * - * This maintains a few hidden fields. It initializes - * the datepicker control, which must already appear in - * the DOM. - */ (function () { var id; var jid; @@ -234,75 +226,21 @@ var requests = (function() { } return { - init: function (id) { - // standardized to EST/EDT for the library timezone, regardless of client location - const current_date = () => { - const now = new Date().toLocaleString('en-US', { - timeZone: 'America/New_York', - year: 'numeric', month: '2-digit', day: '2-digit', - hour: '2-digit', minute: '2-digit', hour12: false - }); - - const parts = now.split(', '); - const dateParts = parts[0].split('/'); - const timeParts = parts[1].split(':'); - - return { - year: parseInt(dateParts[2]), - month: parseInt(dateParts[0]), - day: parseInt(dateParts[1]), - hour: parseInt(timeParts[0]), - minute: parseInt(timeParts[1]), - date: new Date(dateParts[2], dateParts[0] - 1, dateParts[1]) - }; - }; - - jid = '#' + id; - hidden = id + '-hidden'; - - const now = current_date(); - const watershedMinutes = 15 * 60 + 30; // 3:30 PM = 930 minutes - const currentMinutes = now.hour * 60 + now.minute; - const dayOfWeek = now.date.getDay(); // 0=Sun, 6=Sat - - const earliest = new Date(now.year, now.month - 1, now.day); - - // If after 3:30 PM ET or weekend, move to next day - if (currentMinutes >= watershedMinutes || dayOfWeek === 0 || dayOfWeek === 6) { - earliest.setDate(earliest.getDate() + 1); - } - - // Skip weekends - while (earliest.getDay() === 0 || earliest.getDay() === 6) { - earliest.setDate(earliest.getDate() + 1); - } - - const earliestStr = (earliest.getMonth() + 1).toString().padStart(2, '0') + '/' + - earliest.getDate().toString().padStart(2, '0') + '/' + - earliest.getFullYear(); - - /* Insert the fields which this subform must manage. */ - const subform_template = '
'; - $('.fa-request-fieldset').append( - subform_template.replace( - new RegExp('__HIDDEN__', 'g'), - hidden - ) - ); - - /* Add the datepicker. */ - $(jid).val(earliestStr); - $(jid).datepicker({ - showOn: "button", - minDate: earliest, - beforeShowDay: $.datepicker.noWeekends, - dateFormat: "mm/dd/yy" - }); - disable_form(); - - /* And we're done. */ - initialized = true; - }, + init: function (id) { + jid = '#' + id; + hidden = id + '-hidden'; + + var subform_template = '
'; + $('.fa-request-fieldset').append( + subform_template.replace( + new RegExp('__HIDDEN__', 'g'), + hidden + ) + ); + disable_form(); + + initialized = true; + }, enable: function () { for (var i = 0; i < hidden_fields.length; ++i) { $('#' + hidden + hidden_fields[i]).attr( diff --git a/app/views/findingaid/requests.mustache b/app/views/findingaid/requests.mustache index d241f8c..9833e75 100644 --- a/app/views/findingaid/requests.mustache +++ b/app/views/findingaid/requests.mustache @@ -25,10 +25,6 @@

Submit a request for SCRC materials.

-