Tina Liu 67a09e0908
[Gregorian Calendar] Bugs in adding functions (#335)
* 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.
2023-12-06 09:06:15 -08:00
..