Context
PR #14016 introduced two new silent fallback paths (replacing pre-PR fail-fast / hardcoded behavior):
DayjsDatetimeAdapter.setLocale() (libs/datetime-adapter/src/lib/dayjs-datetime-adapter.ts)
- Pre-PR:
throw new Error('Failed to load locale ...') on unknown locale.
- Post-PR:
console.warn(...) then falls back to 'en'. Production users may never see the warning.
FdDatetimeAdapter.getFirstDayOfWeek() (libs/core/datetime/fd-datetime-adapter.ts)
- Pre-PR: hardcoded
return 0 (always Sunday).
- Post-PR: tries
Intl.Locale.weekInfo and silently catches errors back to 0. Older browsers without weekInfo mis-render the calendar's first column with no signal to the app.
The fail-soft default is correct for most apps — a typo in a locale string shouldn't crash an app. But apps that want fail-fast (CI pipelines, regulated environments, locale-coverage testing) currently can't opt in.
Proposal
Add a strictLocale: boolean option to provideDayjsDatetimeAdapter() (and the equivalent for FdDatetimeAdapter). When true, the fallbacks throw instead of warn / silently-correct.
// Default — current behavior preserved
provideDayjsDatetimeAdapter();
// Strict — throw on unknown locale or missing Intl.Locale.weekInfo
provideDayjsDatetimeAdapter({ strictLocale: true });
Acceptance criteria
Related
Context
PR #14016 introduced two new silent fallback paths (replacing pre-PR fail-fast / hardcoded behavior):
DayjsDatetimeAdapter.setLocale()(libs/datetime-adapter/src/lib/dayjs-datetime-adapter.ts)throw new Error('Failed to load locale ...')on unknown locale.console.warn(...)then falls back to'en'. Production users may never see the warning.FdDatetimeAdapter.getFirstDayOfWeek()(libs/core/datetime/fd-datetime-adapter.ts)return 0(always Sunday).Intl.Locale.weekInfoand silently catches errors back to0. Older browsers withoutweekInfomis-render the calendar's first column with no signal to the app.The fail-soft default is correct for most apps — a typo in a locale string shouldn't crash an app. But apps that want fail-fast (CI pipelines, regulated environments, locale-coverage testing) currently can't opt in.
Proposal
Add a
strictLocale: booleanoption toprovideDayjsDatetimeAdapter()(and the equivalent forFdDatetimeAdapter). Whentrue, the fallbacks throw instead of warn / silently-correct.Acceptance criteria
provideDayjsDatetimeAdapter({ strictLocale: true })acceptedIntl.Locale.weekInfo→ throws with browser-feature errorstrictLocale: falseor unset) preserves current PR fix: datetime adapters migration #14016 behavior — no regression for existing appsRelated