var now = new Date(),
start = new Date(now.getFullYear(), now.getMonth(), now.getDate(), 21),
end = new Date(now.getFullYear(), now.getMonth(), now.getDate(), 06);
if ( now >= start && now <= end ) {
if(localStorage.getItem("check") == null) showModal();
}
function showModal() {
localStorage.setItem("check", true);
alert("Привет, я модальное окно!");
}