> ## Knowledge Base Index
> Fetch the complete knowledge base index at: https://support.haddock.app/sitemap.xml
> Use this file to discover available pages before exploring further.
> Pure-Markdown content can be obtained by appending a '.md' suffix to the content URLs listed in the sitemap (without the trailing slash).

# 💤 How to calculate night work with rules

If you want to automate the calculation of night hours (for example, from 22:00 to 06:00) in haddock HR, you can do it easily using a **rule**. Here's how to configure it step by step:

---

### ✅ 1. Create the destination account

Before creating the rule, you need to have a **hours-type account** where the night hours will accumulate.

1. Go to the left side menu and open **Rules > Accounts**.
2. Click the **“+”** button at the top right.
3. Create an account with:

  - **Name**: for example, *Night hours*
  - **Account type**: select **Hours**

Save the account and it will be available to use in your rule.

---

### ⚙️ 2. Create the night-work rule

1. Go to **Rules** in the left side menu.
2. Click the **“+”** button in the top right.
3. Give it a name, for example: **Night work**.

---

### 🔧 3. Configure the transaction type

In the form:

- Under **Transaction type**, select **Time type**.
- Under **Time type**, choose **Work time**.

---

### 🕒 4. Define the time window

Specify the interval in which hours should count as night hours. For example:

- **Start time**: 22:00
- **End time**: 06:00

⏰ haddock HR will take care of counting the hours within that period, even if they cross over to another day.

---

### 📥 5. Link the destination account

In the **Destination account** field, select the account you created in step 1, for example: *Night hours*.

---

### 💾 6. Save the rule

Click **Save**. Your night-work rule is now ready to use.

![](https://storage.googleapis.com/helpdesk-haddock-images/haddock-hr/contracts-accounts-rules-and-transactions/how-to-calculate-night-work-with-rules/images/01-6-save-the-rule.png)

---

### 👀 7. View it from planning

To see the applied night hours:

1. Open the planning for a group.
2. Set up a custom view.
3. Add the column corresponding to the **Night work** rule.