> ## Documentation Index
> Fetch the complete documentation index at: https://zenskar.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Reference

## Location

**Settings > Contracts and Invoices > Invoice Date Configuration**

## Calculation order

Zenskar computes the invoice date in three sequential steps:

1. Resolve the reference date.
2. Apply the offset (if enabled).
3. Pin the day within the resulting month.

## Fields

### Invoice Date Configuration (toggle)

| Property          | Value                                                     |
| ----------------- | --------------------------------------------------------- |
| Type              | On/Off toggle                                             |
| Default           | Off                                                       |
| Scope             | Organization-wide; applies to all customers and contracts |
| Behavior when off | Invoice date defaults to the invoice generation timestamp |

### With Reference to

| Option                    | Resolves to                                                         | Default |
| ------------------------- | ------------------------------------------------------------------- | ------- |
| Invoice Generation Date   | The exact moment Zenskar creates the invoice, in UTC                | Yes     |
| Bill For Date             | The billing cycle date the contract's billing period is anchored to | No      |
| Service Period Start Date | The first day of the service window being billed on the invoice     | No      |

### Offset

| Property          | Value                                                                 |
| ----------------- | --------------------------------------------------------------------- |
| Type              | On/Off toggle, with a numeric field and a direction selector          |
| Default           | Off                                                                   |
| No. of Months     | Integer; number of months to shift                                    |
| Direction         | `Before Reference Date` or `After Reference Date`                     |
| Behavior when off | Invoice date uses the reference date directly, subject to day pinning |

### Day pinning

| Option                        | Behavior                                                                                     |
| ----------------------------- | -------------------------------------------------------------------------------------------- |
| Same Day as of Reference Date | Uses the same day number as the reference date, in the target month                          |
| Last Day of That Month        | Always uses the final day of the target month, regardless of the reference date's day number |

### Month-end handling

| Condition                                                                          | Behavior                                         |
| ---------------------------------------------------------------------------------- | ------------------------------------------------ |
| Resolved day does not exist in the target month (e.g., the 31st in a 30-day month) | Clamped to the closest valid day in that month   |
| Leap years                                                                         | Handled automatically; no separate configuration |

## Worked examples

| Reference Date                         | Offset            | Day Pinning                   | Result                                   |
| -------------------------------------- | ----------------- | ----------------------------- | ---------------------------------------- |
| Bill For Date = March 1                | +1 month          | Last Day of That Month        | April 30                                 |
| Invoice Generation Date = March 31     | 0                 | (n/a, uses reference date)    | March 31                                 |
| Service Period Start Date = February 1 | 0                 | Last Day of That Month        | February 28 (February 29 in a leap year) |
| Reference date = the 10th              | Lands on March    | Same Day as of Reference Date | March 10                                 |
| Reference date = the 19th              | Lands on February | Last Day of That Month        | February 28 (February 29 in a leap year) |
| Generation date = April 4              | -1 month          | Last Day of That Month        | March 31                                 |

## Manual invoice date edit

| Property                   | Value                                                                          |
| -------------------------- | ------------------------------------------------------------------------------ |
| Location                   | Invoices (sidebar) > open invoice > pencil icon next to Invoice Date           |
| Editable invoice status    | DRAFT only                                                                     |
| Behavior on other statuses | Update rejected                                                                |
| Input methods              | Direct date entry, quick-select (e.g., Today, Start of Month), calendar picker |
| Scope                      | Single invoice only; does not affect the organization-wide rule                |
| Save behavior              | Invoice document refreshes automatically                                       |

<br />
