import $ from "jquery";

export const changeDateAutosave = ()=>{
    const $timerDate = $('#develux-timer-date');
    $timerDate.on('change',function (){
        $timerDate.closest('form').submit();
    });
    const $timerStartDate = $('#develux-timer-start-date');
    $timerStartDate.on('change',function (){
        const startDate = new Date($timerStartDate.val());
        const endDate = new Date($timerDate.val());
        if( startDate >= endDate){
            $timerStartDate.val('');
        }else{
            $timerStartDate.closest('form').submit();
        }

    });
}
