Liking cljdoc? Tell your friends :D

timing.adjusters

Temporal adjusters for the Timing library - functions that adjust dates/times to specific temporal points using numeric domain arithmetic.

Temporal adjusters for the Timing library - functions that adjust dates/times
to specific temporal points using numeric domain arithmetic.
raw docstring

add-business-daysclj/s

(add-business-days value n)
(add-business-days value n {:keys [weekend-days] :or {weekend-days #{7 6}}})

Adds n business days, skipping weekends.

Adds n business days, skipping weekends.
sourceraw docstring

add-monthsclj/s

(add-months value n)

Adds n months to a time value, handling variable month lengths properly. Examples:

  • Jan 31 + 1 month = Feb 28 (Feb has fewer days)
  • Feb 29 + 12 months = Feb 28 (if target year is not a leap year)
  • Any date + n months maintains the same day when possible
Adds n months to a time value, handling variable month lengths properly.
Examples:
- Jan 31 + 1 month = Feb 28 (Feb has fewer days)
- Feb 29 + 12 months = Feb 28 (if target year is not a leap year)
- Any date + n months maintains the same day when possible
sourceraw docstring

add-yearsclj/s

(add-years value n)

Adds n years to a time value, handling leap years properly. Examples:

  • Feb 29, 2024 + 1 year = Feb 28, 2025 (2025 is not a leap year)
  • Any other date + n years maintains the same month and day
Adds n years to a time value, handling leap years properly.
Examples:
- Feb 29, 2024 + 1 year = Feb 28, 2025 (2025 is not a leap year)
- Any other date + n years maintains the same month and day
sourceraw docstring

business-days-in-rangeclj/s

(business-days-in-range start end)
(business-days-in-range start
                        end
                        {:keys [weekend-days] :or {weekend-days #{7 6}}})

Returns sequence of business days between start and end (inclusive).

Returns sequence of business days between start and end (inclusive).
sourceraw docstring

end-of-monthclj/s

(end-of-month value)

Adjusts value to the last day of the month just before midnight.

Adjusts value to the last day of the month just before midnight.
sourceraw docstring

end-of-quarterclj/s

(end-of-quarter value)

Adjusts value to the last day of the quarter.

Adjusts value to the last day of the quarter.
sourceraw docstring

end-of-weekclj/s

(end-of-week value)
(end-of-week value {:keys [first-day-of-week] :or {first-day-of-week 1}})

Adjusts value to the end of the week (Sunday by default). Options: {:first-day-of-week 7} for Sunday start

Adjusts value to the end of the week (Sunday by default).
Options: {:first-day-of-week 7} for Sunday start
sourceraw docstring

end-of-yearclj/s

(end-of-year value)

Adjusts value to December 31st just before midnight.

Adjusts value to December 31st just before midnight.
sourceraw docstring

every-nth-day-of-weekclj/s

(every-nth-day-of-week start-value target-day n)

Generates a sequence of every nth occurrence of a day-of-week. Example: Every 2nd Monday starting from a date

Generates a sequence of every nth occurrence of a day-of-week.
Example: Every 2nd Monday starting from a date
sourceraw docstring

first-day-of-month-on-day-of-weekclj/s

(first-day-of-month-on-day-of-week value target-day)

Finds the first occurrence of a day of week in the month. Example: First Monday of March 2024

Finds the first occurrence of a day of week in the month.
Example: First Monday of March 2024
sourceraw docstring

last-day-of-month-on-day-of-weekclj/s

(last-day-of-month-on-day-of-week value target-day)

Finds the last occurrence of a day of week in the month. Example: Last Friday of March 2024

Finds the last occurrence of a day of week in the month.
Example: Last Friday of March 2024
sourceraw docstring

next-business-dayclj/s

(next-business-day value)
(next-business-day value {:keys [weekend-days] :or {weekend-days #{7 6}}})

Adjusts to the next business day (Monday-Friday). Options: {:weekend-days #{6 7}} to customize weekend

Adjusts to the next business day (Monday-Friday).
Options: {:weekend-days #{6 7}} to customize weekend
sourceraw docstring

next-day-of-weekclj/s

(next-day-of-week value target-day)

Adjusts value to the next occurrence of the specified day of week. Day: 1=Monday, 2=Tuesday, ..., 7=Sunday

Adjusts value to the next occurrence of the specified day of week.
Day: 1=Monday, 2=Tuesday, ..., 7=Sunday
sourceraw docstring

next-or-same-day-of-weekclj/s

(next-or-same-day-of-week value target-day)

Adjusts value to the next occurrence of the specified day of week, or returns the same value if it's already that day.

Adjusts value to the next occurrence of the specified day of week,
or returns the same value if it's already that day.
sourceraw docstring

nth-day-of-month-on-day-of-weekclj/s

(nth-day-of-month-on-day-of-week value target-day n)

Finds the nth occurrence of a day of week in the month. Example: 3rd Tuesday of March 2024

Finds the nth occurrence of a day of week in the month.
Example: 3rd Tuesday of March 2024
sourceraw docstring

previous-business-dayclj/s

(previous-business-day value)
(previous-business-day value {:keys [weekend-days] :or {weekend-days #{7 6}}})

Adjusts to the previous business day (Monday-Friday). Options: {:weekend-days #{6 7}} to customize weekend

Adjusts to the previous business day (Monday-Friday).
Options: {:weekend-days #{6 7}} to customize weekend
sourceraw docstring

previous-day-of-weekclj/s

(previous-day-of-week value target-day)

Adjusts value to the previous occurrence of the specified day of week. Day: 1=Monday, 2=Tuesday, ..., 7=Sunday

Adjusts value to the previous occurrence of the specified day of week.
Day: 1=Monday, 2=Tuesday, ..., 7=Sunday
sourceraw docstring

start-of-monthclj/s

(start-of-month value)

Adjusts value to the first day of the month at midnight.

Adjusts value to the first day of the month at midnight.
sourceraw docstring

start-of-quarterclj/s

(start-of-quarter value)

Adjusts value to the first day of the quarter.

Adjusts value to the first day of the quarter.
sourceraw docstring

start-of-weekclj/s

(start-of-week value)
(start-of-week value {:keys [first-day-of-week] :or {first-day-of-week 1}})

Adjusts value to the start of the week (Monday by default). Options: {:first-day-of-week 7} for Sunday start

Adjusts value to the start of the week (Monday by default).
Options: {:first-day-of-week 7} for Sunday start
sourceraw docstring

start-of-yearclj/s

(start-of-year value)

Adjusts value to January 1st at midnight.

Adjusts value to January 1st at midnight.
sourceraw docstring

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

× close