Skip to content

Commit

Permalink
fix/#264 날짜 선택 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
youz2me committed Jul 19, 2024
1 parent 7825622 commit 9a8e3c2
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions KkuMulKum/Source/AddPromise/ViewModel/AddPromiseViewModel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,15 @@ extension AddPromiseViewModel: ViewModelType {

let adjustedDate = Observable.combineLatest(input.date, input.time)
.map { date, time -> Date in
let currentDate = Date()
if date < currentDate, time < currentDate {
let calendar = Calendar.current
var combinedComponents = DateComponents()

guard let tempDate = calendar.date(byAdding: .minute, value: -1, to: Date()) else {
return Date()
}

if calendar.component(.day, from: date) == calendar.component(.day, from: tempDate),
time < tempDate {
return Calendar.current.date(byAdding: .day, value: 1, to: date) ?? date
}
return date
Expand Down

0 comments on commit 9a8e3c2

Please sign in to comment.