mirror of
https://github.com/e107inc/e107.git
synced 2025-08-05 14:17:49 +02:00
fix for date field without click on calendar
This commit is contained in:
@@ -24,7 +24,32 @@ var e107 = e107 || {'settings': {}, 'behaviors': {}};
|
|||||||
var newTarget = "#" + id.replace("e-datepicker-", "");
|
var newTarget = "#" + id.replace("e-datepicker-", "");
|
||||||
$(newTarget).val(newValue);
|
$(newTarget).val(newValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// If UNIX timestamp is required, manually convert the date string (dd.mm.yyyy)
|
||||||
|
if (useUnix === "true") {
|
||||||
|
var parts = newValue.split(".");
|
||||||
|
if (parts.length === 3) {
|
||||||
|
var day = parseInt(parts[0], 10);
|
||||||
|
var month = parseInt(parts[1], 10) - 1; // Month is zero-based in JS
|
||||||
|
var year = parseInt(parts[2], 10);
|
||||||
|
|
||||||
|
// Validate date parts
|
||||||
|
if (!isNaN(day) && !isNaN(month) && !isNaN(year)) {
|
||||||
|
var date = new Date(year, month, day);
|
||||||
|
var unixTimestamp = Math.floor(date.getTime() / 1000);
|
||||||
|
var id = $this.attr("id");
|
||||||
|
var newTarget = "#" + id.replace("e-datepicker-", "");
|
||||||
|
$(newTarget).val(unixTimestamp); // Update hidden UNIX field
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// If not using UNIX timestamp, update with raw value
|
||||||
|
var id = $this.attr("id");
|
||||||
|
var newTarget = "#" + id.replace("e-datepicker-", "");
|
||||||
|
$(newTarget).val(newValue); // Update hidden field with text input value
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
$(context).find('input.e-date').once('datetimepicker-init').each(function () {
|
$(context).find('input.e-date').once('datetimepicker-init').each(function () {
|
||||||
|
Reference in New Issue
Block a user