Skip to content

Latest commit

 

History

History

refuel-util

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 

refuel-util

libraryDependencies += "com.phylage" %% "refuel-util" % "1.5.2"

Usage

import refuel.lang.ScalaTime._

Supports conversion between various classes and date classes.

"2019-01-01 11:22:33".datetime
  
> res0: java.time.ZonedDateTime = 2019-01-01T11:22:33.000+09:00[Asia/Tokyo]
"2019-01-01 11:22:33".datetime.maxToday
  
> res0: java.time.ZonedDateTime = 2019-01-01T23:59:59.9999999+09:00[Asia/Tokyo]

Configurations such as timezone can be overwritten by creating a class that inherits RuntimeTZ.

object MyTZ extends AsiaTokyoTZ with AutoInject[RuntimeTZ]


FromTo is interface that represents a period. Classes that inherit this can use certain features.

case class RequestPeriod(from: EpochDateTime, to: EpochDateTime) extends FromTo

RequestPeriod("2019-08-01 00:00:00".datetime.epoch, "2019-08-31 23:59:59".datetime.epoch)
  .overlap(RequestPeriod("2019-07-25 00:00:00".datetime.epoch, "2019-07-31 23:59:59".datetime.epoch)


Collection extension functions.