3 ms·
My thought here is that they're focusing on the wrong thing. Yes, we have repetitive date-checking logic, but we don't want lay a trap for the future. Not sur
by LorenPechtel 2y ago
My thought here is that they're focusing on the wrong thing.
Yes, we have repetitive date-checking logic, but we don't want lay a trap for the future. Not sure what language this is in so I'll use C#:
EnsureDateInFuture(DateTime Time)
{
if (Time <= DateTime.Now())
throw new Exception("Date must be in the future");
}
One check for the future, one copy of the error message, not locked in.