Skip to content

Commit

Permalink
⚡️ :: 2자리수 일도 대응 가능하게 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
BJCHO0501 committed Nov 7, 2023
1 parent 980eaeb commit 18d3739
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ class MealDetailViewModel: ObservableObject {
private func calculateDateToShowData(allMenu: [MealMenuPerDayEntity]) -> Int {
let today = Calendar.current.startOfDay(for: Date())
return allMenu.firstIndex {
let day = $0.date.filter { Int(String($0)) != nil }.suffix(1)
let day = $0.date.split(separator: "")[1].filter { Int(String($0)) != nil }
print(day)
return Int(String(day)) ?? 0 >= Int(today.toString(format: "d")) ?? 0
} ?? 0
}
Expand Down

0 comments on commit 18d3739

Please sign in to comment.