Skip to content

648 prod의 localdate 코드를 kst 타임존으로 변경#649

Merged
1210thatman merged 4 commits intodevelopfrom
648-prod의-localdate-코드를-kst-타임존으로-변경
Feb 11, 2026

Hidden character warning

The head ref may contain hidden characters: "648-prod\uc758-localdate-\ucf54\ub4dc\ub97c-kst-\ud0c0\uc784\uc874\uc73c\ub85c-\ubcc0\uacbd"
Merged

648 prod의 localdate 코드를 kst 타임존으로 변경#649
1210thatman merged 4 commits intodevelopfrom
648-prod의-localdate-코드를-kst-타임존으로-변경

Conversation

@1210thatman
Copy link
Contributor

@1210thatman 1210thatman commented Feb 10, 2026

localDate.now()를 KST로 변환하는 로직을 TImeUtils에 작성하여 localDate.now()를 사용하는 곳에 적용했습니다.

Summary by CodeRabbit

릴리스 노트

  • Refactor

    • 서울 시간대 기반 날짜/시간 처리를 중앙화된 유틸리티로 통합하여 코드 일관성을 개선했습니다.
  • Chores

    • 내부 시간 처리 로직을 최적화하고 변수명을 명확히 했습니다.

@1210thatman 1210thatman linked an issue Feb 10, 2026 that may be closed by this pull request
@coderabbitai
Copy link

coderabbitai bot commented Feb 10, 2026

Walkthrough

TimeUtils 유틸리티 클래스를 도입하여 애플리케이션 전반의 현재 날짜/시간 조회를 중앙화합니다. 14개 서비스 파일에서 LocalDate.now() 및 LocalDateTime.now()의 직접 사용을 TimeUtils.nowLocalDate() 및 TimeUtils.nowLocalDateTime()으로 대체합니다.

Changes

Cohort / File(s) Summary
TimeUtils 유틸리티 생성
src/main/kotlin/dsm/pick2024/global/common/TimeUtils.kt
서울 시간대(Asia/Seoul) 기반 현재 날짜/시간을 반환하는 KST\_ZONE\_ID, nowLocalDate(), nowLocalDateTime() 유틸리티 함수 추가
관리자 도메인 마이그레이션
src/main/kotlin/dsm/pick2024/domain/admin/service/QueryMainInfoService.kt
LocalDate.now() → TimeUtils.nowLocalDate() 호출로 변경
교실 도메인 마이그레이션
src/main/kotlin/dsm/pick2024/domain/classroom/service/QueryFloorClassroomService.kt, QueryGradeClassroomService.kt
LocalDate 기반 요일 조회를 TimeUtils.nowLocalDate()로 변경하고, 정수 리터럴(2, 5)을 DayOfWeek 열거형(TUESDAY, FRIDAY)으로 교체
공지사항 및 일정 도메인 마이그레이션
src/main/kotlin/dsm/pick2024/domain/notice/service/CreateNoticeService.kt, domain/schedule/service/SaveScheduleService.kt
LocalDateTime/LocalDate 직접 호출을 TimeUtils 함수로 변경
자습 도메인 마이그레이션
src/main/kotlin/dsm/pick2024/domain/selfstudy/persistence/SelfStudyPersistenceAdapterPort.kt, domain/selfstudy/service/SendNotificationSelfStudyTeacher.kt
LocalDate.now() → TimeUtils.nowLocalDate()로 변경하고, 변수 명명 및 반복 스타일 조정
시간표 및 주말급식 도메인 마이그레이션
src/main/kotlin/dsm/pick2024/domain/timetable/service/QueryTeacherTimetableService.kt, domain/weekendmeal/service/NotificationWeekendMealService.kt, PrintAllExcelWeekendMealService.kt, PrintClassExcelWeekendMealService.kt
LocalDate.now() 및 월 계산 로직을 TimeUtils.nowLocalDate() 기반으로 변경
Feign 클라이언트 서비스 마이그레이션
src/main/kotlin/dsm/pick2024/infrastructure/feign/neis/NeisMealFeignClientService.kt, NeisTimetableFeignClientService.kt
LocalDate.now()를 TimeUtils.nowLocalDate()로 대체하여 외부 API 호출 시 시간 소스 중앙화

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Poem

🐰 시간을 모아 TimeUtils에,
서울의 시간이 한곳에 모여,
열네 개 서비스가 손을 잡고,
중앙화된 시간으로 춤을 추네! ✨
일관된 시간, 일관된 마음! 🕐

🚥 Pre-merge checks | ✅ 2 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed Pull request 제목이 변경사항의 주요 내용을 명확하게 요약하고 있습니다. TimeUtils를 통해 LocalDate 코드를 KST 타임존으로 변경하는 것이 정확히 반영되어 있습니다.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch 648-prod의-localdate-코드를-kst-타임존으로-변경

No actionable comments were generated in the recent review. 🎉

🧹 Recent nitpick comments
src/main/kotlin/dsm/pick2024/global/common/TimeUtils.kt (1)

7-16: 테스트 용이성을 위해 Clock 주입을 고려해 보세요.

현재 TimeUtilsLocalDate.now(KST_ZONE_ID)를 직접 호출하므로, 이 유틸리티를 사용하는 서비스의 단위 테스트에서 현재 시간을 제어하기 어렵습니다. java.time.Clock을 주입 가능하게 하면 테스트에서 고정된 시간을 사용할 수 있습니다.

♻️ Clock 주입 방식 제안
-object TimeUtils {
-    val KST_ZONE_ID: ZoneId = ZoneId.of("Asia/Seoul")
+object TimeUtils {
+    private val KST_ZONE_ID: ZoneId = ZoneId.of("Asia/Seoul")
+    var clock: Clock = Clock.system(KST_ZONE_ID)
 
     fun nowLocalDate(): LocalDate {
-        return LocalDate.now(KST_ZONE_ID)
+        return LocalDate.now(clock)
     }
     fun nowLocalDateTime(): LocalDateTime {
-        return LocalDateTime.now(KST_ZONE_ID)
+        return LocalDateTime.now(clock)
     }
 }
src/main/kotlin/dsm/pick2024/domain/selfstudy/persistence/SelfStudyPersistenceAdapterPort.kt (1)

43-55: Persistence 레이어에서 현재 시간을 직접 조회하는 것은 테스트 용이성을 저해합니다.

findByTodayTeacher에서 TimeUtils.nowLocalDate()를 직접 호출하면, 특정 날짜에 대한 단위 테스트가 어려워집니다. 날짜를 파라미터로 받고 호출부에서 TimeUtils.nowLocalDate()를 전달하는 방식이 더 유연합니다.

기존 코드도 LocalDate.now()를 직접 사용하고 있었으므로 이 PR 범위를 넘는 개선 사항입니다.

src/main/kotlin/dsm/pick2024/domain/classroom/service/QueryFloorClassroomService.kt (1)

23-23: 화요일/금요일 조건이 같은 메서드 내에서 두 번 반복됩니다.

Line 27과 Line 41에서 동일한 today == DayOfWeek.TUESDAY || today == DayOfWeek.FRIDAY 조건을 사용합니다. 가독성을 위해 로컬 변수로 추출하는 것을 고려해 보세요.

♻️ 제안된 리팩터링
         val today = TimeUtils.nowLocalDate().dayOfWeek
+        val isClubDay = today == DayOfWeek.TUESDAY || today == DayOfWeek.FRIDAY

         val classrooms = when (floor) {
             2, 3, 4 -> {
-                val filteredClassrooms = if (today == DayOfWeek.TUESDAY || today == DayOfWeek.FRIDAY) {
+                val filteredClassrooms = if (isClubDay) {
-            val move = if (today == DayOfWeek.TUESDAY || today == DayOfWeek.FRIDAY) {
+            val move = if (isClubDay) {

Also applies to: 27-27, 41-41


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@1210thatman 1210thatman merged commit 91e6a53 into develop Feb 11, 2026
2 checks passed
@ByunDohwi ByunDohwi deleted the 648-prod의-localdate-코드를-kst-타임존으로-변경 branch February 11, 2026 03:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

prod의 localDate 코드를 KST 타임존으로 변경

2 participants