Fix date vs datetime calculations

The last commit broke some stuff in models.py, this fixes it. Makes the
code more readable, too.