Error while updating a CustomField DateTime

Issue #186 resolved
Former user created an issue

So, the REST API return an error when I try top update a CustomField Datetime. "errorMessages":[],"errors":{"customfield_11507":"Error parsing time: 2011-12-19T18:19:26+01:00"}

The expected format should be ISO 8601, something like that :


As you can see, the format of the date is not good, the last colon should not be here.

Here's what I do in my code, and it works when I create the issue, but not when I update it :

issue["myDate"] = myDate.ToString("yyyy-MM-ddTHH:mm:ss.fffzzz").Remove(26, 1);

So now in my issue I have this string 2011-12-19T18:19:26.000+0100

But the error message return me 2011-12-19T18:19:26+01:00

I don't know if something is modifying the string of the CustomField when I SaveChanges() my issue, but it's pretty problematic for me to not be able to update that.

Sorry if I missed something or if I'm doing that badly. Thanks in advance !

Comments (18)

  1. Quy Duong

    The following methods are working for me when updating a date value to a custom field

  2. jbk585


    I'm having the exact same issue as the original reporter. For example, even though I can construct a string to say:


    ...when submitting through the API, I get back the following error:

    {"errorMessages":[],"errors":{"customfield_10489":"Error parsing time: 2016-06-14T17:26:04.164-07:00"}}

    I have tried every format I can think of (including the two above by Quy Duong, and several variations of them) and I always get back this error. I'm using the latest version of the API (as of today), and running against Jira version 7.1.2.

    What could be the problem?

    Thanks for any guidance.

  3. jbk585

    To @qdappnet / @farmas

    Just a bit more info:

    I am able to update this custom field directly against the Jira API using CURL, with the following value:


    If I take this exact same value and assign it to the custom field directly (not even relying on .NET to format the string):

    CurrentIssue["Promoted Date"] = "2016-06-15T17:08:44.803-0700";

    ...using the Atlassian.NET SDK, I get this error back:

    {"errorMessages":[],"errors":{"customfield_10489":"Error parsing time: 2016-06-15T17:08:44.803-07:00"}}

    I've spent hours formatting things every way I can think of, but I cannot get updating this field to work using the Atlassian.NET SDK.

    Please let me know if you can help / have any suggestions.

    Best regards.

  4. Federico Silva Armas repo owner

    I am unable to reproduce this with the steps provided by reporter.

    Jira version: (v7.1.7#71011-sha1:2526d7c) SDK version: 7.1.1.

    'Date' and 'DateTime' custom fields are sent to the server as strings without formatting.

  5. bgilman

    I'm getting this exact same issue! Does anyone have a workaround?

    SDK Version: 7.1.1, JIRA Version: 7.2.3

  6. bgilman
    var _jira = Jira.CreateRestClient(jiraDomain, jiraUsername, jiraPassword);
    var newIssue = _jira.CreateIssue(projectName);
    newIssue.Summary = "Bug Test";
    newIssue.Type = "Task";
    newIssue["Order Id"] = orderId;
    newIssue["Custom Date"] = date1.ToString("yyyy-MM-ddTHH:mm:ss.fffzzz").Remove(26, 1);
    var issue = _jira.Issues.Where(i => i.Project == projectName && i.Type == "Task")
        .FirstOrDefault(i => i.CustomFields["Order Id"].Values.Contains(orderId));
    issue["Custom Date"] = date2.ToString("yyyy-MM-ddTHH:mm:ss.fffzzz").Remove(26, 1);

    This produces an error with the following stack trace:

    {"errorMessages":[],"errors":{"customfield_10407":"Error parsing time: 2016-11-14T17:30:00.00-06:00"}}

    The is the correct date/time of the date2 variable, but with the formatting it should be 2016-11-14T17:30:00.00-0600 instead

  7. Federico Silva Armas repo owner

    Also, in your repro you mean to say that when creating the issue the date is formatted like you expect:

    newIssue["Custom Date"] = date1.ToString("yyyy-MM-ddTHH:mm:ss.fffzzz").Remove(26, 1);

    But not as expected when updating it?

    issue["Custom Date"] = date2.ToString("yyyy-MM-ddTHH:mm:ss.fffzzz").Remove(26, 1);
  8. Federico Silva Armas repo owner
    • changed status to open

    Thanks for the clarification it helped to narrow down the issue to updates only. I can reproduce the bug now.

  9. bgilman

    Awesome! Is there a workaround I could use for 7.1.1 without having to upgrade to 9.0.1? 8.x and above requires I upgrade .NET from 4.5 to 4.5.2 and I'm not able to do that at this time based on some other dependencies

  10. Federico Silva Armas repo owner

    I don't know of any workaround. You would have to backport the fix to previous version.

  11. Log in to comment