Don't raise on out-of-range datetimes passed by a user

Backport https://github.com/rails/rails/pull/18157 to 4-2-stable.