-
Notifications
You must be signed in to change notification settings - Fork 119
Open
Labels
breaking changeThis could break existing codeThis could break existing code
Milestone
Description
There should be null
-returning variants for creating LocalDate(Time)
instances. It shouldn't be necessary to catch an exception. This is especially useful when creating instances from user input.
val date = runCatching { LocalDate(userInput.year, userInput.month, userInput.day) }.getOrNull()
Also:
Instant.parse(…)
TimeZone.of(…)
- etc.
Just like all similar stdlib functions have …OrNull
variants.
https://elizarov.medium.com/kotlin-and-exceptions-8062f589d07
bohsen, Saxintosh, Jolanrensen and hfhbd
Metadata
Metadata
Assignees
Labels
breaking changeThis could break existing codeThis could break existing code