function moveToOld(alltasks, moveId) {
        var now = new Date().getTime();
        if(alltasks.current.anyCurrent){
            
            if(alltasks.current.id == alltasks.lastTaskId && alltasks.oldTasks.findIndex(x => x.id === (moveId)) < 0)  {
                var moveToOld = {
                    id: alltasks.current.id,
                    name: alltasks.current.name,
                    date: alltasks.current.date,
                    totalSpended: now - alltasks.current.date,
                    removed: false
                }
                alltasks.oldTasks.push(moveToOld);
            }else  {
                var stime = now - alltasks.current.date;
                alltasks.oldTasks[moveId-1].totalSpended += stime;
            }  

            alltasks.current.anyCurrent = false;
            chrome.storage.local.set({ 'tasks': alltasks }, function(){
                listTasks();
            });
        }
    }
/**
     * move task to old task
     * @function moveToOld
     * @memberof popupjs
     */
move task to old task
@function moveToOld
@memberof popupjs
move task to old task @function moveToOld @memberof popupjs
function moveToOld(alltasks, moveId) {
        var now = new Date().getTime();
        if(alltasks.current.anyCurrent){
            if(alltasks.current.id == alltasks.lastTaskId && alltasks.oldTasks.findIndex(x => x.id === (moveId)) < 0)  {
                var moveToOld = {
                    id: alltasks.current.id,
                    name: alltasks.current.name,
                    date: alltasks.current.date,
                    totalSpended: now - alltasks.current.date,
                    removed: false
                }
                alltasks.oldTasks.push(moveToOld);
            }else  {
                var stime = now - alltasks.current.date;
                alltasks.oldTasks[moveId-1].totalSpended += stime;
            }  
            alltasks.current.anyCurrent = false;
            chrome.storage.local.set({ 'tasks': alltasks }, function(){
                listTasks();
            });
        }
    }
function moveToOld ( alltasks , moveId ) { var now = new Date ( ) . getTime ( ) ; if ( alltasks . current . anyCurrent ) { if ( alltasks . current . id == alltasks . lastTaskId && alltasks . oldTasks . findIndex ( x => x . id === ( moveId ) ) < 0 ) { var moveToOld = { id : alltasks . current . id , name : alltasks . current . name , date : alltasks . current . date , totalSpended : now - alltasks . current . date , removed : false } alltasks . oldTasks . push ( moveToOld ) ; } else { var stime = now - alltasks . current . date ; alltasks . oldTasks [ moveId - 1 ] . totalSpended += stime ; } alltasks . current . anyCurrent = false ; chrome . storage . local . set ( { 'tasks' : alltasks } , function ( ) { listTasks ( ) ; } ) ; } }
move task to old task
 @function moveToOld
 @memberof popupjs
move task to old task @function moveToOld @memberof popupjs