Repository navigation
Conversation
|
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
…uary's end (storytold#4012) Upstream PR: storytold#4252 Head: e9ca74f
Merges the zcode-pr-transfer branch (61 commits transferring open, not-yet-merged upstream PRs into our fork) into main. Docs (docs/ui-parity.md, docs/file-format-parity.md) resolved in favor of main's current changelog state; code from all transferred PRs carried over cleanly. Commits carried over (21 from this session + 40 earlier transfers): storytold#4408, storytold#4405, storytold#4406, storytold#4386, storytold#4379, storytold#4378, storytold#4376, storytold#4375, storytold#4373, storytold#4370, storytold#4369, storytold#4348, storytold#4347, storytold#4345, storytold#4344, storytold#4343, storytold#4341, storytold#4340, storytold#4337, storytold#4336, storytold#4318, storytold#4316, storytold#4315, storytold#4312, storytold#4310, storytold#4307, storytold#4306, storytold#4305, storytold#4303, storytold#4298, storytold#4295, storytold#4287, storytold#4286, storytold#4257, storytold#4256, storytold#4254, storytold#4252, storytold#4251, storytold#4248, storytold#4244, storytold#4243, storytold#4229, storytold#4228, storytold#4227, storytold#4225, storytold#4221, storytold#4220, storytold#4219, storytold#4217, storytold#4424, storytold#4423, storytold#4420, storytold#4419, storytold#4418, storytold#4414, storytold#3617, storytold#2642, storytold#2556, storytold#2321
What and why
DAYS360with the US method is wrong around Excel's fictitious 29 February 1900 (serial 60). Excel's 1900 calendar has that day, so February 1900 ends on serial 60: the 28th (serial 59) is not a month end and must stay 28, while the 29th becomes 30.last_of_febused the real calendar (days_in_month(1900, 2) == 28), so it did the opposite, givingDAYS360(59,61) = 1andDAYS360(60,61) = 2where Excel gives 3 and 1.last_of_febnow treats 29 February 1900 as that month's end. The European method and other dates are untouched, and YEARFRAC basis 0 — which shares the helper and Excel's calendar — follows the same rule.Evidence
New test
date::tests::days360_across_the_fictitious_1900_02_29asserts the issue's table:=DAYS360(59,61)=DAYS360(60,61)=DAYS360(59,61,TRUE)=DAYS360(60,61,TRUE)=DAYS360(61,62)Without the helper change:
With it:
date::tests— 19 passed, 0 failed.Commands run
cargo test -p gridcraft-functions --lib date::tests— passcargo clippy -p gridcraft-functions --all-targets -- -D warnings— cleanAll cargo commands ran via
nice -n 19withCARGO_BUILD_JOBS=2 CARGO_INCREMENTAL=0. Not run: workspace-wide CI, wasm.Fixes #4012
Summary by CodeRabbit
DAYS360results around the fictitious date.