# How delivery dates are calculated

> The order in which Duely applies cutoff, lead time, preparation days, delivery days, holidays, booking window and capacity.

Every time the picker opens, Duely works out which dates a customer can choose. It runs the same calculation again at checkout and when the order arrives, so all three always agree.

[Screenshot: Cart calendar showing available, full and closed dates]

## The steps

1. **Today, in your store's time zone.** All times use the time zone in your Shopify settings. The customer's time zone is never used. See [Order-by time and time zone](/duely/concepts/cutoff-and-time-zone/).
2. **Order-by time (cutoff).** If the order is placed at or after your order-by time, Duely counts from tomorrow instead of today.
3. **Minimum notice (lead time).** Adds whole days to that starting day.
4. **First preparation day.** The first day on or after that point that is one of the **Work days** and is not closed for preparation.
5. **Preparation time.** The delivery date is this many delivery days after the preparation day. With 0 days, you prepare and deliver on the same day.
6. **Delivery days and closed days.** Only your delivery days that are not closed for delivery can be chosen.
7. **Booking window.** Dates further ahead than **Booking window (days)** are not offered.
8. **Capacity.** Dates or slots that are already full are hidden.

## Worked example

A bakery with these settings, in its own time zone:

| Setting | Value |
|---|---|
| Delivery days | Tuesday to Saturday |
| Days your kitchen/studio works | Monday to Saturday |
| Order-by time | 15:00 |
| Minimum notice | 0 days |
| Preparation time | 1 day |

| Order placed | Prepared on | Earliest delivery |
|---|---|---|
| Thu Dec 3, 14:59 | Thu Dec 3 | **Fri Dec 4** |
| Thu Dec 3, 15:00 | Fri Dec 4 | **Sat Dec 5** |
| Fri Dec 4, 16:00 | Mon Dec 7 | **Tue Dec 8** |

The last row needs a closer look. After the order-by time on Friday, Saturday is the first preparation day. But the bakery does not deliver on Sunday or Monday, so the next delivery day is Tuesday. Duely then picks the **latest** preparation day that still works for Tuesday, which is Monday. That way the cake is as fresh as possible.

## Where to check

The side-column **Preview** on **Delivery schedule** shows, for a customer ordering now, the earliest delivery date and the day you will prepare it. It uses your rules and skips dates that are already fully booked. Use it to try out changes before you save.
