Skip to content

Commit ea6b841

Browse files
author
eshc123
committed
feat: Date Format 패턴 try catch 추가
1 parent e4cd959 commit ea6b841

File tree

1 file changed

+7
-3
lines changed
  • feature/history/src/main/java/com/goalpanzi/mission_mate/feature/history/model

1 file changed

+7
-3
lines changed

feature/history/src/main/java/com/goalpanzi/mission_mate/feature/history/model/History.kt

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,13 @@ data class History(
2828
}
2929

3030
private fun formatDate(date: String): String {
31-
val formatter = DateTimeFormatter.ofPattern(FORMATTER_PATTERN_ISO8601_SSSZ)
32-
val localDate = LocalDate.parse(date, formatter)
33-
return DateTimeFormatter.ofPattern(FORMATTER_PATTERN, Locale.getDefault()).format(localDate)
31+
return try {
32+
val formatter = DateTimeFormatter.ofPattern(FORMATTER_PATTERN_ISO8601_SSSZ)
33+
val localDate = LocalDate.parse(date, formatter)
34+
DateTimeFormatter.ofPattern(FORMATTER_PATTERN, Locale.getDefault()).format(localDate)
35+
}catch (e: Exception){
36+
date
37+
}
3438
}
3539

3640
companion object {

0 commit comments

Comments
 (0)