Public Vars
- *clock* (clj)
- *time-literals-printing* (clj)
- + (clj)
- - (clj)
- ->AtomicClock (clj)
- ->FieldsLookup (clj)
- < (clj)
- << (clj)
- <= (clj)
- = (clj)
- > (clj)
- >= (clj)
- >> (clj)
- APRIL (clj)
- AUGUST (clj)
- AtomicClock (clj)
- DECEMBER (clj)
- FEBRUARY (clj)
- FRIDAY (clj)
- FieldsLookup (clj)
- JANUARY (clj)
- JULY (clj)
- JUNE (clj)
- MARCH (clj)
- MAY (clj)
- MONDAY (clj)
- NOVEMBER (clj)
- OCTOBER (clj)
- SATURDAY (clj)
- SEPTEMBER (clj)
- SUNDAY (clj)
- THURSDAY (clj)
- TUESDAY (clj)
- UTC (clj)
- WEDNESDAY (clj)
- ago (clj)
- at (clj)
- atom (clj)
- backward-compatible-time-span-extensions (clj)
- beginning (clj)
- between (clj)
- clock (clj)
- clock? (clj)
- coincident? (clj)
- compare-and-set! (clj)
- current-clock (clj)
- current-zone (clj)
- date (clj)
- date-time (clj)
- date-time? (clj)
- date? (clj)
- day-of-month (clj)
- day-of-week (clj)
- day-of-week-in-month (clj)
- day-of-week? (clj)
- days (clj)
- dec (clj)
- divide (clj)
- duration (clj)
- duration? (clj)
- end (clj)
- epoch (clj)
- field-map (clj)
- fields (clj)
- first-day-of-month (clj)
- first-day-of-next-month (clj)
- first-day-of-next-year (clj)
- first-day-of-year (clj)
- first-in-month (clj)
- format (clj)
- formatter (clj)
- greater (clj)
- hence (clj)
- hour (clj)
- hours (clj)
- in (clj)
- inc (clj)
- inst (clj)
- instant (clj)
- instant? (clj)
- int (clj)
- interval? (clj)
- last-day-of-month (clj)
- last-day-of-year (clj)
- last-in-month (clj)
- lesser (clj)
- long (clj)
- map->AtomicClock (clj)
- max (clj)
- max-key (clj)
- max-of-type (clj)
- micros (clj)
- microsecond (clj)
- midnight (clj)
- midnight? (clj)
- millis (clj)
- millisecond (clj)
- min (clj)
- min-key (clj)
- min-of-type (clj)
- minute (clj)
- minutes (clj)
- modify-printing-of-time-literals-if-enabled! (clj)
- month (clj)
- month? (clj)
- months (clj)
- nanos (clj)
- nanosecond (clj)
- negated (clj)
- new-date (clj)
- new-duration (clj)
- new-period (clj)
- new-time (clj)
- new-year-month (clj)
- next (clj)
- next-or-same (clj)
- noon (clj)
- now (clj)
- of-days (clj)
- of-hours (clj)
- of-micros (clj)
- of-millis (clj)
- of-minutes (clj)
- of-months (clj)
- of-nanos (clj)
- of-seconds (clj)
- of-years (clj)
- offset-by (clj)
- offset-date-time (clj)
- offset-date-time? (clj)
- on (clj)
- parse-date (clj)
- parse-date-time (clj)
- parse-day (clj)
- parse-month (clj)
- parse-offset-date-time (clj)
- parse-time (clj)
- parse-year (clj)
- parse-year-month (clj)
- parse-zoned-date-time (clj)
- period? (clj)
- predefined-formatters (clj)
- previous (clj)
- previous-or-same (clj)
- range (clj)
- reset! (clj)
- reset-vals! (clj)
- reverse-unit-map (clj)
- second (clj)
- seconds (clj)
- swap! (clj)
- swap-vals! (clj)
- tick-resolution (clj)
- time (clj)
- time? (clj)
- today (clj)
- tomorrow (clj)
- truncate (clj)
- unit-map (clj)
- units (clj)
- with (clj)
- with-clock (clj)
- year (clj)
- year-month (clj)
- year-month? (clj)
- year? (clj)
- years (clj)
- yesterday (clj)
- zone (clj)
- zone-offset (clj)
- zone-offset? (clj)
- zone? (clj)
- zoned-date-time (clj)
- zoned-date-time? (clj)
Back
years (clj)
(source)function
(years v)
extract years from 'v'
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 units-test
(is (=
{:seconds 0, :nanos 1}
(t/units (t/new-duration 1 :nanos))))
(is
(=
{:years 10, :months 0, :days 0}
(t/units (t/new-period 10 :years)))))
;; Periods. Convenience functions to create periods of specific
;; units.
(deftest period-functions-test
(is (= (t/of-days 10) (t/new-period 10 :days)))
(is (= (t/of-months 10) (t/new-period 10 :months)))
(is (= (t/of-years 10) (t/new-period 10 :years))))