<!--
{
  "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/Date/ComponentsFormatStyle/input(after:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Foundation"
    ],
    "preciseIdentifier" : "s:10Foundation4DateV21ComponentsFormatStyleV5input5afterSnyACGSgAH_tF"
  },
  "title" : "input(after:)"
}
-->

# input(after:)

The next input value after the given input.

```
func input(after input: Range<Date>) -> Range<Date>?
```

## Return Value

If [`isPositive`](/documentation/Foundation/Date/ComponentsFormatStyle/isPositive) is true, the range `input.lowerBound..<x`, where `x` is
the next larger date that this style can differentiate. If [`isPositive`](/documentation/Foundation/Date/ComponentsFormatStyle/isPositive) is false, the range
`x..<input.upperBound`, where `x` is the next higher date this style can differentiate, or
`nil` if there is no such `x`.

## Discussion

If [`isPositive`](/documentation/Foundation/Date/ComponentsFormatStyle/isPositive) is true, the next input value maintains the same `lowerBound` as
`input`, but has a different`upperBound`. If [`isPositive`](/documentation/Foundation/Date/ComponentsFormatStyle/isPositive) is false, the next input value
maintains the same `upperBound` as `input`, but as a different `lowerBound`.

Use this function to determine if the return value provided by [`discreteInput(before:)`](/documentation/Foundation/Date/ComponentsFormatStyle/discreteInput(before:)) is
precise enough for your use case for any input `y`:

```
guard let x = style.discreteInput(before: y) else {
    return
}

let z = style.input(after: x) ?? y
```

If the distance between the `upperBound`s of `x` and `z` is too large for the precision you
require, you may want to manually probe `format(_:)` at a higher rate in that interval, as
there is no guarantee for what the output will be in that interval.

---

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)