From ebd27d5714e20e6301a52989ae3c9e73f55ce29d Mon Sep 17 00:00:00 2001 From: Kelly Stannard Date: Wed, 2 Jan 2013 23:50:55 +0000 Subject: Better error message for String#to_date I did this because to_date gives a very unhelpful error message if you do not pass in a correct date. In the process I think this cleans up the code nicely and even better it tends to be slightly faster than the current implementation. Benchmark https://gist.github.com/4440875 --- activesupport/CHANGELOG.md | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'activesupport/CHANGELOG.md') diff --git a/activesupport/CHANGELOG.md b/activesupport/CHANGELOG.md index bee93ebfbc..0d2897d79d 100644 --- a/activesupport/CHANGELOG.md +++ b/activesupport/CHANGELOG.md @@ -1,5 +1,13 @@ ## Rails 4.0.0 (unreleased) ## +* Change String#to_date to use Date.parse. This gives more consistant error + messages and allows the use of partial dates. + + "gibberish".to_date => Argument Error: invalid date + "3rd Feb".to_date => Sun, 03 Feb 2013 + + *Kelly Stannard* + * It's now possible to compare Date, DateTime, Time and TimeWithZone with Infinity This allows to create date/time ranges with one infinite bound. Example: -- cgit v1.2.3