Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Improved date parsing #122
Opening this up for comment @james and I did a bit of pairing on this.
Our user research and a look at analytics showed us that we weren't being as flexible with dates as our users expected, so we've written a test suite of all the dates we'd like to accept and have switched to using the Chronic date parsing gem and rewritten the date parser to accept the most commonly input dates.
Thoughts welcome, I'm interested on any feedback on the clarity of the code especially, as there is quite a lot of date fiddling going on to support a few additional formats for which chronic doesn't work.
Ideally after this is merged here I'd like to do the same thing for the code supporting gov.uk/publications as I think this is better than what's currently there.
My only thought on this is does this want to strip trailing whitespace on the entered data before you start running your regular expressions on this so it doesn't suffer from the same problem described in this blog post on the GDS data blog (this might already be happening elsewhere and I might just not know about it).