mirror of
https://github.com/apple/swift-foundation.git
synced 2025-05-25 23:48:33 +08:00
* Add more tests; some of them are currently failing * [Gregorian Calendar] Bugs in adding functions Week handling is currently wrong, so adding .week and .yearForWeekOfYear to dates across year boundaries would be wrong. Adding is implemented as such: - calculate all date component values for the given date - add the given value to the given component - calculate date from the updated date components When calculating date from the given date components, the heuristics of handling conflicting components, implemented as `ResolvedDateComponents`, may favor the wrong component. We tried working around this by passing in the component to take priority to `ResolvedDateComponents(preferComponent:dateComponents)` in the current implementation, but that logic was still flawed. Simplify this by only including relevant components in the calculation rather than deferring to `ResolvedDateComponents` to resolve the components.