|
4 | 4 | [tick.core :as t])) |
5 | 5 |
|
6 | 6 | (defn add |
7 | | - "Adds `n` of `unit` to `date` and returns a new date. Skips holidays in `calendars` when `unit` is `:business-days`. |
| 7 | + "Adds `n` of `unit` to `date` and returns a new date. Skips any holidays in `calendars` when `unit` is `:business-days`. |
8 | 8 |
|
9 | 9 | | Parameter | Description | Example | |
10 | 10 | |-------------|----------------------------------------------------------------------------|---------------------------------------------------------| |
11 | 11 | | `date` | An instance of `java.time.LocalDate` or `java.time.LocalDateTime` | `(LocalDate/of 2020 10 9)` | |
12 | 12 | | `n` | An integer | `2`, `-1`, `0` | |
13 | 13 | | `unit` | Unit of `n` | `:days` `:weeks` `:months` `:years` or `:business-days` | |
14 | | - | `calendars` | One or more strings representing holiday calendars (`:business-days` only) | `" US "`, `" BR "` | |
| 14 | + | `calendars` | One or more strings representing holiday calendars (`:business-days` only) | `\" US \"`, `\" BR \"` | |
15 | 15 |
|
16 | 16 | **Notes** |
17 | 17 | 1. Types are preserved, i.e., passing a `LocalDate` in will return a `LocalDate` |
|
42 | 42 | | Parameter | Description | Example | |
43 | 43 | |------------|-------------------------------------------------------------------|----------------------------| |
44 | 44 | | `date` | An instance of `java.time.LocalDate` or `java.time.LocalDateTime` | `(LocalDate/of 2020 10 9)` | |
45 | | - | `calendar` | A string representing a holiday calendar | `" US "`, `" BR "` |" |
| 45 | + | `calendar` | A string representing a holiday calendar | `\" US \"`, `\" BR \"` |" |
46 | 46 | [date calendar] |
47 | 47 | (let [holidays (core/read-calendar calendar)] |
48 | 48 | (core/is-date-in-list? date holidays))) |
|
53 | 53 | | Parameter | Description | Example | |
54 | 54 | |-------------|-------------------------------------------------------------------|----------------------------| |
55 | 55 | | `date` | An instance of `java.time.LocalDate` or `java.time.LocalDateTime` | `(LocalDate/of 2020 10 9)` | |
56 | | - | `calendars` | One or more strings representing holiday calendars | `" US "`, `" BR "` |" |
| 56 | + | `calendars` | One or more strings representing holiday calendars | `\" US \"`, `\" BR \"` |" |
57 | 57 | [date & calendars] |
58 | 58 | (let [non-business-days (core/read-calendars (set (conj calendars constants/WEEKEND-FILE-NAME)))] |
59 | 59 | (core/is-date-in-list? date non-business-days))) |
|
64 | 64 | | Parameter | Description | Example | |
65 | 65 | |-------------|-------------------------------------------------------------------|----------------------------| |
66 | 66 | | `date` | An instance of `java.time.LocalDate` or `java.time.LocalDateTime` | `(LocalDate/of 2020 10 9)` | |
67 | | - | `calendars` | One or more strings representing holiday calendars | `" US "`, `" BR "` |" |
| 67 | + | `calendars` | One or more strings representing holiday calendars | `\" US \"`, `\" BR \"` |" |
68 | 68 | [date & calendars] |
69 | 69 | (not (apply non-business-day? date calendars))) |
0 commit comments