Skip to main content

2025.1 to 2025.2

datetime.toDate(...) without a pattern is deprecated

What changed

Starting with ADITO 2025.2, the following method is deprecated:

// deprecated (no longer supported)
datetime.toDate("1755761468080");

Why it matters

This method will be removed in a future major release. Prepare your code now to avoid issues in upcoming updates.

Use a method signature that includes a pattern.

For example, convert:

// deprecated (no longer supported)
datetime.toDate("1755761468080");

to a method signature that includes a pattern:

// better
datetime.toDate("1755761468080", "yyyy-MM-dd");

Developer comments on why this was changed

In previous versions of ADITO, the behavior of the method was undefined and ambiguous. This meant the method could be used in different ways, which could lead to unexpected behavior and errors in customizations without being noticed.

To prevent this, always provide an explicit pattern when calling the method.

Two new constants were also added:

// new pattern constants:
datetime.DATETIME_PATTERN_ISO_LOCAL_DATE_TIME //yyyy-MM-dd'T'HH:mm:ss
datetime.DATETIME_PATTERN_ISO_OFFSET_DATE_TIME_MILLIS //yyyy-MM-dd'T'HH:mm:ss.SSSXXX

These produce strings formatted according to ISO 8601

For the example above, this results in:

// result (for UTC — e.g., ADITO server context): 2025-08-21T07:31:08
datetime.toDate("1755761468080", datetime.DATETIME_PATTERN_ISO_LOCAL_DATE_TIME);

// result (for Europe/Berlin — e.g., in a client context running in the Europe/Berlin time zone): 2025-08-21T09:31:08
datetime.toDate("1755761468080", datetime.DATETIME_PATTERN_ISO_LOCAL_DATE_TIME);