Refactor daysUntil function