Fixing an issue with the date() method