uk.co.unclealex.days.Time.scala Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of thank-you-for-the-days_2.13 Show documentation
Show all versions of thank-you-for-the-days_2.13 Show documentation
A useful DSL for testing with dates.
The newest version!
package uk.co.unclealex.days
import java.time.LocalTime
case class Time(hours: Int, minutes: Int) {
def am: Time = {
if (hours >= 12) {
copy(hours = hours - 12)
} else {
this
}
}
def pm: Time = {
if (hours < 12) {
copy(hours = hours + 12)
} else {
this
}
}
def toLocalTime: LocalTime = LocalTime.of(hours, minutes)
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy