<-- Back

Error: Unparseable date when parsing a date in Studio Pro

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:

  1. Open the App Settings page via Studio Pro > App 'AppName' > Settings
  2. Click on the active configuration listed under the Configurations tab
  3. Go to Custom tab in the Edit Configuration page
  4. Add a new custom runtime configuration by filling the Name field with com.mendix.core.LenientDateTimeParsing and Value field with true.
  5. Click OK
  6. Save and run the project 

Internal information related

  • 169612, 170756, 237618
  • DAT-3346
  • C3T260XGA/p1736325708986739

Additional information 

Have more questions? Submit a request

0 Comments

Article is closed for comments.

To provide feedback, please open a ticket here. Don't forget to include the article's URL along with the feedback you would like to provide.