<!--
{
  "availability" : [
    "iOS: 18.0.0 -",
    "iPadOS: 18.0.0 -",
    "macCatalyst: 18.0.0 -",
    "macOS: 15.0.0 -",
    "tvOS: 18.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 11.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Foundation",
  "identifier" : "/documentation/Foundation/Calendar/dates(byAdding:value:startingAt:in:wrappingComponents:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Foundation"
    ],
    "preciseIdentifier" : "s:10Foundation8CalendarV5dates8byAdding5value10startingAt2in18wrappingComponentsQrAC9ComponentO_SiAA4DateVSnyAMGSgSbtF"
  },
  "title" : "dates(byAdding:value:startingAt:in:wrappingComponents:)"
}
-->

# dates(byAdding:value:startingAt:in:wrappingComponents:)

Returns a sequence of `Date`s, calculated by adding a scaled amount of `Calendar.Component`s to a starting `Date`.
If a range is supplied, the sequence terminates if the next result is not contained in the range. The starting point does not need to be contained in the range, but if the first result is outside of the range then the result will be an empty sequence.

```
func dates(byAdding component: Calendar.Component, value: Int = 1, startingAt start: Date, in range: Range<Date>? = nil, wrappingComponents: Bool = false) -> some Sendable & Sequence<Date>
```

## Parameters

`component`

A component to add or subtract.

`value`

The value of the specified component to add or subtract. The default value is `1`. The value can be negative, which causes subtraction.

`start`

The starting point of the search.

`range`

The range of dates to allow in the result. The sequence terminates if the next result is not contained in this range. If `nil`, all results are allowed.

`wrappingComponents`

If `true`, the component should be incremented and wrap around to zero/one on overflow, and should not cause higher components to be incremented. The default value is `false`.

## Return Value

A `Sequence` of `Date` values, or an empty sequence if no addition could be performed.

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)