-
-
Save stephen-lazaro/f1218f04e51547f08a84b8168f884113 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// One way to parse a date: | |
val slashParser = DateTimeFormatter.ofPattern("yyyy/MM/dd") | |
// Another way to parse a date: | |
val dashParser = DateTimeFormatter.ofPattern("yyyy-MM-dd") | |
val withSlashes: RowDecoder[Date] = | |
RowDecoder.from(x => Either.catchNonFatal(slashParser.parse(x))) | |
val withDashes: RowDecoder[Date] = | |
RowDecoder.from(x => Either.catchNonFatal(dashParser.parse(x))) | |
// What do we do here ??? | |
val eitherWithSlashesOrDashes: RowDecoder[Date] = ??? |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment