Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

시간 계산 오류 #441

Merged
merged 1 commit into from
Dec 13, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions Mogakco/Sources/Util/Extension/Int+Formatter.swift
Original file line number Diff line number Diff line change
Expand Up @@ -60,16 +60,16 @@ extension Int {
func toChatCompactDateString() -> String {
let number = self / 100
let time = number % 10000
let hour = Int(Double(time) / 100.0)
let hour = Double(time) / 100.0
let minutes = time % 100
var dateString = ""

if hour - 12 > 1 {
dateString = "오후 \(String(format: "%02d", hour - 12)):\(String(format: "%02d", minutes))"
} else if hour - 12 == 0 {
if hour - 12.0 > 1.0 {
dateString = "오후 \(String(format: "%02d", Int(hour - 12))):\(String(format: "%02d", minutes))"
} else if Int(hour) - 12 == 0 {
dateString = "오후 12:\(String(format: "%02d", minutes))"
} else {
dateString = "오전 \(String(format: "%02d", hour)):\(String(format: "%02d", minutes))"
dateString = "오전 \(String(format: "%02d", Int(hour))):\(String(format: "%02d", minutes))"
}
return dateString
}
Expand Down