Add a small check in the time parser to ignore malformed date.
This commit is contained in:
parent
6ef8684b59
commit
f4a381fb02
1 changed files with 7 additions and 1 deletions
|
|
@ -9,6 +9,12 @@ class TimeUpdateParser @Inject constructor() {
|
|||
private val formatter = SimpleDateFormat(BuildConfig.TIME_FORMAT, Locale.FRANCE)
|
||||
|
||||
fun parser(value: String?): Long? {
|
||||
return value?.let { formatter.parse(it) }?.time
|
||||
return value?.let {
|
||||
try {
|
||||
formatter.parse(it)
|
||||
} catch (_: Exception) {
|
||||
null
|
||||
}
|
||||
}?.time
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue