title: How make implicit Ordered on java.time.LocalDate
body: <p>I want to use <code>java.time.LocalDate</code> and <code>java.time.LocalDateTime</code> with an implicit <code>Ordered</code> like:</p>
  
  <pre><code>val date1 = java.time.LocalDate.of(2000, 1, 1)
  val date2 = java.time.LocalDate.of(2010, 10, 10)
  if (date1 &lt; date2) ...
  </code></pre>
  
  <p><code>import scala.math.Ordering.Implicits._</code> doesn't work, because <code>LocalDate</code> inherits from <code>Comparable&lt;ChronoLocalDate&gt;</code> instead of <code>Comparable&lt;LocalDate&gt;</code>.
  How can I write my own imlicit Orderd to use &lt;, &lt;=, &gt;, &gt;= operators/methods to compare <code>LocalDate</code>'s?</p>
  
  <p>Edit:</p>
  
  <p>I found a way with use of an implicit class:</p>
  
  <pre><code>import java.time.{LocalDate}
  
  object MyDateTimeUtils {
    implicit class MyLocalDateImprovements(val ld: LocalDate)
             extends Ordered[LocalDate] {
      def compare(that: LocalDate): Int = ld.compareTo(that)
    }
  }
  
  // Test
  
  import MyDateTimeUtils._
  
  val d1 = LocalDate.of(2016, 1, 1)
  val d2 = LocalDate.of(2017, 2, 3)
  
  if (d1 &lt; d2) println("d1 is less than d2")
  </code></pre>
  
  <p>But I would prefer a way like Scala is doing for all Java classes which implements <code>Comparable&lt;T&gt;</code>. You just have to
  <code>import scala.math.Ordering.Implicits._</code> in your code. Scala implements it like:</p>
  
  <pre><code>implicit def ordered[A &lt;% Comparable[A]]: Ordering[A] = new Ordering[A] {
    def compare(x: A, y: A): Int = x compareTo y
  }
  </code></pre>
  
  <p>But unfortunately <code>LocalDate</code> implements <code>Comparable&lt;ChronoLocalDate&gt;</code> instead of <code>Comparable&lt;LocalDate&gt;</code>. I couldn't find a way to modify the above implicit ordered method to fit with <code>LocalDate</code>/<code>Comparable&lt;ChronoLocalDate&gt;</code>. Any idea?</p>