Skip to main content

Code reviews rule: Use of outdated API version for ICU locale

Written by David Martin
Updated yesterday

Use of outdated API version for ICU locale

Why is this an issue?

In Spring '25, the "Enable ICU locale formats" setting is enforced for all orgs. Components on API versions below 45.0 cannot use the ICU-aware locale functions, so locale-dependent operations like Date.format(), DateTime.parse(), and Integer.format() may produce unexpected results when the new formatting rules take effect.

Examples

Example of incorrect code:

// Apex class metadata: apiVersion 29.0
public class DateHelper {
public static String foo() {
DateTime myDateTime = DateTime.newInstance(1993, 6, 6, 3, 3, 3);
return myDateTime.format();
}
}

Example of correct code:

// Apex class metadata: apiVersion 66.0
public class DateHelper {
public static String foo() {
DateTime myDateTime = DateTime.newInstance(1993, 6, 6, 3, 3, 3);
return myDateTime.format();
}
}

How can I fix violations?

  1. Update API versions: Upgrade components to API version 45.0 or later.

  2. Test thoroughly: Verify formatting in different locales after updating.

Resources

Did this answer your question?