Skip to content

Commit

Permalink
[MERGE] #94 : build 오류, network Util에 현재 시각 유틸 추가
Browse files Browse the repository at this point in the history
  • Loading branch information
jeongjaino committed Jan 22, 2024
1 parent a0bdbce commit 36123f2
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ 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 com.wap.wapp.core.network.utils.getSeoulDateTimeNow
import java.time.LocalDateTime
import java.time.format.DateTimeFormatter
import javax.inject.Inject
Expand All @@ -33,7 +34,7 @@ class AttendanceStatusDataSourceImpl @Inject constructor(
override suspend fun postAttendanceStatus(eventId: String, userId: String): Result<Unit> =
runCatching {
val attendanceStatusRequest =
AttendanceStatusRequest(generateNowDateTime().toISOLocalDateTimeString())
AttendanceStatusRequest(getSeoulDateTimeNow().toISOLocalDateTimeString())

firebaseFirestore.collection(ATTENDANCE_STATUS_COLLECTION)
.document(userId)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ 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.getSeoulDateTimeNow
import java.time.LocalDate
import java.time.LocalDateTime
import java.time.LocalTime
Expand Down Expand Up @@ -37,7 +38,7 @@ class EventDataSourceImpl @Inject constructor(

// 선택된 날짜 1일 00시 00분 00초
val startDateTime = date.atStartOfDay().toISOLocalDateTimeString()
val currentDateTime = generateNowDateTime().toISOLocalDateTimeString()
val currentDateTime = getSeoulDateTimeNow().toISOLocalDateTimeString()
val task = firebaseFirestore.collection(EVENT_COLLECTION)
.whereGreaterThanOrEqualTo("startDateTime", startDateTime)
.whereLessThanOrEqualTo("startDateTime", currentDateTime)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
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 getSeoulDateTimeNow() = LocalDateTime.now(ZoneId.of("Asia/Seoul"))

0 comments on commit 36123f2

Please sign in to comment.