Complicated date calculations

Consider it done.