Alain Debecker
Alain Debecker
> > `mean_dates(dates) = convert(Date, Day(round(mean(Dates.value.(dates)))))` > > ```julia > julia> convert(Date, Day(round(mean(Dates.value.([Date("2000-01-01"), Date("2004-01-01")]))))) > 2001-12-31 > ``` > > I'm certain someone would consider this a bug and expect...
> **Workaround:** `mean_dates(dates) = convert(Date, Day(round(mean(Dates.value.(dates)))))` Rounding is mandatory to avoid `ERROR: InexactError: Int64(whatever)` but the best strategy would be to return a `DateTime` and leave the question of rounding...
> I think it would be a very bad choice to make the mean of `Date` to round to a `Date` like is proposed. To me it feels pretty hacky...
> > a Date is a point in Time, and Time is continuous > > > a Date like 2024-05-25 means any point in time between 2024-05-25 midnight and 2024-05-26...
> I'd be ok with defining `mean` for `DateTime`. However, I'm not sure the default `convert(DateTime, ::Date)` should be automatically invoked to also define `mean` for `Date` then. Something like...
Thanks @adienes, exactly what was expected.