mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-24 07:05:35 +00:00
Business fixes
This commit is contained in:
@@ -2,7 +2,7 @@ import Foundation
|
||||
import TelegramPresentationData
|
||||
import TelegramUIPreferences
|
||||
|
||||
public func stringForShortTimestamp(hours: Int32, minutes: Int32, dateTimeFormat: PresentationDateTimeFormat) -> String {
|
||||
public func stringForShortTimestamp(hours: Int32, minutes: Int32, dateTimeFormat: PresentationDateTimeFormat, formatAsPlainText: Bool = false) -> String {
|
||||
switch dateTimeFormat.timeFormat {
|
||||
case .regular:
|
||||
let hourString: String
|
||||
@@ -20,10 +20,18 @@ public func stringForShortTimestamp(hours: Int32, minutes: Int32, dateTimeFormat
|
||||
} else {
|
||||
periodString = "AM"
|
||||
}
|
||||
if minutes >= 10 {
|
||||
return "\(hourString):\(minutes)\u{00a0}\(periodString)"
|
||||
|
||||
let spaceCharacter: String
|
||||
if formatAsPlainText {
|
||||
spaceCharacter = " "
|
||||
} else {
|
||||
return "\(hourString):0\(minutes)\u{00a0}\(periodString)"
|
||||
spaceCharacter = "\u{00a0}"
|
||||
}
|
||||
|
||||
if minutes >= 10 {
|
||||
return "\(hourString):\(minutes)\(spaceCharacter)\(periodString)"
|
||||
} else {
|
||||
return "\(hourString):0\(minutes)\(spaceCharacter)\(periodString)"
|
||||
}
|
||||
case .military:
|
||||
return String(format: "%02d:%02d", arguments: [Int(hours), Int(minutes)])
|
||||
|
||||
Reference in New Issue
Block a user