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.

dredbound
  • 1,579
  • 3
  • 17
  • 27
  • maybe this helps: https://answers.atlassian.com/questions/83213/rest-api-timedate-formats – Piotr Kamoda Feb 23 '17 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. – dredbound Feb 23 '17 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. – Piotr Kamoda Feb 23 '17 at 15:38

1 Answers1

2

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)
dredbound
  • 1,579
  • 3
  • 17
  • 27
  • 1
    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 – mdoar Feb 23 '17 at 18:56
  • That is what I ended up doing to get this solution. – dredbound Feb 23 '17 at 21:01