fix(tapops): validasi input tahun dan tambah pagination dokumen #1

Merged
naufalzakyramadhan merged 6 commits from fix/tapops-year-validation-pagination into feat/tapops-group 2026-06-04 10:43:34 +00:00
Showing only changes of commit 5bb704ac88 - Show all commits
+12 -6
View File
@@ -586,13 +586,19 @@ class DocumentRepository {
if (!input) return;
input.setAttribute('max', '9999-12-31');
input.setAttribute('min', '1000-01-01');
// Clamp year on change as a fallback for browsers that don't enforce max.
input.addEventListener('change', () => {
// Clamp year on both input (fires while typing) and change (fires on blur).
const clampYear = () => {
if (!input.value) return;
const [yearStr, month, day] = input.value.split('-');
const year = parseInt(yearStr, 10);
if (year > 9999) input.value = `9999-${month}-${day}`;
});
const parts = input.value.split('-');
if (parts.length !== 3) return;
const year = parseInt(parts[0], 10);
if (!Number.isNaN(year) && year > 9999) {
parts[0] = '9999';
input.value = parts.join('-');
}
};
input.addEventListener('input', clampYear);
input.addEventListener('change', clampYear);
});
this.searchInput?.addEventListener('input', (e) => {