mean_date and weighted_mean_date now in one function