Skip to content

Commit

Permalink
[REFACTOR] #112 : Network 모듈 DateUtil 추가
Browse files Browse the repository at this point in the history
  • Loading branch information
tgyuuAn committed Jan 27, 2024
1 parent 233a628 commit 3ae3254
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 20 deletions.
3 changes: 2 additions & 1 deletion .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import com.wap.wapp.core.network.constant.EVENT_COLLECTION
import com.wap.wapp.core.network.model.attendancestatus.AttendanceStatusRequest
import com.wap.wapp.core.network.model.attendancestatus.AttendanceStatusResponse
import com.wap.wapp.core.network.utils.await
import java.time.LocalDateTime
import java.time.format.DateTimeFormatter
import com.wap.wapp.core.network.utils.generateNowDateTime
import com.wap.wapp.core.network.utils.toISOLocalDateTimeString
import javax.inject.Inject

class AttendanceStatusDataSourceImpl @Inject constructor(
Expand Down Expand Up @@ -42,7 +42,4 @@ class AttendanceStatusDataSourceImpl @Inject constructor(
.set(attendanceStatusRequest)
.await()
}

private fun LocalDateTime.toISOLocalDateTimeString(): String =
this.format(DateTimeFormatter.ISO_LOCAL_DATE_TIME)
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ import com.wap.wapp.core.network.constant.EVENT_COLLECTION
import com.wap.wapp.core.network.model.event.EventRequest
import com.wap.wapp.core.network.model.event.EventResponse
import com.wap.wapp.core.network.utils.await
import com.wap.wapp.core.network.utils.generateNowDateTime
import com.wap.wapp.core.network.utils.toISOLocalDateTimeString
import java.time.LocalDate
import java.time.LocalDateTime
import java.time.LocalTime
import java.time.format.DateTimeFormatter
import javax.inject.Inject

class EventDataSourceImpl @Inject constructor(
Expand Down Expand Up @@ -166,6 +166,3 @@ class EventDataSourceImpl @Inject constructor(
.await()
}
}

private fun LocalDateTime.toISOLocalDateTimeString(): String =
this.format(DateTimeFormatter.ISO_LOCAL_DATE_TIME)
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package com.wap.wapp.core.network.utils

import java.time.LocalDateTime
import java.time.ZoneId
import java.time.format.DateTimeFormatter

internal fun String.toISOLocalDateTime(): LocalDateTime = LocalDateTime.parse(
this,
DateTimeFormatter.ISO_LOCAL_DATE_TIME,
)

internal fun LocalDateTime.toISOLocalDateTimeString(): String =
this.format(DateTimeFormatter.ISO_LOCAL_DATE_TIME)

internal fun generateNowDateTime(zoneId: ZoneId = ZoneId.of("Asia/Seoul")): LocalDateTime =
LocalDateTime.now(zoneId)

This file was deleted.

0 comments on commit 3ae3254

Please sign in to comment.