refactor(history): unify calendar popover date mapping with startOfDay-as-key rule
기록 탭 달력 팝오버의 선택일 변환을 정오 경유(dayKey(for: 12:00))에서 "선택 달력일의 startOfDay를 키로 직접 사용"으로 통일 — 일기 내보내기 수정과 같은 규칙(CLAUDE.md §4.1). 현실적 설정(하루 시작이 자정~오전)에서는 동작이 완전히 동일하고, 하루 시작이 오후로 설정된 엣지에서만 전날로 밀리던 것이 고른 날짜 그대로로 바로잡힌다. 이로써 정오 매핑 패턴은 코드에서 사라짐. 검증: 하루 시작 00:00/06:00/18:00 수치 비교(앞 둘 동일, 18:00만 7/14→7/15로 교정), Debug·Store 빌드 성공, 기록 탭 렌더 확인. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013yKDMhuF39GVYy3FMcGHh7
This commit is contained in:
parent
28e649c2de
commit
b399ee02fe
@ -300,14 +300,15 @@ struct HistoryView: View {
|
||||
.tint(AppTheme.green)
|
||||
}
|
||||
|
||||
/// 달력 팝업 선택값 ↔ 논리적 하루 키 변환 (하루 시작 시간 설정과 무관하게 정오 기준으로 매핑)
|
||||
/// 달력 팝업 선택값 ↔ 논리적 하루 키 변환.
|
||||
/// 키(dayKey)는 "해당 달력일의 자정"이므로 고른 달력일의 startOfDay를 키로 직접 쓴다 —
|
||||
/// 하루 시작 시간이 몇 시든 고른 날짜가 그대로 표시·조회된다 (일기 내보내기와 같은 규칙, §4.1).
|
||||
/// 예전의 정오 경유(dayKey(for: 12:00))는 하루 시작이 오후면 전날로 밀리는 엣지가 있었다.
|
||||
private var calendarSelection: Binding<Date> {
|
||||
Binding {
|
||||
selectedDayKey
|
||||
} set: { picked in
|
||||
let cal = math.calendar
|
||||
let noon = cal.date(bySettingHour: 12, minute: 0, second: 0, of: picked) ?? picked
|
||||
selectedDayKey = math.dayKey(for: noon)
|
||||
selectedDayKey = math.calendar.startOfDay(for: picked)
|
||||
showingCalendar = false
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user