(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
.
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
LocalDate
in will return a LocalDate
LocalDateTime
instanceLocalDate
and LocalDateTime
refer whether to java.time or js-jodaunit
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`.
(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.
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" |
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"` |
(holiday? date calendar)
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" |
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"` |
(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
(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.
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" |
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"` |
(weekend? date)
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
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
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close