# Bug OP-9682 - API V3 - Workpackage dueDate and derivedDueDate values are incorrect

Project: OpenProject
Status: rejected
URL: https://community.openproject.org/work_packages/OP-9682

## Open points

_No work packages_

## Details

| Attribute | Value |
| --- | --- |
| Date |  |
| Priority | Medium |
| Module |  |
| Target versions |  |
| Observed in versions | 12.0.0 |
| Sprint |  |
| Backlog bucket |  |
| Bug found in version (deprecated) | 12.0.x |
| Found in mobile app version |  |
| Follow-up feedback e-mail |  |
| Requires doc change | No |
| Accessibility | No |
| Pull preview |  |
| List |  |
| Labels |  |

## People

| Attribute | Value |
| --- | --- |
| Assignee |  |
| Accountable |  |
| Product manager |  |
| Developers |  |
| Designer |  |
| Ordered by |  |
| Signed off by |  |
| Interest by |  |

## Planning

| Attribute | Value |
| --- | --- |
| Relevance |  |

## Costs

| Attribute | Value |
| --- | --- |
| Votes |  |
| Work |  |
| Labor costs |  |

## Description

### **Environment**:

Your OpenProject Version: OpenProject 12.0.5

Operating System / Browser / OpenProject language: n.a.

### **Logs**

n.a.

### Context:

I want to display all Workpackages due in the next 30 days in my Electron client. Without showing their parents

  

### **Steps to reproduce:**

1.  Create a parent task without start date and due date and without manual scheduling
2.  Create a child task without start date and with due date within the next x days
3.  Call api/v3/work\_packages?offset=0&amp;pageSize=500&amp;filters=%5B%7B%22dueDate%22%3A%7B%22operator%22%3A%22%3Ct%2B%22%2C%22values%22%3A%5B30%5D%7D%7D%2C%7B%22status\_id%22%3A%7B%22operator%22%3A%22o%22%2C%22values%22%3Anull%7D%7D%2C%7B%22type\_id%22%3A%7B%22operator%22%3A%22%3D%22%2C%22values%22%3A%5B1%2C6%2C7%2C9%2C10%2C11%5D%7D%7D%5D 

### **Actual Behavior**

The api returns (extract from the whole JSON):

```json
{
  "_type": "WorkPackageCollection",
  "total": 2,
  "count": 2,
  "pageSize": 500,
  "offset": 1,
  "_embedded": {
    "elements": [
      {
        "derivedStartDate": "2022-02-10",
        "derivedDueDate": "2022-02-10",
        "_type": "WorkPackage",
        "id": 1554,
        "subject": "Parent",
        "scheduleManually": false,
        "startDate": "2022-02-10",
        "dueDate": "2022-02-10",
        "_links": {
          "self": {
            "href": "/api/v3/work_packages/1554",
            "title": "Parent"
          },
          "children": [
            {
              "href": "/api/v3/work_packages/1555",
              "title": "Child"
            }
          ],
          "ancestors": [],
          "parent": {
            "href": null,
            "title": null
          }
        }
      },
      {
        "derivedStartDate": null,
        "derivedDueDate": null,
        "_type": "WorkPackage",
        "id": 1555,
        "lockVersion": 4,
        "subject": "Child",
        "scheduleManually": false,
        "startDate": null,
        "dueDate": "2022-02-10",
        "_links": {
          "self": {
            "href": "/api/v3/work_packages/1555",
            "title": "Child"
          },
          "ancestors": [
            {
              "href": "/api/v3/work_packages/1554",
              "title": "Parent"
            }
          ],
          "parent": {
            "href": "/api/v3/work_packages/1554",
            "title": "Parent"
          }
        }
      }
    ]
  }
}
```

  

That is:

*   the parent is showing a start date, although it has no start date itself
*   the parent is showing a due date, although it has no due date itself. Because of this behavior, the parent is returned in the collection
*   the parent is showing a derived start date, although the child has no start date
*   the parent is showing a derived end date

So I can not easily filter out parents

### **Expected Behavior**

*   if the parent has no start date (so it is not manually scheduled) the start date is null
*   if the parent has no end date (so it is not manually scheduled) the end date is null
*   the derived start date is set to:
    *   the earliest start date of any of the descendants
    *   or null, if none of the descendants has a start date
*   the derived end date is set to:
    *   the latest end date of any of the descendants
    *   or null, if none of the descendants has an end date
*   when calling the api using a filter on due date: the parent, which has no own due date, is not in the collection (same for start date)
