Issue
A date parsing expression throws an error in Studio Pro v10.
The expression parseDateTimeUTC(formatDecimal($Date, '####.#'), 'yyww.u') for dates around the first and last week of the year parses correctly without any issue in Studio Pro v9 and below, but throws an Unparseable date error in Studio Pro v10 when part of the week forms part of the previous/following year.
The expression parseDateTimeUTC(formatDecimal($Date, '2501.1'), 'yyww.u') produces UTC time: 2024-12-30 00:00:00.000 Session time: 2024-12-30 01:00:00.000 +0100) in Studio Pro v9 and below, however, it throws the below error message in Studio Pro v10, since there is no Monday in the first week of January 2025:
Caused by: com.mendix.languages.expressions.ExpressionException: Unparseable date: "2501.1" at com.mendix.languages.expressions.Expr.evaluate(Expr.scala:16)Environment
Studio Pro v10.0.0 and newer
Cause
The Mendix runtime follows the Java Specification, where lenient parsing and strict parsing are terms used to describe how certain operations (especially in date/time parsing) handle input data that deviates from expected formats or constraints.
Lenient parsing is forgiving of minor errors or deviations in the input data and tries to adjust or normalize the data to fit the expected format.
Strict parsing enforces strict adherence to the input format or constraints and throws an error if the input does not match exactly.
The parseDateTime microflow functions use strict parsing by default from Studio Pro v10.0.0.
Solution/Workaround
To resolve the Unparseable date error, revert to the lenient parsing method as follows:
- Open the App Settings page via Studio Pro > App 'AppName' > Settings
- Click on the active configuration listed under the Configurations tab
- Go to Custom tab in the Edit Configuration page
- Add a new custom runtime configuration by filling the Name field with
com.mendix.core.LenientDateTimeParsingand Value field withtrue. - Click OK
- Save and run the project
Internal information related
- 169612, 170756, 237618
- DAT-3346
- C3T260XGA/p1736325708986739
Additional information
- Mendix documentation:
0 Comments