# Module /cron

Standard 5-field cron expression parsing, validation, and schedule matching (Cron, is-matching?, is-matching-now?).

```tangu
(use /cron)
```

## Functions & symbols

### Cron

`(Cron pattern) -> Cron`

Parses and validates a 5-field cron schedule expression.

| Parameter | Type | Optional | Description |
| :--- | :--- | :--- | :--- |
| `pattern` | `String` | no | 5-field cron expression (e.g. "*/5 * * * 1-5") |

```tangu
(let sched (cron/Cron "0 9 * * 1-5"))
```

### is-matching-now?

`(is-matching-now? pattern) -> Bool`

Returns `true` if the current UTC minute matches `pattern`.

| Parameter | Type | Optional | Description |
| :--- | :--- | :--- | :--- |
| `pattern` | `Cron | String` | no | Cron schedule or string |

```tangu
(cron/is-matching-now? "* * * * *")
```

### is-matching?

`(is-matching? pattern temporal) -> Bool`

Returns `true` if `temporal` matches the cron schedule.

| Parameter | Type | Optional | Description |
| :--- | :--- | :--- | :--- |
| `pattern` | `Cron | String` | no | Cron schedule or string |
| `temporal` | `Date | Time | Date-Time | Zoned-Date-Time | Instant` | no | Timestamp or civil datetime to test |

```tangu
(cron/is-matching? "0 9 * * *" dt)
```

### is-valid?

`(is-valid? pattern) -> Bool`

Returns `true` if `pattern` is a valid 5-field cron expression.

| Parameter | Type | Optional | Description |
| :--- | :--- | :--- | :--- |
| `pattern` | `String` | no | Cron expression string |

```tangu
(cron/is-valid? "0 * * * *") ; -> true
```
