Run2 scala datetime handling
Robust temporal tokenization with Java 8 Time API and DateTimeFormatter.From its SKILL.md
npx -y skills add cxcscmu/SkillLearnBench --skill run2_scala-datetime-handlingAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
SKILL.md
1.0 KB, 197 tokens by cl100k_base, as published. Nobody here has run it
Temporal Tokenization in Scala
Use java.time for all date/time operations.
Robust Formatting
Handle LocalDateTime, LocalDate, ZonedDateTime, and Instant.
import java.time.{LocalDate, LocalDateTime, ZonedDateTime, Instant}
import java.time.format.DateTimeFormatter
def formatTemporal(value: Any, fmtStr: Option[String]): String = {
val isoFormat = DateTimeFormatter.ISO_LOCAL_DATE_TIME
val dateFormat = DateTimeFormatter.ISO_LOCAL_DATE
value match {
case dt: LocalDateTime =>
val fmt = fmtStr.map(DateTimeFormatter.ofPattern).getOrElse(isoFormat)
dt.format(fmt)
case d: LocalDate =>
val fmt = fmtStr.map(DateTimeFormatter.ofPattern).getOrElse(dateFormat)
d.format(fmt)
case other => other.toString
}
}
Pattern Matching on Any
Useful for implementing UniversalTokenizer's dispatch logic.
What ships with it
Read from the repository
Just SKILL.md. No reference files, no scripts.