"Text '2023-07-15 14:30' could not be parsed at index 0" – ZonedDateTime conversion failure in Cucumber step definitions
25K reputation · 27 May 2023, 07:34 UTC
Error condition
When a Cucumber step definition expects a ZonedDateTime parameter and the step passes a date‑time string without time‑zone information (e.g., "2023-07-15 14:30"), the built‑in parameter converter throws a DateTimeParseException with the message "Text '2023-07-15 14:30' could not be parsed at index 0". The framework does not apply the JVM default time zone or a locale‑specific zone during conversion, leaving the developer to supply a custom @ParameterType or DataTableType converter. An open discussion in the cucumber‑jvm repository questions whether a zone‑aware fallback converter should be provided.
- Should Cucumber automatically apply the JVM default time zone when converting zone‑less strings to
ZonedDateTime? - Would providing a configurable zone‑aware fallback break existing step definition reuse across projects?
- What criteria should determine whether such a converter is enabled by default?