Skip to content

Cherry pick: Make Date, DateComponents and DateInterval Sendable #4833

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 2, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Sources/Foundation/Date.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

A `Date` is independent of a particular calendar or time zone. To represent a `Date` to a user, you must interpret it in the context of a `Calendar`.
*/
public struct Date : ReferenceConvertible, Comparable, Equatable {
public struct Date : ReferenceConvertible, Comparable, Equatable, Sendable {
public typealias ReferenceType = NSDate

fileprivate var _time: TimeInterval
Expand Down
2 changes: 1 addition & 1 deletion Sources/Foundation/DateComponents.swift
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

When a new instance of `DateComponents` is created, the date components are set to `nil`.
*/
public struct DateComponents : ReferenceConvertible, Hashable, Equatable, _MutableBoxing {
public struct DateComponents : ReferenceConvertible, Hashable, Equatable, Sendable, _MutableBoxing {
public typealias ReferenceType = NSDateComponents

internal var _handle: _MutableHandle<NSDateComponents>
Expand Down
2 changes: 1 addition & 1 deletion Sources/Foundation/DateInterval.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
@_implementationOnly import CoreFoundation

/// DateInterval represents a closed date interval in the form of [startDate, endDate]. It is possible for the start and end dates to be the same with a duration of 0. DateInterval does not support reverse intervals i.e. intervals where the duration is less than 0 and the end date occurs earlier in time than the start date.
public struct DateInterval : ReferenceConvertible, Comparable, Hashable {
public struct DateInterval : ReferenceConvertible, Comparable, Sendable, Hashable {
public typealias ReferenceType = NSDateInterval

/// The start date.
Expand Down