Use invariant date literals
Write fixed dates in AL with the invariant yyyymmddD syntax. A locale-dependent text value parsed with Evaluate can change meaning or fail under another user's regional settings, which makes the Marketplace extension unreliable across markets.
- communitylayer
- appsourcedomain
- 2examples
- 1pull request
Rule on GitHub · community layer · appsource · BC all · tier official · derived
Description
Write fixed dates in AL with the invariant yyyymmddD syntax. A locale-dependent text value parsed with Evaluate can change meaning or fail under another user’s regional settings, which makes the Marketplace extension unreliable across markets.
Best Practice
Represent a fixed date directly as an AL date literal, such as 20250131D. Use CalcDate with a date formula when the value is relative rather than fixed.
See sample: use-invariant-date-literals.good.al.
Anti Pattern
Building a fixed date by passing localized text such as 01/02/2025 to Evaluate. Detection signal: Evaluate converting a hard-coded or label-backed formatted string into a Date.
See sample: use-invariant-date-literals.bad.al.
Examples
Changed by
From microsoft/BCQuality at a4593a1, MIT License, Copyright (c) 2026 Microsoft Corporation (license).