Extract date clamping into a method and document it