From 91648340484604f355895013d3f95f453e6aee83 Mon Sep 17 00:00:00 2001 From: Tony Li Date: Tue, 8 Nov 2022 13:01:45 +1300 Subject: [PATCH 1/3] Remove FormatterKit as a dependency --- WordPressShared.podspec | 1 - .../Core/Utility/NSDate+Helpers.swift | 26 +------------------ 2 files changed, 1 insertion(+), 26 deletions(-) diff --git a/WordPressShared.podspec b/WordPressShared.podspec index b71da9f..a586cad 100644 --- a/WordPressShared.podspec +++ b/WordPressShared.podspec @@ -28,5 +28,4 @@ Pod::Spec.new do |s| s.header_dir = 'WordPressShared' s.dependency 'CocoaLumberjack', '~> 3.4' - s.dependency 'FormatterKit/TimeIntervalFormatter', ' ~> 1.8' end diff --git a/WordPressShared/Core/Utility/NSDate+Helpers.swift b/WordPressShared/Core/Utility/NSDate+Helpers.swift index 85e1dd2..4f26d12 100644 --- a/WordPressShared/Core/Utility/NSDate+Helpers.swift +++ b/WordPressShared/Core/Utility/NSDate+Helpers.swift @@ -1,5 +1,4 @@ import Foundation -import FormatterKit extension Date { /// Private Date Formatters @@ -67,17 +66,6 @@ extension Date { formatter.timeStyle = .short return formatter }() - - @available(*, deprecated, message: "Not used as far as I can tell -@jkmassel Mar 2021") - static let pageSectionFormatter: TTTTimeIntervalFormatter = { - let formatter = TTTTimeIntervalFormatter() - - formatter.leastSignificantUnit = .day - formatter.usesIdiomaticDeicticExpressions = true - formatter.presentDeicticExpression = NSLocalizedString("today", comment: "Today") - - return formatter - }() } /// Returns a NSDate Instance, given it's ISO8601 String Representation @@ -120,19 +108,7 @@ extension Date { @available(*, deprecated, renamed: "toMediumString", message: "Removed to help drop the deprecated `FormatterKit` dependency – @jkmassel, Mar 2021") public func mediumString(timeZone: TimeZone? = nil) -> String { - let relativeFormatter = TTTTimeIntervalFormatter() - let absoluteFormatter = DateFormatters.mediumDate - - if let timeZone = timeZone { - absoluteFormatter.timeZone = timeZone - } - - let components = Calendar.current.dateComponents([.day], from: self, to: Date()) - if let days = components.day, abs(days) < 7 { - return relativeFormatter.string(forTimeInterval: timeIntervalSinceNow) - } else { - return absoluteFormatter.string(from: self) - } + toMediumString(inTimeZone: timeZone) } /// Formats the current date as relative date if it's within a week of From 0a8ab4252baac3e6729c7953a9b74b641a83a162 Mon Sep 17 00:00:00 2001 From: Tony Li Date: Tue, 8 Nov 2022 20:15:41 +1300 Subject: [PATCH 2/3] Add changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5470554..43466c7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -47,3 +47,4 @@ _None._ ### Internal Changes - Add this changelog entry about changelog itself [#317] +- Remove FormatterKit [#320] From 4a00d046f5746ccd7c67b1f3eb63efc5694043d0 Mon Sep 17 00:00:00 2001 From: Tony Li Date: Tue, 8 Nov 2022 21:28:18 +1300 Subject: [PATCH 3/3] Run pod install --- Podfile.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Podfile.lock b/Podfile.lock index f24ce0a..f532b48 100644 --- a/Podfile.lock +++ b/Podfile.lock @@ -52,4 +52,4 @@ SPEC CHECKSUMS: PODFILE CHECKSUM: ace859cfebf0a7a9ce551e216483b641cd360251 -COCOAPODS: 1.10.2 +COCOAPODS: 1.11.3