All Downloads are FREE. Search and download functionalities are using the official Maven repository.

plotly.Joda.scala Maven / Gradle / Ivy

The newest version!
package plotly

import org.joda.time._
import plotly.Sequence.DateTimes

import scala.language.implicitConversions

object Joda {

  implicit def fromJodaLocalDates(seq: Seq[LocalDate]): Sequence =
    fromJodaLocalDateTimes {
      seq.map(_.toLocalDateTime(LocalTime.MIDNIGHT))
    }

  implicit def fromJodaDateTimes(seq: Seq[DateTime]): Sequence =
    fromJodaLocalDateTimes {
      seq.map(_.toLocalDateTime)
    }

  implicit def fromJodaLocalDateTimes(seq: Seq[LocalDateTime]): Sequence =
    DateTimes {
      seq.map { d =>
        plotly.element.LocalDateTime(
          d.getYear,
          d.getMonthOfYear,
          d.getDayOfMonth,
          d.getHourOfDay,
          d.getMinuteOfHour,
          d.getSecondOfMinute
        )
      }
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy