# Applying a calendar

## Overview

Add a calendar to your organization settings and Autoplan will use the calendar to calculate make part start/due dates. For instance, say you had a due date of 12/31/23 and your calendar only counted week days. If the leadtime was 90 days, the start date would be 8/25/23 instead of 10/2/23.

When applying this, **make sure that the make part leadtimes are working days only!**

## How to add a calendar

For now, this setting is API only.

First, query your organization to get properties that we'll use in the following step:

```graphql
{
  organization(id: 1) {
    id
    _etag
    settings {
      plans {
        driveDemandFromKits
        workingTime
      }
    }
  }
}
```

Run this mutation:

```graphql
mutation UpdateOrganization($input: UpdateOrganizationInput!) {
  updateOrganization(input: $input) {
    organization {
      id
      domain
      name
      settings {
        plans {
          workingTime
        }
      }
    }
  }
}
```

with this input. Make sure to use the etag from the first query:

```graphql
{
  "input": {
    "id": 1,
    "etag": <etag from previous step>,
    "settings": {
      "plans": {
        "workingTime": "0 0 * * 1-5"
      }
    }
  }
}
```

The `workingTime` format is set to be in the style of a [cron job](https://crontab.guru/#*_*_*_*_1-5).

* `0 0 * * 1-5` means that it will consider days Monday through Friday
* `0 0 * * 1-6` means that it will consider days Monday through Saturday
* `0 0 * * 0-3` means that it will consider days Sunday through Wednesday

For now, Autoplan will only respect the days portion of the cron-style string.
