} else if (max) { //if max was set
            if(max==0)
                max=new Date();
            else
                max= new Date(max);