knobs icon indicating copy to clipboard operation
knobs copied to clipboard

java.time.LocalDate support?

Open tobyweston opened this issue 9 years ago • 1 comments

We've done something like this to support decoding dates form our config files

implicit val configuredLocalDate: Configured[LocalDate] = new Configured[LocalDate] {
  def apply(a: CfgValue) = Some(LocalDate.parse(a.pretty.replace("\"", ""), ofPattern("dd MMM yyyy")))
}

Is that something that could/should go into the CfgValue trait? We'd do a pull request but aren't sure how you'd prefer it to slot in.

tobyweston avatar Sep 26 '16 13:09 tobyweston

My apologies. This escaped my notice until now.

I think the problem with making this an implicit instance is that there are so many date formats. Why that pattern instead of something from ISO 8601? If we can think of a good solution to that, I'm open to adding it. I suppose there could be an explicit instance that takes the pattern as an argument, from which an implicit could be created.

rossabaker avatar Dec 20 '17 15:12 rossabaker