diff --git a/Projects/App/Sources/Screens/Home/Views/MyWorkitHeaderView.swift b/Projects/App/Sources/Screens/Home/Views/MyWorkitHeaderView.swift index 4c2c2a7..337f168 100644 --- a/Projects/App/Sources/Screens/Home/Views/MyWorkitHeaderView.swift +++ b/Projects/App/Sources/Screens/Home/Views/MyWorkitHeaderView.swift @@ -68,7 +68,7 @@ final class MyWorkitHeaderView: UICollectionReusableView { public func setDate(startDate: Date, endDate: Date) { print(startDate, endDate) - dateButton.setDate(fromDate: startDate, toDate: endDate) + dateButton.setDate(fromDate: startDate, toDate: endDate, isHome: true) } private func setBackgroundColor() { diff --git a/Projects/DesignSystem/Sources/UIComponents/Buttons/WKDateButton.swift b/Projects/DesignSystem/Sources/UIComponents/Buttons/WKDateButton.swift index 5b8fcee..0492ead 100644 --- a/Projects/DesignSystem/Sources/UIComponents/Buttons/WKDateButton.swift +++ b/Projects/DesignSystem/Sources/UIComponents/Buttons/WKDateButton.swift @@ -118,7 +118,8 @@ public final class WKDateButton: UIView { /// - Parameters: /// - fromDate: 시작날짜 (날짜 선택 전일 경우 nil) /// - toDate: 끝나는 날짜 (단일 날짜의 경우 nil) - public func setDate(fromDate: Date?, toDate: Date?) { + /// - isHome: 홈인경우 오늘이면 "오늘"로 나와야 해서 true값으로 준다. (optional) + public func setDate(fromDate: Date?, toDate: Date?, isHome: Bool = false) { self.fromDate = fromDate self.toDate = toDate if fromDate == nil && toDate == nil { @@ -127,14 +128,21 @@ public final class WKDateButton: UIView { } else if toDate == nil, let fromDate = fromDate { /// 날짜 단일인 경우 self.dateLabel.text = "\(fromDate.toString(type: .dot))" + if isHome, fromDate == Date() { + self.dateLabel.text = "오늘" + } } else if let fromDate = fromDate?.toString(type: .dot), let toDate = toDate?.toString(type: .dot) { if fromDate == toDate { self.dateLabel.text = "\(fromDate)" + if isHome, fromDate == Date().toString(type: .dot) { + self.dateLabel.text = "오늘" + } } else { self.dateLabel.text = "\(fromDate) - \(toDate)" } } + dateLabel.sizeToFit() } }