Check date validity using JavaScript, fixes #12