Skip to content

fix(quarterOfYear): preserve duration arguments when adding - #3244

Open
Companion wants to merge 1 commit into
iamkun:devfrom
Companion:fix/duration-quarter-plugin-order
Open

Companion wants to merge 1 commit into
iamkun:devfrom
Companion:fix/duration-quarter-plugin-order

Conversation

@Companion

Copy link
Copy Markdown

Fix

Fixes #1446

Keep duration objects intact when quarterOfYear passes an add call to another plugin
Only convert the value to a number when handling quarter units

With duration loaded before quarterOfYear adding a one month duration to January 31 could produce March 2 instead of February 28
Both plugin orders now preserve calendar month and year arithmetic

Tests

  • All 802 tests pass across 94 suites with 100 percent line coverage
  • Both new failing cases were reproduced before the fix
  • Cover both plugin orders month end arithmetic leap years subtraction and numeric string quarters
  • All eight timezone test runs pass
  • Full lint and changed file lint pass

@nrps9909 nrps9909 left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Independently checked exact head ab5bfebed72aad6ed2e5f7b41cb7848e545bbccc against base 436bde0bcded312781cbe45dc2b0ef079a36d8e3 and merge preview 0c0e315947bad37e388a549f7f247e7a5ba4c2ba (both parents verified).

The eight added tests produce two failures on base: the duration-first month-end and calendar-year additions. Both plugin orders pass on head/preview. Complete npm test -- --runInBand passes all eight timezone legs and 94 suites / 802 tests with the 100% line-coverage gate; full lint and changed-file lint pass. Unmodified base passes 93 suites / 794 tests.

An independent probe across New York, Auckland and Taipei covers both orders, local/UTC modes, positive/negative and compound durations, ISO/numeric constructors, month ends, leap years and DST dates. Each implementation has 4,320 duration observations: base has 540 mismatches against duration-only arithmetic, head/preview have zero. Another 50,688 numeric-control comparisons match base, including numeric-string quarters; input dates/durations stay unchanged. A witness plugin also confirms non-quarter arguments reach the prior add implementation without coercion.

On Node 24.15.0, the inherited webpack size step fails with ERR_OSSL_EVP_UNSUPPORTED on both base and head. Head build/size succeeds with command-only NODE_OPTIONS=--openssl-legacy-provider; generated UMD/CommonJS month/year and string-quarter checks pass in all three zones. Remote CI is currently action_required, so these are local results. This review does not cover every plugin combination or browser runtime.

AI assistance: Codex helped inspect the change and develop/run the independent probes; the reported results were checked against the logs.

This branch has not been deployed

No deployments
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.

Invalid dates when loading quarterOfYear plugin after duration plugin

2 participants