//date picker

function setMinEndDate() {
    var startDate = document.getElementById('date_start').value;
    var endDateInput = document.getElementById('date_end');
    endDateInput.setAttribute('min', startDate);
    endDateInput.disabled = false;
}

function setMaxStartDate() {
    var endDate = document.getElementById('date_end').value;
    var startDateInput = document.getElementById('date_start');
    startDateInput.setAttribute('max', endDate);
}

//harga

document.getElementById('harga').addEventListener('input', function (e) {
    let value = e.target.value;
    value = value.replace(/[^,\d]/g, '').toString();
    let split = value.split(',');
    let sisa = split[0].length % 3;
    let rupiah = split[0].substr(0, sisa);
    let ribuan = split[0].substr(sisa).match(/\d{3}/gi);

    if (ribuan) {
        let separator = sisa ? '.' : '';
        rupiah += separator + ribuan.join('.');
    }

    rupiah = split[1] !== undefined ? rupiah + ',' + split[1] : rupiah;
    e.target.value = rupiah;
});

//selesai
