Hi
I’m trying to factor out an Expression function that I use in multiple simulations for re-use. I having some trouble though. It’s probably due to my Scala being quite rusty.
The Expression function I have looks like this:
.exec { session => val fmt = ISODateTimeFormat.dateHourMinuteSecondMillis() session.setAll( "startDateTime" -> fmt.print(DateTime.now.withHourOfDay(0).withMinuteOfHour(0).withSecondOfMinute(0).withMillisOfSecond(0)), "endDateTime" -> fmt.print(DateTime.tomorrow.withHourOfDay(23).withMinuteOfHour(59).withSecondOfMinute(59).withMillisOfSecond(999)) ) }
Ideally I would like something like this:
def addDateTimesToSession(session: ???): ??? = {
val fmt = ISODateTimeFormat.dateHourMinuteSecondMillis()
session.setAll(
"startDateTime" -> fmt.print(DateTime.now.withHourOfDay(0).withMinuteOfHour(0).withSecondOfMinute(0).withMillisOfSecond(0)),
"endDateTime" -> fmt.print(DateTime.tomorrow.withHourOfDay(23).withMinuteOfHour(59).withSecondOfMinute(59).withMillisOfSecond(999))
)
}
Unfortunately I can’t quite get it to work.
Has anyone had more success with something like this?