Richard Scott created NIFI-15674:
------------------------------------

             Summary: Add "isValidDate" and "isValidInstant" Expression 
Language functions
                 Key: NIFI-15674
                 URL: https://issues.apache.org/jira/browse/NIFI-15674
             Project: Apache NiFi
          Issue Type: Improvement
          Components: Core Framework
            Reporter: Richard Scott
            Assignee: Richard Scott
             Fix For: 2.8.0


NiFi currently has no simple top-level Expression Language function to check 
whether a value is a valid date or instant before attempting to parse it.

Today, users often need to rely on regex, advanced expressions, or extra 
processor logic in *UpdateAttribute* or *RouteOnAttribute* to validate date 
input first. Regex can help check whether a value matches the expected shape, 
but it is not calendar-aware and cannot reliably determine whether a value is 
an actual valid date. For example, a value may match {{dd-MM-yyyy}} while still 
being invalid as a real calendar date.

This pushes validation logic into more complex or buried configurations and 
makes flows harder to read.

It also creates operational risk. If an invalid value is parsed without first 
checking validity, the expression can fail. In some flow designs, this can lead 
to FlowFiles repeatedly retrying or looping in a queue instead of being cleanly 
handled.

Adding {{isValidDate}} and {{isValidInstant}} would allow users to validate 
input safely and keep that logic visible at the top level of an expression.
h2. Proposed Functions

*{{isValidDate(format)}}*
Returns {{true}} if the subject can be parsed as a valid date using the 
supplied format, otherwise {{{}false{}}}.

*{{isValidDate(format, timezone)}}*
Returns {{true}} if the subject can be parsed as a valid date using the 
supplied format and timezone, otherwise {{{}false{}}}.

*{{isValidInstant()}}*
Returns {{true}} if the subject can be parsed as a valid ISO-8601 instant, 
otherwise {{{}false{}}}.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to