Zenova (Tracker Form ) - Date function
Specific Folder FTP Upload / ftp-deploy (push) Successful in 1m43s
Details
Specific Folder FTP Upload / ftp-deploy (push) Successful in 1m43s
Details
This commit is contained in:
parent
98ac33fa97
commit
2ef9e0e0d2
|
|
@ -339,22 +339,33 @@ if (!empty($submissions->data->submissions)) {
|
||||||
|
|
||||||
|
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
var maxDate = new Date().toLocaleDateString('en-CA'); // Outputs YYYY-MM-DD in local time
|
var today = new Date();
|
||||||
|
var maxDate = today.toLocaleDateString('en-CA'); // YYYY-MM-DD
|
||||||
var minDate = '2026-10-01';
|
var minDate = '2026-10-01';
|
||||||
|
|
||||||
var $recordDate = $('#field-record_date');
|
var $recordDate = $('#field-record_date');
|
||||||
|
|
||||||
$('#field-record_date').attr({
|
// Min आणि Max attributes सेट करा
|
||||||
|
$recordDate.attr({
|
||||||
min: minDate,
|
min: minDate,
|
||||||
max: maxDate
|
max: maxDate
|
||||||
});
|
});
|
||||||
|
|
||||||
$recordDate.on('change', function() {
|
// Date validation function
|
||||||
var selectedDate = $(this).val();
|
function validateFutureDate() {
|
||||||
|
var selectedDate = $recordDate.val();
|
||||||
|
|
||||||
if (selectedDate && selectedDate > maxDate) {
|
if (selectedDate && selectedDate > maxDate) {
|
||||||
alert('You cannot select a date in the future. Please select a valid date.');
|
alert('Future date is not allowed. Please select today or a past date.');
|
||||||
$(this).val('');
|
$recordDate.val(''); // Clear the input field
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Android वर instant trigger होण्यासाठी input, change, आणि blur
|
||||||
|
$recordDate.on('input change blur', function() {
|
||||||
|
validateFutureDate();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue