Skip to content

Commit

Permalink
[Feat] #386 - 솝마디에 현재 날짜 표시 구현
Browse files Browse the repository at this point in the history
  • Loading branch information
dlwogus0128 committed Sep 23, 2024
1 parent 8e80b30 commit 1ce62c8
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public final class DailySoptuneResultVC: UIViewController, DailySoptuneResultVie

// 오늘의 솝마디 부분

private let dailySoptuneResultContentView = DailySoptuneResultContentView(name: "이재현", description: "단순하게 생각하면\n일이 술술 풀리겠솝!")
private lazy var dailySoptuneResultContentView = DailySoptuneResultContentView(name: "이재현", description: "단순하게 생각하면\n일이 술술 풀리겠솝!", date: viewModel.setCurrentDateString())

// 콕 찌르기 부분

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,4 +69,12 @@ extension DailySoptuneResultViewModel {
.subscribe(output.todaysFortuneCard)
.store(in: cancelBag)
}

func setCurrentDateString() -> String {
let dateFormatter = DateFormatter()
dateFormatter.dateFormat = "M월 d일 EEEE"
dateFormatter.locale = Locale(identifier: "ko_KR")
dateFormatter.timeZone = TimeZone(identifier: "Asia/Seoul")
return dateFormatter.string(from: Date())
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ public final class DailySoptuneResultContentView: UIView {
private let dateLabel = UILabel().then {
$0.font = UIFont.MDS.title5.font
$0.textColor = DSKitAsset.Colors.gray100.color
$0.text = "9월 18일 수요일"
}

private lazy var contentLabel = UILabel().then {
Expand All @@ -34,9 +33,10 @@ public final class DailySoptuneResultContentView: UIView {

// MARK: - initialization

init(name: String, description: String) {
init(name: String, description: String, date: String) {
super.init(frame: .zero)
self.contentLabel.text = "\(name)님,\n\(description)"
self.dateLabel.text = date
self.setUI()
self.setLayout()
}
Expand Down

0 comments on commit 1ce62c8

Please sign in to comment.