How to compare date with current date and time in DMN?

FEEL distinguish between date-time value with and without timezone.

now() returns a date-time value with timezone.

A java.util.Date is transformed into a date-time value without a timezone.

A date-time value with a timezone can’t be compared to a value without a timezone.

One solution is to store the startInDefaultDate as date-time with a timezone, for example, using the type ZonedDateTime. Or, storing the value as a string in the ISO 8601 format (e.g. 2021-04-13T15:34:02.145502600-03:00[America/Buenos_Aires]).

Another solution is to cut the timezone from now(). For example, by using the expression:

date and time(today(), time(now().hour, now().minute, now().second))

Does this help you?

2 Likes