validate datetime in javascript