Skip to content
This repository was archived by the owner on Jun 4, 2025. It is now read-only.

Commit 8969098

Browse files
committed
Use Swift 5.10 toolchain
1 parent e61824c commit 8969098

File tree

4 files changed

+13
-14
lines changed

4 files changed

+13
-14
lines changed

.buildkite/pipeline.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ common_params:
33
plugins: &common_plugins
44
- automattic/a8c-ci-toolkit#3.1.0
55
env: &common_env
6-
IMAGE_ID: xcode-15.0.1
6+
IMAGE_ID: xcode-15.3-v3
77

88
# This is the default pipeline – it will build and test the pod
99
steps:

Package.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// swift-tools-version:5.5
1+
// swift-tools-version:5.10
22

33
import Foundation
44
import PackageDescription
@@ -15,7 +15,7 @@ let package = Package(
1515
// See https://github.com/erikdoe/ocmock/issues/500#issuecomment-1002700625
1616
.package(url: "https://github.com/erikdoe/ocmock", revision: "afd2c6924e8a36cb872bc475248b978f743c6050"),
1717
.package(url: "https://github.com/Quick/Quick", from: "6.0.0"),
18-
.package(url: "https://github.com/realm/SwiftLint", .exactItem(loadSwiftLintVersion()))
18+
.package(url: "https://github.com/realm/SwiftLint", exact: loadSwiftLintVersion())
1919
],
2020
targets: [
2121
.target(

Sources/WordPressShared/Utility/NSDate+Helpers.swift

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -140,14 +140,9 @@ extension Date {
140140
}
141141

142142
/// Formats the current date as a medium relative date/time.
143-
/// - Parameter timeZone: An optional time zone used to adjust the date formatters.
144-
///
145-
/// - Example: Tomorrow, 6:45 AM
146-
/// - Example: Today, 8:09 AM
147-
/// - Example: Yesterday, 11:36 PM
148-
/// - Example: Jan 28, 2017, 1:51 PM
149-
/// - Example: Jan 22, 2017, 2:18 AM
143+
/// That is, it uses the `DateFormatter` `dateStyle` `.medium` and `timeStyle` `.short`.
150144
///
145+
/// - Parameter timeZone: An optional time zone used to adjust the date formatters.
151146
public func mediumStringWithTime(timeZone: TimeZone? = nil) -> String {
152147
let formatter = DateFormatters.mediumDateTime
153148
if let timeZone = timeZone {

Tests/WordPressSharedTests/NSDateHelperTest.swift

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -56,22 +56,26 @@ class NSDateHelperTest: XCTestCase {
5656
}
5757

5858
/// Verifies that `mediumStringWithTime` takes into account the time zone adjustment
59-
/// If this test is failing, check that the Test Plan is still using en-US as its language
59+
///
60+
/// This legacy test is a bit silly because it is simply testing that the code calls `DateFormatter` with the expected configuration.
61+
/// This was done to make the test robust against underlying changes in `DateFormatter`'s behavior.
62+
/// Example failure this avoids: https://buildkite.com/automattic/wordpress-shared-ios/builds/235#018ed45e-c2be-40e5-9759-6bd7c0735ce9/6-2623
6063
func testMediumStringTimeZoneAdjust() {
6164
let date = Date()
6265
let timeZone = TimeZone(secondsFromGMT: Calendar.current.timeZone.secondsFromGMT() - (60 * 60))
6366
XCTAssertEqual(date.toMediumString(inTimeZone: timeZone), "now")
6467

6568
let timeFormatter = DateFormatter()
66-
timeFormatter.dateStyle = .none
69+
timeFormatter.doesRelativeDateFormatting = true
70+
timeFormatter.dateStyle = .medium
6771
timeFormatter.timeStyle = .short
6872
let withoutTimeZoneAdjust = timeFormatter.string(from: date)
6973

70-
XCTAssertEqual(date.mediumStringWithTime(), "Today, \(withoutTimeZoneAdjust)")
74+
XCTAssertEqual(date.mediumStringWithTime(), withoutTimeZoneAdjust)
7175

7276
timeFormatter.timeZone = timeZone
7377
let withTimeZoneAdjust = timeFormatter.string(from: date)
7478

75-
XCTAssertEqual(date.mediumStringWithTime(timeZone: timeZone), "Today, \(withTimeZoneAdjust)")
79+
XCTAssertEqual(date.mediumStringWithTime(timeZone: timeZone), withTimeZoneAdjust)
7680
}
7781
}

0 commit comments

Comments
 (0)