0

Story: I am using the jira-python api library to create issues in JIRA. I created a custom due date field for my issues (customfield_10300 in code below). This custom field is a Date Time picker.

Problem: The code below tries to creates an issue but returns an error because the syntax for setting the Date Time picker (customfield_10300) value is incorrect. Does anyone know how I would do this?

from jira import JIRA
jira = JIRA(options,basic_auth=('auth_email','auth_pw'))

issue_dict = {
    'project': {'key': 'AT'}, 
    'summary': 'Update test',
    'description': 'Not important',
    'issuetype': {'name': 'Bug'},
    "customfield_10300" : '10/22/2017  10:00:00 AM', #Problem: Date Time Picker Field, not working
}
new_issue = jira.create_issue(fields=issue_dict)

P.S. In Jira the field is a "Dates" field, located next to Created and Updated. I assume the syntax for modifying their values would be the same.

3
  • maybe this helps: answers.atlassian.com/questions/83213/rest-api-timedate-formats Commented Feb 23, 2017 at 15:19
  • No, unfortunately this is for the date picker field, which I was able to get working with this format: "customfield_10301" : "2013-10-25". It's the date time picker field that's giving me issues. I am trying to set the time component to 10am for example. Commented Feb 23, 2017 at 15:33
  • How about you create the issue by website and use get_issue instead create_issue? You should see the date format then. Commented Feb 23, 2017 at 15:38

1 Answer 1

3

Finally got it to work. In case anyone else is having this problem here is the format for updating/creating a date time picker field:

from jira import JIRA
jira = JIRA(options,basic_auth=('auth_email','auth_pw'))

issue_dict = {
    'project': {'key': 'AT'},
    'summary': 'Update test',
    'description': 'Not important',
    'issuetype': {'name': 'Bug'},
    "customfield_10300" : "2015-07-03T14:08:00.000-0500", #working date time picker field
}

new_issue = jira.create_issue(fields=issue_dict)
Sign up to request clarification or add additional context in comments.

2 Comments

I've had to do this for a few different custom field types. I usually end up looking at what the REST API returns for the issue for an idea
That is what I ended up doing to get this solution.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.