moved code to addDate method