Add day in Add fields

Hi All,

I am trying to add a derived date field by adding days into exiting date fields using the below query.

ZonedDateTime origValue = doc['body.dates.dispenseDate'].value;
ZonedDateTime newValue = origValue.plusDays(2);
emit(newValue);

Error: class_cast_exception: Cannot cast from [java.time.ZonedDateTime] to [long].

Please help into

Hi @M.Naim,

I am not familiar with ZonedDateTime but converting newValue to milliseconds or ISO formatted date string should help.