Skip to content
This repository has been archived by the owner on Mar 11, 2020. It is now read-only.

java.time.LocalDate support? #36

Open
tobyweston opened this issue Sep 26, 2016 · 1 comment
Open

java.time.LocalDate support? #36

tobyweston opened this issue Sep 26, 2016 · 1 comment

Comments

@tobyweston
Copy link

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.

@rossabaker
Copy link
Contributor

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.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants