From c275ded443c31c62225e88e112ef6b13c0a9b8fb Mon Sep 17 00:00:00 2001 From: Paul Beckingham Date: Thu, 9 Jul 2009 21:58:19 -0400 Subject: [PATCH] Bug Fix - #195 - Fixed problem where the date 7/31/2009, when interpreted with rc.dateformat:m/d/y, is truncated to 7/31/20. --- src/Date.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/Date.cpp b/src/Date.cpp index 78ba34ff7..6ac654976 100644 --- a/src/Date.cpp +++ b/src/Date.cpp @@ -120,7 +120,7 @@ Date::Date (const std::string& mdy, const std::string& format /* = "m/d/Y" */) // Double digit. case 'y': - if (i + 1 >= mdy.length () || + if (i + 1 >= mdy.length () || ! ::isdigit (mdy[i + 0]) || ! ::isdigit (mdy[i + 1])) { @@ -181,6 +181,9 @@ Date::Date (const std::string& mdy, const std::string& format /* = "m/d/Y" */) } } + if (i < mdy.length ()) + throw std::string ("\"") + mdy + "\" is not a valid date in " + format + " format."; + if (!valid (month, day, year)) throw std::string ("\"") + mdy + "\" is not a valid date.";