Skip to content

Commit

Permalink
Update DateOperations to use ISO8601 calendar (#47)
Browse files Browse the repository at this point in the history
  • Loading branch information
winsmith authored Jan 29, 2025
1 parent 757d10e commit b5da758
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 5 deletions.
6 changes: 3 additions & 3 deletions Package.resolved
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@
"package": "DateOperations",
"repositoryURL": "https://github.com/TelemetryDeck/SwiftDateOperations.git",
"state": {
"branch": null,
"revision": "9baf08c95057688deffe1f14dfcc871ba2ef38d2",
"version": "1.0.3"
"branch": "feature/iso8601calendar",
"revision": "c73376a265b5be180b81a445dba4d9167fc450a6",
"version": null
}
}
]
Expand Down
4 changes: 2 additions & 2 deletions Package.swift
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// swift-tools-version:5.3
// swift-tools-version:5.5
// The swift-tools-version declares the minimum version of Swift required to build this package.

import PackageDescription
Expand All @@ -19,7 +19,7 @@ let package = Package(
dependencies: [
// Dependencies declare other packages that this package depends on.
// .package(url: /* package url */, from: "1.0.0"),
.package(url: "https://github.com/TelemetryDeck/SwiftDateOperations.git", from: "1.0.3"),
.package(url: "https://github.com/TelemetryDeck/SwiftDateOperations.git", from: "1.0.4"),
.package(url: "https://github.com/apple/swift-crypto.git", "1.0.0" ..< "3.0.0"),
],
targets: [
Expand Down
11 changes: 11 additions & 0 deletions Tests/DataTransferObjectsTests/RelativeDateTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -156,4 +156,15 @@ final class RelativeDateTests: XCTestCase {

XCTAssertEqual(in30HoursAbsolute, Date.from(relativeDate: in30HoursRelative))
}

func testWeekBeginsOnMonday() throws {
let beginningOfNextWeekRelative = RelativeDate(.beginning, of: .week, adding: 1)
let beginningOfNextWeekAbsolute = Date.from(relativeDate: beginningOfNextWeekRelative)

let dateFormatter = DateFormatter()
dateFormatter.dateFormat = "EEEE"
let weekDay = dateFormatter.string(from: beginningOfNextWeekAbsolute)

XCTAssertEqual("Monday", weekDay)
}
}

0 comments on commit b5da758

Please sign in to comment.