uk.co.unclealex.days.Month.scala Maven / Gradle / Ivy
The newest version!
package uk.co.unclealex.days
import enumeratum._
import scala.collection.immutable
/**
* Helper classes used to make dates and times more readable in tests.
*
* @author alex
*
*/
sealed abstract class Month(val name: String, val month: Int) extends EnumEntry {
override def toString: String = name
def apply(day: Int): MonthAndDay = MonthAndDay(day, this)
def apply(day: Int, year: Int): Date = Date(apply(day), year)
}
object Month extends Enum[Month] {
object January extends Month("January", 1)
object February extends Month("February", 2)
object March extends Month("March", 3)
object April extends Month("April", 4)
object May extends Month("May", 5)
object June extends Month("June", 6)
object July extends Month("July", 7)
object August extends Month("August", 8)
object September extends Month("September", 9)
object October extends Month("October", 10)
object November extends Month("November", 11)
object December extends Month("December", 12)
override def values: immutable.IndexedSeq[Month] = findValues
}