Liking cljdoc? Tell your friends :D

luciolucio.holi


addclj/s

(add date n unit & calendars)

Adds n of unit to date and returns a new date. Skips any holidays in calendars when unit is :business-days.

ParameterDescriptionExamples
dateAn instance of LocalDate or LocalDateTime(LocalDate/of 2020 10 9)
nAn integer2, -1, 0
unitUnit of n:days :weeks :months :years or :business-days
calendarsOne or more strings representing holiday calendars (:business-days only)"US", "BR"

Notes

  1. Types are preserved, i.e., passing a LocalDate in will return a LocalDate
  2. The time portion is never altered on a LocalDateTime instance
  3. LocalDate and LocalDateTime refer whether to java.time or js-joda
  4. unit will accept both :weeks and :week etc. That way you can write 1 :week or 1 :business-day.
Adds `n` of `unit` to `date` and returns a new date. Skips any holidays in `calendars` when `unit` is `:business-days`.

| Parameter   | Description                                                                | Examples                                                |
|-------------|----------------------------------------------------------------------------|---------------------------------------------------------|
| `date`      | An instance of `LocalDate` or `LocalDateTime`                              | `(LocalDate/of 2020 10 9)`                              |
| `n`         | An integer                                                                 | `2`, `-1`, `0`                                          |
| `unit`      | Unit of `n`                                                                | `:days` `:weeks` `:months` `:years` or `:business-days` |
| `calendars` | One or more strings representing holiday calendars (`:business-days` only) | `"US"`, `"BR"`                                      |

**Notes**
1. Types are preserved, i.e., passing a `LocalDate` in will return a `LocalDate`
2. The time portion is never altered on a `LocalDateTime` instance
3. `LocalDate` and `LocalDateTime` refer whether to java.time or js-joda
4. `unit` will accept both `:weeks` and `:week` etc. That way you can write `1 :week` or `1 :business-day`.
sourceraw docstring

business-day?clj/s

(business-day? date & calendars)

Returns true only if date is not in a weekend and also not a holiday in any of the given calendars. Returns false otherwise.

ParameterDescriptionExamples
dateAn instance of LocalDate or LocalDateTime(LocalDate/of 2020 10 9)
calendarsOne or more strings representing holiday calendars"US", "BR"
Returns true only if date is not in a weekend and also not a holiday in any of the given calendars. Returns false otherwise.

| Parameter   | Description                                        | Examples                   |
|-------------|----------------------------------------------------|----------------------------|
| `date`      | An instance of `LocalDate` or `LocalDateTime`      | `(LocalDate/of 2020 10 9)` |
| `calendars` | One or more strings representing holiday calendars | `"US"`, `"BR"`         |
sourceraw docstring

holiday?clj/s

(holiday? date calendar)

Returns true if date is a holiday in the given calendar, and false otherwise

ParameterDescriptionExamples
dateAn instance of LocalDate or LocalDateTime(LocalDate/of 2020 10 9)
calendarA string representing a holiday calendar"US", "BR"
Returns true if date is a holiday in the given calendar, and false otherwise

| Parameter  | Description                                   | Examples                   |
|------------|-----------------------------------------------|----------------------------|
| `date`     | An instance of `LocalDate` or `LocalDateTime` | `(LocalDate/of 2020 10 9)` |
| `calendar` | A string representing a holiday calendar      | `"US"`, `"BR"`         |
sourceraw docstring

list-holidaysclj/s

(list-holidays year calendar)

Returns a collection of maps of the form {:name "Name" :date LocalDate} where every item of the collection represents a holiday in the given year according to the given holiday calendar

Returns a collection of maps of the form `{:name "Name" :date LocalDate}`
where every item of the collection represents a holiday in the given year according
to the given holiday calendar
sourceraw docstring

non-business-day?clj/s

(non-business-day? date & calendars)

Returns true only if date is whether in a weekend or a holiday in one of the given calendars. Returns false otherwise.

ParameterDescriptionExamples
dateAn instance of LocalDate or LocalDateTime(LocalDate/of 2020 10 9)
calendarsOne or more strings representing holiday calendars"US", "BR"
Returns true only if date is whether in a weekend or a holiday in one of the given calendars. Returns false otherwise.

| Parameter   | Description                                        | Examples                   |
|-------------|----------------------------------------------------|----------------------------|
| `date`      | An instance of `LocalDate` or `LocalDateTime`      | `(LocalDate/of 2020 10 9)` |
| `calendars` | One or more strings representing holiday calendars | `"US"`, `"BR"`         |
sourceraw docstring

weekend?clj/s

(weekend? date)

Returns true if date is in a weekend, and false otherwise

ParameterDescriptionExamples
dateAn instance of LocalDate or LocalDateTime(LocalDate/of 2020 10 9)

Notes

  1. Weekend days are assumed to be Saturday and Sunday
Returns true if date is in a weekend, and false otherwise

| Parameter | Description                                   | Examples                   |
|-----------|-----------------------------------------------|----------------------------|
| `date`    | An instance of `LocalDate` or `LocalDateTime` | `(LocalDate/of 2020 10 9)` |

**Notes**
1. Weekend days are assumed to be Saturday and Sunday
sourceraw docstring

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close