Skip to content

Conversation

@lukaskollmer
Copy link
Contributor

This PR is a follow up to #1284: we missed the fact that remainder(dividingBy:) can produce negative values if the input's fractional part is greater than 0.5. (eg: 1.9.remainder(dividingBy: 1) is -0.1).

Since the dates produced by Calendar.DatesByRecurring.Iterator all have their nanosecond component set to 0 (rather than being rounded to the nearest whole number), we need to use truncatingRemainder(dividingBy:) instead.

I also changed it to operate on timeIntervalSinceReferenceDate instead of timeIntervalSince1970, since that saves us on having to perform the timeIntervalSince1970 computation every time.

@itingliu
Copy link
Contributor

@swift-ci please test

@parkera parkera merged commit 2393a6b into swiftlang:main Jun 2, 2025
15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants