knobs
knobs copied to clipboard
java.time.LocalDate support?
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.
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.