fixed invalid date bug
Made a fix to boolean logic