|
8 | 8 |
|
9 | 9 | import Foundation |
10 | 10 |
|
11 | | -extension Date { |
| 11 | +public extension Date { |
12 | 12 |
|
13 | 13 |
|
14 | 14 | //MARK: - Time Ago |
@@ -56,16 +56,8 @@ extension Date { |
56 | 56 | var shortTimeAgoSinceNow: String { |
57 | 57 | return self.shortTimeAgo(since:Date()) |
58 | 58 | } |
59 | | - |
60 | | - func timeAgo(since date: Date) -> String { |
61 | | - return self.timeAgo(since: date, numericDates:false) |
62 | | - } |
63 | | - |
64 | | - func timeAgo(since date: Date, numericDates: Bool) -> String { |
65 | | - return self.timeAgo(since: date, numericDates: numericDates, numericTimes:false) |
66 | | - } |
67 | 59 |
|
68 | | - func timeAgo(since date: Date, numericDates: Bool, numericTimes: Bool) -> String { |
| 60 | + func timeAgo(since date:Date, numericDates: Bool = false, numericTimes: Bool = false) -> String { |
69 | 61 | let calendar = NSCalendar.current |
70 | 62 | let unitFlags = Set<Calendar.Component>([.second,.minute,.hour,.day,.weekOfYear,.month,.year]) |
71 | 63 | let earliest = self.earlierDate(date) |
@@ -202,12 +194,14 @@ extension Date { |
202 | 194 | } |
203 | 195 | } |
204 | 196 |
|
205 | | - internal func logicalLocalizedStringFromFormat(format: String, value: Int) -> String{ |
| 197 | + |
| 198 | + private func logicalLocalizedStringFromFormat(format: String, value: Int) -> String{ |
206 | 199 | let localeFormat = String.init(format: format, getLocaleFormatUnderscoresWithValue(Double(value))) |
207 | 200 | return String.init(format: DateToolsLocalizedStrings(localeFormat), value) |
208 | 201 | } |
209 | 202 |
|
210 | | - internal func getLocaleFormatUnderscoresWithValue(_ value: Double) -> String{ |
| 203 | + |
| 204 | + private func getLocaleFormatUnderscoresWithValue(_ value: Double) -> String{ |
211 | 205 | let localCode = Bundle.main.preferredLocalizations[0] |
212 | 206 | if (localCode == "ru" || localCode == "uk") { |
213 | 207 | let XY = Int(floor(value).truncatingRemainder(dividingBy: 100)) |
|
0 commit comments