Skip to content

Commit 2abab56

Browse files
committed
[Develop] Question ISO8601DateFormat 로직 업데이트
1 parent 844c426 commit 2abab56

File tree

8 files changed

+22
-17
lines changed

8 files changed

+22
-17
lines changed

Qapple/Qapple/SourceCode/App/AppDelegate.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ extension AppDelegate {
2929
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey : Any]? = nil
3030
) -> Bool {
3131
#if DEBUG
32-
RepositoryService.shared.configureServer(to: .test)
32+
RepositoryService.shared.configureServer(to: .production)
3333
#else
3434
RepositoryService.shared.configureServer(to: .production)
3535
#endif

Qapple/Qapple/SourceCode/Data/Repository/AnswerRepository.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ extension AnswerRepository: DependencyKey {
4242
content: $0.content,
4343
authorNickname: $0.nickname,
4444
authorGeneration: $0.writerGeneration,
45-
publishedDate: $0.writeAt.ISO8601ToDate,
45+
publishedDate: $0.writeAt.ISO8601ToDate(.yearMonthDateTimeMilliseconds),
4646
isReported: false,
4747
isMine: true,
4848
isResignMember: false
@@ -71,7 +71,7 @@ extension AnswerRepository: DependencyKey {
7171
content: $0.content,
7272
authorNickname: $0.nickname,
7373
authorGeneration: $0.writerGeneration,
74-
publishedDate: $0.writeAt.ISO8601ToDate,
74+
publishedDate: $0.writeAt.ISO8601ToDate(.yearMonthDateTimeMilliseconds),
7575
isReported: $0.isReported,
7676
isMine: $0.isMine,
7777
isResignMember: $0.nickname == "알 수 없음"
@@ -95,7 +95,7 @@ extension AnswerRepository: DependencyKey {
9595
content: $0.content,
9696
authorNickname: $0.nickname,
9797
authorGeneration: $0.writerGeneration,
98-
publishedDate: $0.writeAt.ISO8601ToDate,
98+
publishedDate: $0.writeAt.ISO8601ToDate(.yearMonthDateTimeMilliseconds),
9999
isReported: $0.isReported,
100100
isMine: $0.isMine,
101101
isResignMember: $0.nickname == "알 수 없음"

Qapple/Qapple/SourceCode/Data/Repository/BulletinBoardRepository.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ extension BulletinBoardRepository: DependencyKey {
4141
content: $0.content,
4242
heartCount: $0.heartCount,
4343
commentCount: $0.commentCount,
44-
createAt: $0.createdAt.ISO8601ToDate,
44+
createAt: $0.createdAt.ISO8601ToDate(.yearMonthDateTimeMilliseconds),
4545
isMine: $0.isMine,
4646
isReported: $0.isReported,
4747
isLiked: $0.isLiked
@@ -79,7 +79,7 @@ extension BulletinBoardRepository: DependencyKey {
7979
content: response.content,
8080
heartCount: response.heartCount,
8181
commentCount: response.commentCount,
82-
createAt: response.createdAt.ISO8601ToDate,
82+
createAt: response.createdAt.ISO8601ToDate(.yearMonthDateTimeMilliseconds),
8383
isMine: response.isMine,
8484
isReported: response.isReported,
8585
isLiked: response.isLiked
@@ -122,7 +122,7 @@ extension BulletinBoardRepository: DependencyKey {
122122
content: $0.content,
123123
heartCount: $0.heartCount,
124124
commentCount: $0.commentCount,
125-
createAt: $0.createdAt.ISO8601ToDate,
125+
createAt: $0.createdAt.ISO8601ToDate(.yearMonthDateTimeMilliseconds),
126126
isMine: $0.isMine,
127127
isReported: $0.isReported,
128128
isLiked: $0.isLiked

Qapple/Qapple/SourceCode/Data/Repository/CommentRepository.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ extension CommentRepository: DependencyKey {
4545
isLiked: $0.isLiked,
4646
isMine: $0.isMine,
4747
isReport: $0.isReport,
48-
createdAt: $0.createdAt.ISO8601ToDate,
48+
createdAt: $0.createdAt.ISO8601ToDate(.yearMonthDateTimeMilliseconds),
4949
anonymityId: -2
5050
)
5151
}

Qapple/Qapple/SourceCode/Data/Repository/NotificationRepository.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ extension NotificationRepository: DependencyKey {
4343
title: $0.title,
4444
subtitle: $0.subtitle,
4545
content: $0.content ?? "",
46-
createAt: $0.createdAt.ISO8601ToDate,
46+
createAt: $0.createdAt.ISO8601ToDate(.yearMonthDateTimeMilliseconds),
4747
isReadStatus: false
4848
)
4949
}
@@ -71,7 +71,7 @@ extension NotificationRepository: DependencyKey {
7171
content: response.content,
7272
heartCount: response.heartCount,
7373
commentCount: response.commentCount,
74-
createAt: response.createdAt.ISO8601ToDate,
74+
createAt: response.createdAt.ISO8601ToDate(.yearMonthDateTimeMilliseconds),
7575
isMine: response.isMine,
7676
isReported: response.isReported,
7777
isLiked: response.isLiked

Qapple/Qapple/SourceCode/Data/Repository/QuestionRepository.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ extension QuestionRepository: DependencyKey {
3333
Question(
3434
id: $0.questionId,
3535
content: $0.content,
36-
publishedDate: $0.livedAt?.ISO8601ToDate ?? .now,
36+
publishedDate: $0.livedAt?.ISO8601ToDate(.yearMonthDateTime) ?? .now,
3737
isAnswered: $0.isAnswered,
3838
isLived: $0.questionStatus == ("LIVE")
3939
)

Qapple/Qapple/SourceCode/Feature/2.QuestionTab/2-3.QuestionList/QuestionListView.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ private struct QuestionCell: View {
125125

126126
/// 질문 기수
127127
private var questionGeneration: Int {
128-
let thirdEndDate = AcademyEventFor4th.prelude.period.0
128+
let thirdEndDate = AcademyEventFor4th.fourthStart.period.1
129129
return thirdEndDate > question.publishedDate ? 3 : 4
130130
}
131131
}

Qapple/Qapple/SourceCode/Utility/Formatter+.swift

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -75,22 +75,27 @@ extension Date {
7575

7676
extension String {
7777

78-
/// 서버에서 받은 태그(키워드)를 공백을 기준으로 분리해 컬렉션 타입으로 반환합니다.
79-
var splitTag: [String] {
80-
return self.split(separator: " ").map(String.init)
78+
enum ISO8601ToDateFormat: String {
79+
case yearMonthDateTime = "yyyy-MM-dd'T'HH:mm:ss"
80+
case yearMonthDateTimeMilliseconds = "yyyy-MM-dd'T'HH:mm:ss.SSSSSS"
8181
}
8282

8383
/// 서버에서 받은 시간(String)을 Date 타입으로 반환합니다.
84-
var ISO8601ToDate: Date {
84+
func ISO8601ToDate(_ format: ISO8601ToDateFormat) -> Date {
8585
let dateFormatter = DateFormatter()
86-
dateFormatter.dateFormat = "yyyy-MM-dd'T'HH:mm:ss.SSSSSS"
86+
dateFormatter.dateFormat = format.rawValue
8787

8888
if let date = dateFormatter.date(from: self) {
8989
return date
9090
}
9191

9292
return .now
9393
}
94+
95+
/// 서버에서 받은 태그(키워드)를 공백을 기준으로 분리해 컬렉션 타입으로 반환합니다.
96+
var splitTag: [String] {
97+
return self.split(separator: " ").map(String.init)
98+
}
9499
}
95100

96101
// MARK: - TimeInterval

0 commit comments

Comments
 (0)