# \`max\` and \`min\` of single dates

**URL:** <https://discourse.julialang.org/t/max-and-min-of-single-dates/26074>\
**Category:** General Usage\
**Tags:** question, dates\
**Created:** [July 6, 2019, 4:43pm UTC](https://discourse.julialang.org/t/max-and-min-of-single-dates/26074 "2019-07-06T16:43:36Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![pfarndt](https://avatars.discourse-cdn.com/v4/letter/p/8dc957/32.png) [@pfarndt](https://discourse.julialang.org/u/pfarndt)\
**Post date:** [July 6, 2019, 4:43pm UTC](https://discourse.julialang.org/t/max-and-min-of-single-dates/26074/1 "2019-07-06T16:43:36Z")

</div>

I want aggregate dates and find the most recent date in a bunch of dates. For example I want to know the age of the youngest kid in a family. To do this I have to find the `max` of several dates. If there are a least two kids everything is fine:

```julia
julia> max(Date("2013-07-31"), Date("2017-07-20"))
2017-07-20

```

However, some families have just one kid:

```julia
julia> max(Date("2013-07-31"))
ERROR: MethodError: no method matching max(::Date)
Closest candidates are:
  max(::Any, ::Missing) at missing.jl:104
  max(::Any, ::Any) at operators.jl:408
  max(::Any, ::Any, ::Any, ::Any...) at operators.jl:529
  ...
Stacktrace:
 [1] top-level scope at REPL[3]:1

```

For `Real` something like this works fine:

```julia
julia> max(1.3)
1.3

```

I would like to see this behavior also for dates and times.

---

<div class="post-metadata">

**Author:** ![StefanKarpinski](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/stefankarpinski/32/24_2.png) [@StefanKarpinski](https://discourse.julialang.org/u/StefanKarpinski)\
**Post date:** [July 6, 2019, 5:57pm UTC](https://discourse.julialang.org/t/max-and-min-of-single-dates/26074/2 "2019-07-06T17:57:54Z")

</div>

Seems like an oversight. Would you mind opening an issue (or even marking a PR!)?

---

<div class="post-metadata">

**Author:** ![pfarndt](https://avatars.discourse-cdn.com/v4/letter/p/8dc957/32.png) [@pfarndt](https://discourse.julialang.org/u/pfarndt)\
**Post date:** [July 6, 2019, 7:07pm UTC](https://discourse.julialang.org/t/max-and-min-of-single-dates/26074/3 "2019-07-06T19:07:55Z")

</div>

Will do -

---

<div class="post-metadata">

**Author:** ![pfarndt](https://avatars.discourse-cdn.com/v4/letter/p/8dc957/32.png) [@pfarndt](https://discourse.julialang.org/u/pfarndt)\
**Post date:** [July 8, 2019, 1:18pm UTC](https://discourse.julialang.org/t/max-and-min-of-single-dates/26074/4 "2019-07-08T13:18:18Z")

</div>

Done: [Add methods min, max, minmax taking only single Dates.AbstractTime by pfarndt · Pull Request #32525 · JuliaLang/julia · GitHub](https://github.com/JuliaLang/julia/pull/32525)
