JSFiddle - React, Tailwind, and code Playground

HTML

<script src="http://code.jquery.com/ui/1.10.0/jquery-ui.js"></script>
<p>Date: <input type="text" id="id_laufzeit_bis" /></p>

JavaScript

TIME_UNITS = {
    '1': 'days',
    '2': 'months',
    '3': 'years'
}

function get_date_from_string(strDate) {
    var dateParts = strDate.split('.');
    var date = new Date(dateParts[2], (dateParts[1] - 1), dateParts[0]);
    return date;
}

function recalculate_deadline() {
    var enddate = $('#id_laufzeit_bis').val();
    if (!enddate) {
        return;
    }
    enddate = moment(new get_date_from_string(enddate));
    // get cancelling period and unit
    var timeunit_cancelling = TIME_UNITS[$('#id_kuendigungsfrist_type').val()];
    var cancelling_deadline = $('#id_kuendigungsfrist').val();
    if (!cancelling_deadline) {
        return;
    }
    cancelling_deadline = parseInt(cancelling_deadline, 10);
    enddate.subtract(timeunit_cancelling, cancelling_deadline);

    // show date in input field
    var $cancel_until = $('#id_kuendigung_moeglichbis');
    $cancel_until.val(enddate.format('DD.MM.YYYY'));
    $cancel_until.change();
}

function check_reminder_date() {
    var $reminder_date = $('#id_erinnerung_am');
    var $cancel_until = $('#id_kuendigung_moeglichbis');
    reminder_date = $reminder_date.val();
    cancel_until = $cancel_until.val();
    if (!cancel_until) {
        return;
    }

    cancel_until = get_date_from_string(cancel_until);
    // If reminder_date is set, check that it is earlier than cancelling date
    if (reminder_date) {
        reminder_date = get_date_from_string(reminder_date);
        console.log(reminder_date);
        console.log(cancel_until);
        console.log(reminder_date <= cancel_until);
        console.log(reminder_date >= cancel_until);
        if (reminder_date <= cancel_until) {
            // everything is fine, just return
            console.log('ouch');
            return;
        }
    }

    // correct or set date for reminder
    reminder_date = moment(cancel_until);
    reminder_date.subtract('months', 1);
   ...