(add date n unit)
(add date n unit weekend-option)
(add date n unit & calendars)
(add date n unit weekend-option & 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 |
weekend-option | Choice of days considered weekend days. Optional, defaults to :sat-sun | :sat-sun , :fri-sat |
calendars | One or more strings representing holiday calendars (:business-days only) | "US" , "BR" |
Throws an ex-info if unit is :business-days
and holi has no record of holidays for the year of the resulting date,
or any of the given calendars is unknown.
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` | | `weekend-option` | Choice of days considered weekend days. Optional, defaults to :sat-sun | `:sat-sun`, `:fri-sat` | | `calendars` | One or more strings representing holiday calendars (`:business-days` only) | `"US"`, `"BR"` | Throws an ex-info if unit is `:business-days` and holi has no record of holidays for the year of the resulting date, or any of the given calendars is unknown. **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)
(business-day? date weekend-option)
(business-day? date & calendars)
(business-day? date weekend-option & 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 /LocalDateTime or a string that can be parsed as a date | (LocalDate/of 2020 10 9) , "2020-10-09" |
weekend-option | Choice of days considered weekend days. Optional, defaults to :sat-sun | :sat-sun , :fri-sat |
calendars | One or more strings representing holiday calendars | "US" , "BR" |
Throws an ex-info if holi has no record of holidays or weekends for the year of the given date or the calendar is unknown
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`/`LocalDateTime` or a string that can be parsed as a date | `(LocalDate/of 2020 10 9)`, `"2020-10-09"` | | `weekend-option` | Choice of days considered weekend days. Optional, defaults to :sat-sun | `:sat-sun`, `:fri-sat` | | `calendars` | One or more strings representing holiday calendars | `"US"`, `"BR"` | Throws an ex-info if holi has no record of holidays or weekends for the year of the given date or the calendar is unknown
(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 /LocalDateTime or a string that can be parsed as a date | (LocalDate/of 2020 10 9) , "2020-10-09" |
calendar | A string representing a holiday calendar | "US" , "BR" |
Throws an ex-info if holi has no record of holidays for the year of the given date or the calendar is unknown
Returns true if date is a holiday in the given calendar, and false otherwise | Parameter | Description | Examples | |------------|-------------------------------------------------------------------------------------|----------------------------------------------| | `date` | An instance of `LocalDate`/`LocalDateTime` or a string that can be parsed as a date | `(LocalDate/of 2020 10 9)`, `"2020-10-09"` | | `calendar` | A string representing a holiday calendar | `"US"`, `"BR"` | Throws an ex-info if holi has no record of holidays for the year of the given date or the calendar is unknown
(holidays-in-date date calendar)
Returns a collection containing names of holidays in the given date, for example: ["New Year's Day" "Independence Day"]
If there are none, it will return an empty collection.
Parameter | Description | Examples |
---|---|---|
date | An instance of LocalDate /LocalDateTime or a string that can be parsed as a date | (LocalDate/of 2020 10 9) , "2020-10-09" |
calendar | A string representing a holiday calendar | "US" , "BR" |
Throws an ex-info if holi has no record of holidays for the year of the given date or the calendar is unknown
Returns a collection containing names of holidays in the given date, for example: `["New Year's Day" "Independence Day"]` If there are none, it will return an empty collection. | Parameter | Description | Examples | |------------|-------------------------------------------------------------------------------------|----------------------------------------------| | `date` | An instance of `LocalDate`/`LocalDateTime` or a string that can be parsed as a date | `(LocalDate/of 2020 10 9)`, `"2020-10-09"` | | `calendar` | A string representing a holiday calendar | `"US"`, `"BR"` | Throws an ex-info if holi has no record of holidays for the year of the given date or the calendar is unknown
(holidays-in-year 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
Parameter | Description | Examples |
---|---|---|
year | An integer or string that represents a year | 2030 , "1982" |
calendar | A string representing a holiday calendar | "US" , "BR" |
Throws an ex-info if holi has no record of weekends or holidays for the given year or the calendar is unknown
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 | Parameter | Description | Examples | |------------|-----------------------------------------------|----------------------------| | `year` | An integer or string that represents a year | `2030`, `"1982"` | | `calendar` | A string representing a holiday calendar | `"US"`, `"BR"` | Throws an ex-info if holi has no record of weekends or holidays for the given year or the calendar is unknown
(non-business-day? date)
(non-business-day? date weekend-option)
(non-business-day? date & calendars)
(non-business-day? date weekend-option & 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 /LocalDateTime or a string that can be parsed as a date | (LocalDate/of 2020 10 9) , "2020-10-09" |
weekend-option | Choice of days considered weekend days. Optional, defaults to :sat-sun | :sat-sun , :fri-sat |
calendars | One or more strings representing holiday calendars | "US" , "BR" |
Throws an ex-info if holi has no record of holidays or weekends for the year of the given date or any of the given calendars is unknown
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`/`LocalDateTime` or a string that can be parsed as a date | `(LocalDate/of 2020 10 9)`, `"2020-10-09"` | | `weekend-option` | Choice of days considered weekend days. Optional, defaults to :sat-sun | `:sat-sun`, `:fri-sat` | | `calendars` | One or more strings representing holiday calendars | `"US"`, `"BR"` | Throws an ex-info if holi has no record of holidays or weekends for the year of the given date or any of the given calendars is unknown
(weekend? date)
(weekend? date weekend-option)
Returns true if date is in a weekend, and false otherwise
Parameter | Description | Examples |
---|---|---|
date | An instance of LocalDate /LocalDateTime or a string that can be parsed as a date | (LocalDate/of 2020 10 9) , "2020-10-10" |
weekend-option | Choice of days considered weekend days. Optional, defaults to :sat-sun | :sat-sun , :fri-sat |
Throws an ex-info if holi has no record of weekends for the year of the given date
Returns true if date is in a weekend, and false otherwise | Parameter | Description | Examples | |------------------|-------------------------------------------------------------------------------------|----------------------------------------------| | `date` | An instance of `LocalDate`/`LocalDateTime` or a string that can be parsed as a date | `(LocalDate/of 2020 10 9)`, `"2020-10-10"` | | `weekend-option` | Choice of days considered weekend days. Optional, defaults to :sat-sun | `:sat-sun`, `:fri-sat` | Throws an ex-info if holi has no record of weekends for the year of the given date
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close