Condition to get current date is not working