dateToPeriod function

Convert dates to a relative period