Improve date difference calculation