removed irrelevant check for str.length; added braces; less overhead on determining date