Use n = 0
to get same or next semantics, that is:
n = 1
(ns my-app
(:require [luciolucio.holi :as holi]
[tick.core :as t]))
(holi/add (t/date "2022-07-06") 0 :business-days) ; -> 2022-07-08, because 2022-07-06 is a Saturday
(holi/add (t/date "2022-07-07") 0 :business-days) ; -> 2022-07-08, because 2022-07-07 is a Sunday
(holi/add (t/date "2022-07-08") 0 :business-days) ; -> 2022-07-08, as it's a regular Monday
This is useful in cases where you have something that relies on the day of the month, but want to avoid weekends. For example: an invoice due date is every 10th of the month. If it's a weekend, then it's due on the next business day.
(-> (t/date "2022-06-06")
(holi/add 1 :months) ; 2022-07-06, Sat
(holi/add 0 :business-days)) ; 2022-07-08, Mon
Imagine you want to keep a list of people and their birthdays, so your program can run daily and congratulate whoever celebrates their birthday that day. You could:
BIRTHDAYS
, where each line represents one person, with their birthday in the DDMMM
format(holi/holidays-in-date current-date "BIRTHDAYS")
to get everyone that celebrates their birthday each dayCan you improve this documentation?Edit on GitHub
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close