Bug 37371: Move Maskito init to onReady in dateaccessioned.pl

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
This commit is contained in:
Lucas Gass 2024-07-17 14:58:14 +00:00 committed by Martin Renvoize
parent 0f04c9a26a
commit f723c33d48
Signed by: martin.renvoize
GPG key ID: 422B469130441A0F

View file

@ -41,15 +41,19 @@ my $builder = sub {
\$(document).ready(function(){ \$(document).ready(function(){
\$("#$function_name").flatpickr({ \$("#$function_name").flatpickr({
onOpen: function(selectedDates, dateStr, instance) { onReady: function(selectedDates, dateStr, instance) {
let options = maskitoDateOptionsGenerator({ let options = maskitoDateOptionsGenerator({
mode: altinput_dateformat, mode: altinput_dateformat,
separator: delimiter, separator: delimiter,
overwriteMode: 'replace',
}); });
new Maskito( instance.altInput, options );
},
onOpen: function(selectedDates, dateStr, instance) {
if (dateStr == '') { if (dateStr == '') {
instance.setDate(new Date()); instance.setDate(new Date());
} }
new Maskito( instance.altInput, options );
} }
}); });
}); });