Skip to content

Commit

Permalink
[FEATURE]#75 : LocalDateTime APi 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
jeongjaino committed Aug 4, 2024
1 parent 51eab18 commit 54d1fc0
Showing 1 changed file with 6 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.bff.wespot.data.remote.extensions

import java.time.LocalDate
import java.time.LocalDateTime
import java.time.format.DateTimeFormatter

Expand All @@ -10,3 +11,8 @@ fun String.toISOLocalDateTime(): LocalDateTime? =
val correctedString = this.replace(" ", "T")
LocalDateTime.parse(correctedString, DateTimeFormatter.ISO_DATE_TIME)
}.getOrNull()

fun String.toLocalDateFromDashPattern(): LocalDate {
val formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd")
return LocalDate.parse(this, formatter)
}

0 comments on commit 54d1fc0

Please sign in to comment.