Smart JS Date checking