Formats JavaScript dates to relative time strings.