Getting an error when using `java.time.ZonedDateTime` in ScriptRunner Script Console

Hamza Nazeer
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
December 8, 2022

I am getting the following error when I use `java.time.ZonedDateTime` in ScriptRunner Script Console.

com.fasterxml.jackson.databind.exc.InvalidDefinitionException: Java 8 date/time type `java.time.ZonedDateTime` not supported by default: add Module "com.fasterxml.jackson.datatype:jackson-datatype-jsr310" to enable handling (through reference chain:["result"]) 
at com.fasterxml.jackson.databind.exc.InvalidDefinitionException.from(
at com.fasterxml.jackson.databind.SerializerProvider.reportBadDefinition(
at com.fasterxml.jackson.databind.ser.impl.UnsupportedTypeSerializer.serialize(
at com.fasterxml.jackson.databind.ser.BeanPropertyWriter.serializeAsField(
at com.fasterxml.jackson.databind.ser.std.BeanSerializerBase.serializeFields(
at com.fasterxml.jackson.databind.ser.std.BeanSerializerBase.serializeWithType(
at com.fasterxml.jackson.databind.ser.impl.TypeWrappedSerializer.serialize(
at com.fasterxml.jackson.databind.ser.DefaultSerializerProvider._serialize(
at com.fasterxml.jackson.databind.ser.DefaultSerializerProvider.serializeValue(
at com.fasterxml.jackson.databind.ObjectWriter$Prefetch.serialize(
at com.fasterxml.jackson.databind.ObjectWriter._writeValueAndClose(
at com.fasterxml.jackson.databind.ObjectWriter.writeValueAsString(


The issue can be reproduced with a simple script below,

import java.time.ZonedDateTime

def time =

return time


I have seen many examples from people using ZonedDateTimem but unfortunately it does not work for me. Even the ScriptRunner Cloud recommends using java.time for time calculations instead of Date.

It would be really helpful if you can help me to resolve the issue.

1 answer

0 votes
Ram Kumar Aravindakshan _Adaptavist_
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
July 16, 2023

Hi @Hamza Nazeer

Could you change the approach you are trying to retrieve the Current Date by adding it to a log parameter as shown below:-

import java.time.ZonedDateTime

logger.warn "====>>>${}"

 This approach is working as shown in the screenshot below:-


I am suggesting this approach because it ScriptRunner in Jira could not directly able to read the value of the and returns an exception.

I hope this helps to solve your question. :-)

Thank you and Kind regards,


Suggest an answer

Log in or Sign up to answer
Site Admin
AUG Leaders

Atlassian Community Events