Open sbetti02 opened 2 years ago
@sbetti02, great suggestion.
I have also encountered issues with datetimes when using JQL, as the expected format is "yyyy-mm-dd HH:MM", so I'm not surprised this field doesn't conform to the ISO standard either.
I think it would be great to have two methods that convert a datetime object to the expected strings.
datetime2jql(datetime.datetime) -> str
datetime2customfield(datetime.datetime) -> str
I also couldn't see any specific links about this, but it may be visible from a json export? https://support.atlassian.com/jira-cloud-administration/docs/import-data-from-json/
It's interesting as API endpoints are normally happy with ISO format strings:
Problem trying to solve
Hi there, the jira instance that I'm working with has customfields of the type com.atlassian.jira.plugin.system.customfieldtypes:datetime. This type seems to accept formats such as
'2022-04-14T22:40:15.00+0000'
, but it's very particular about what it accepts, which can be a little troublesome to work with.For example,
2022-04-14T22:40:15.00+0000
-> accepted2022-04-14T22:40:15.00+00:00
-> not accepted2022-04-14T22:40:15+0000
-> not accepted2022-04-14T22:40:15.000000+0000
-> not accepted2022-04-14T22:40:15.00
-> not accepted2022-04-14T22:40:15+0000
-> not acceptedThis has made me to build in my own custom handling to get this to work on my end.
Possible solution(s)
I'm able to generate an appropriate format using something like:
I was wondering though if there's a better way to do this, such as place in this code base to standardize the handling for timestamps when working with situations like this.
Alternatives
I tried looking for existing Q/A, issues, or documentation around how to handle timestamps when working with the Jira API, but so far I haven't had luck with either here or the API docs directly. It's definitely possible I missed something though, and if so I'd love to get pointed in the right direction.
Additional Context
No response