Back
new-date (clj)
(source)function
(new-date)
(new-date year month day-of-month)
(new-date year day-of-year)
(new-date epoch-day)
Examples
tick
(ns tick.api-test
(:require
[clojure.test
:refer [deftest is testing run-tests]
:refer-macros [deftest is testing run-tests]]
[tick.core :as t]
[tick.locale-en-us]
[tick.protocols :as p]
[cljc.java-time.clock]
[cljc.java-time.instant]
[cljc.java-time.day-of-week]
[cljc.java-time.month]
[cljc.java-time.year]
#?@(:cljs [[java.time :refer [Instant]]]))
#?(:clj
(:import [java.time Instant])))
(deftest constructor-test
(is (t/year? (t/year 2017)))
(is (= 2017 (cljc.java-time.year/get-value (t/year 2017))))
(is (t/month? (t/month 12)))
(is (= t/DECEMBER (t/month 12)))
(is (= (t/new-date 3030 3 3)
(t/date "3030-03-03")))
(is (-> (t/new-duration 1000 :millis)
(t/inst)
(t/instant)
(cljc.java-time.instant/to-epoch-milli)
(= 1000)))
(is (= (t/new-year-month 2020 7)
(t/year-month "2020-07"))))
teknql/wing
(ns wing.core.time-test
(:require [wing.core.time :as sut]
[clojure.test :refer [deftest testing is]]
[tick.core :as t]))
(deftest round-to-test
(testing "rounds down to a divisible value"
(is (= (t/at (t/new-date 2018 1 1) (t/new-time 1 5))
(sut/round-to (t/at (t/new-date 2018 1 1) (t/new-time 1 7))
(t/new-duration 5 :minutes))))))