Skip to content

fix(vendor): remove this-param from DateTimeFormatImpl to fix Babel arg-shift bug#100

Merged
KaiVandivier merged 1 commit into
alphafrom
fix/vendor-temporal
Jul 3, 2026
Merged

fix(vendor): remove this-param from DateTimeFormatImpl to fix Babel arg-shift bug#100
KaiVandivier merged 1 commit into
alphafrom
fix/vendor-temporal

Conversation

@kabaros

@kabaros kabaros commented Jul 3, 2026

Copy link
Copy Markdown
Collaborator

This bug was caught after integrating with UI library, as .toLocaleString stopped calling the underlying i18n object breaking some date formatting there


Babel's parameter-transform plugin counts the TypeScript-only this parameter as real when compiling DateTimeFormatImpl's default-valued params for older targets, shifting locale/optionsParam into arguments[1]/[2] instead of [0]/[1]. This silently broke every toLocaleString() call, causing date-only formatting (e.g. calendar day cells) to render as a full date instead of just the requested field.

src/vendor is excluded from tsconfig.json type-checking, so the this type isn't needed for compilation; the runtime value is unaffected since this is still bound dynamically by the new call site.

…rg-shift bug

Babel's parameter-transform plugin counts the TypeScript-only `this`
parameter as real when compiling DateTimeFormatImpl's default-valued
params for older targets, shifting locale/optionsParam into
arguments[1]/[2] instead of [0]/[1]. This silently broke every
toLocaleString() call, causing date-only formatting (e.g. calendar day
cells) to render as a full date instead of just the requested field.

src/vendor is excluded from tsconfig.json type-checking, so the `this`
type isn't needed for compilation; the runtime value is unaffected
since `this` is still bound dynamically by the `new` call site.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@kabaros
kabaros requested a review from KaiVandivier July 3, 2026 13:17
@sonarqubecloud

sonarqubecloud Bot commented Jul 3, 2026

Copy link
Copy Markdown

@kabaros kabaros changed the title fix(vendor): remove this-param from DateTimeFormatImpl to fix Babel a… fix(vendor): remove this-param from DateTimeFormatImpl to fix Babel arg-shift bug Jul 3, 2026
@KaiVandivier
KaiVandivier merged commit 23e7553 into alpha Jul 3, 2026
19 checks passed
dhis2-bot added a commit that referenced this pull request Jul 3, 2026
# [2.2.0-alpha.2](v2.2.0-alpha.1...v2.2.0-alpha.2) (2026-07-03)

### Bug Fixes

* **vendor:** remove this-param from DateTimeFormatImpl to fix Babel arg-shift bug ([#100](#100)) ([23e7553](23e7553))
@dhis2-bot

Copy link
Copy Markdown
Contributor

🎉 This PR is included in version 2.2.0-alpha.2 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants