# Module /calendar/gregorian

Pure Gregorian calendar arithmetic: leap years, days in month, weekday indices, and date comparison.

```tangu
(use /calendar/gregorian)
```

## Functions & symbols

### add-days

`(add-days date day-offset)`

Shifts a Gregorian date by whole days.

| Parameter | Type | Optional | Description |
| :--- | :--- | :--- | :--- |
| `date` | `Any` | no | — |
| `day-offset` | `Any` | no | — |

### add-months

`(add-months date month-offset)`

Shifts a Gregorian date map by a whole number of months.

| Parameter | Type | Optional | Description |
| :--- | :--- | :--- | :--- |
| `date` | `Any` | no | — |
| `month-offset` | `Any` | no | — |

### add-months-to-year-month

`(add-months-to-year-month year month month-offset)`

Shifts a year-month pair by whole months.

| Parameter | Type | Optional | Description |
| :--- | :--- | :--- | :--- |
| `year` | `Any` | no | — |
| `month` | `Any` | no | — |
| `month-offset` | `Any` | no | — |

### compare-dates

`(compare-dates left right)`

Compares two Gregorian dates.

| Parameter | Type | Optional | Description |
| :--- | :--- | :--- | :--- |
| `left` | `Any` | no | — |
| `right` | `Any` | no | — |

### compute-weekday-index

`(compute-weekday-index date)`

Returns the weekday index for a Gregorian date using Sunday as zero.

| Parameter | Type | Optional | Description |
| :--- | :--- | :--- | :--- |
| `date` | `Any` | no | — |

### construct-date

`(construct-date year month day)`

Constructs a valid Gregorian date map.

| Parameter | Type | Optional | Description |
| :--- | :--- | :--- | :--- |
| `year` | `Any` | no | — |
| `month` | `Any` | no | — |
| `day` | `Any` | no | — |

### construct-today-date

`(construct-today-date)`

Returns the current local Gregorian date.

### date-from-epoch-days

`(date-from-epoch-days epoch-days)`

Converts an epoch day count into a Gregorian date.

| Parameter | Type | Optional | Description |
| :--- | :--- | :--- | :--- |
| `epoch-days` | `Any` | no | — |

### date-from-iso-text

`(date-from-iso-text text)`

Parses an ISO date string into a Gregorian date map.

| Parameter | Type | Optional | Description |
| :--- | :--- | :--- | :--- |
| `text` | `Any` | no | — |

### days-in-month

`(days-in-month year month)`

Returns the number of days in a Gregorian month.

| Parameter | Type | Optional | Description |
| :--- | :--- | :--- | :--- |
| `year` | `Any` | no | — |
| `month` | `Any` | no | — |

### epoch-days-from-date

`(epoch-days-from-date date)`

Converts a Gregorian date into an epoch day count.

| Parameter | Type | Optional | Description |
| :--- | :--- | :--- | :--- |
| `date` | `Any` | no | — |

### is-leap-year?

`(is-leap-year? year)`

Returns true when the year uses the Gregorian leap-year rules.

| Parameter | Type | Optional | Description |
| :--- | :--- | :--- | :--- |
| `year` | `Any` | no | — |

### is-same-date?

`(is-same-date? left right)`

Returns true when two Gregorian dates match exactly.

| Parameter | Type | Optional | Description |
| :--- | :--- | :--- | :--- |
| `left` | `Any` | no | — |
| `right` | `Any` | no | — |

### iso-text-from-date

`(iso-text-from-date date)`

Formats a Gregorian date as YYYY-MM-DD.

| Parameter | Type | Optional | Description |
| :--- | :--- | :--- | :--- |
| `date` | `Any` | no | — |
