now you can schedule dom.
This commit is contained in:
15
src/cljc/auto_ap/time_utils.cljc
Normal file
15
src/cljc/auto_ap/time_utils.cljc
Normal file
@@ -0,0 +1,15 @@
|
||||
(ns auto-ap.time-utils
|
||||
(:require #?(:clj [clj-time.core :as time]
|
||||
:cljs [cljs-time.core :as time])))
|
||||
|
||||
(defn next-dom [date dom]
|
||||
(when date
|
||||
(let [candidate (time/date-time (time/year date) (time/month date)
|
||||
#?(:clj (Math/min (int dom)
|
||||
(time/day (time/last-day-of-the-month (time/year date) (time/month date))))
|
||||
:cljs (Math/min dom
|
||||
(time/day (time/last-day-of-the-month (time/year date) (time/month date))))))]
|
||||
|
||||
(if (time/before? candidate date)
|
||||
(time/plus candidate (time/months 1))
|
||||
candidate))))
|
||||
Reference in New Issue
Block a user