diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml index eaa5df9..1a7612c 100644 --- a/.github/workflows/tests.yaml +++ b/.github/workflows/tests.yaml @@ -18,7 +18,7 @@ jobs: - name: Install clojure tools uses: DeLaGuardo/setup-clojure@4.0 with: - cli: 1.10.1.693 # Clojure CLI based on tools.deps + cli: 1.12.4.1618 # Clojure CLI based on tools.deps - name: Run Clj Unit tests run: make test-clj diff --git a/deps.edn b/deps.edn index eeae0af..58ba478 100644 --- a/deps.edn +++ b/deps.edn @@ -8,8 +8,8 @@ :extra-deps {medley/medley {:mvn/version "0.8.4"} camel-snake-kebab/camel-snake-kebab {:mvn/version "0.4.0"} org.clojure/tools.namespace {:mvn/version "0.2.11"} - org.clojure/clojure {:mvn/version "1.11.1"} - }} + org.clojure/clojure {:mvn/version "1.12.4"} + zprint/zprint {:mvn/version "1.3.0"}}} :bb {:extra-deps {tubular/tubular {:mvn/version "1.3.0"}} :extra-paths ["dev" "test"]} :test {:extra-paths ["test"] diff --git a/dev/defwrapper.clj b/dev/defwrapper.clj index 9ec98ac..1172e98 100644 --- a/dev/defwrapper.clj +++ b/dev/defwrapper.clj @@ -1,6 +1,7 @@ (ns defwrapper "based on gist by @plexus" - (:require [clojure.string :as string]) + (:require [clojure.string :as string] + [metadata]) (:import (java.time.format DateTimeFormatter) (java.time Instant) (java.lang.reflect Modifier Method))) @@ -8,6 +9,10 @@ (set! *warn-on-reflection* true) (set! *print-meta* true) +(defonce newline-placeholder + ;; Workaround to print newlines as a real newline in a file. + (str (random-uuid))) + (defn class-methods [^Class class] (seq (.getMethods class))) @@ -29,6 +34,11 @@ (defn method-name [^java.lang.reflect.Method method] (.getName method)) +(defn method-fqn [^Method method] + (-> (str method) + (string/split #" ") + peek)) + (defn class-name [^Class klazz] (let [original-name (.getName klazz)] (symbol (if (= "java.time.temporal.TemporalUnit" (.getName klazz)) @@ -42,13 +52,6 @@ (clojure.string/replace #"([a-z0-9])([A-Z])" "$1-$2") (clojure.string/lower-case))) -(defn class->name [^Class class] - (-> - (if (.isArray class) - (str (.getName (.getComponentType class)) "-array") - (.getName class)) - (string/replace "." "-"))) - (defn method-public? [^java.lang.reflect.Method method] (java.lang.reflect.Modifier/isPublic (.getModifiers method))) @@ -119,20 +122,24 @@ (symbol (apply str "." (string/lower-case f) r)))) (list (symbol (str "." nm))))) -(defn tagged-local [value tag] - (let [tag (ensure-boxed-long-double tag)] +(defn tagged-local [param-name value ^Class klazz] + (let [tag (ensure-boxed-long-double klazz)] (cond (= 'long tag) - `(long ~value) + [param-name `(~(symbol 'long) ~value)] (= 'double tag) - `(double ~value) + [param-name `(~(symbol 'double) ~value)] (= 'java.lang.Integer tag) - `(int ~value) + [param-name `(~(symbol 'int) ~value)] + + (= 'java.lang.Character tag) + [param-name `(~(symbol 'char) ~value)] :else - (vary-meta value assoc :tag (.getName tag))))) + [(vary-meta param-name assoc :tag klazz) + value]))) (defn method-call [static? klazz nam ext] (if static? @@ -145,8 +152,8 @@ (defn wrapper-multi-tail [klazz methods ext helpful?] (let [static? (method-static? (first methods)) nam (method-name (first methods)) - this (gensym "this") - arg-vec (take (parameter-count (first methods)) (repeatedly gensym)) + this 'this + arg-vec (take (parameter-count (first methods)) (map #(symbol (str "arg" %)) (range))) ret (if (apply = (map return-type methods)) (return-type (first methods)) java.lang.Object) @@ -155,23 +162,31 @@ `(~@method-call ~@(when-not static? [(tagged this klazz ext)]) ~@arg-vec) - `(cond - ~@(mapcat - (fn [method] - `[(and ~@(map (fn [sym ^Class klz] - (if (.isArray klz) - `(= ~(.getComponentType klz) - (.getComponentType (class ~sym))) - `(instance? ~(ensure-boxed (class-name klz)) ~sym))) - arg-vec - (parameter-types method))) - (let [~@(mapcat (fn [sym ^Class klz] - [sym (tagged-local sym klz)]) - arg-vec - (parameter-types method))] - (~@method-call - ~@(when-not static? [(tagged this klazz ext)]) - ~@arg-vec))]) + `(~(symbol 'cond) + ~@(mapcat + (fn [^Method method] + (let [param-names (->> (method-fqn method) + (get metadata/java-time-metadata) + (:params) + (mapv (comp symbol camel->kebab))) + _ (assert (= (count arg-vec) (count param-names)) (method-fqn method)) + conds (map (fn [sym ^Class klz] + (if (.isArray klz) + `(~(symbol '=) ~(.getComponentType klz) + (.getComponentType (~(symbol 'class) ~sym))) + `(~(symbol 'instance?) ~(ensure-boxed (class-name klz)) ~sym))) + arg-vec + (parameter-types method))] + `[~@(if (= 1 (count conds)) + conds + [(apply list 'and conds)]) + (~(symbol 'let) [~@(mapcat tagged-local + param-names + arg-vec + (parameter-types method))] + (~@method-call + ~@(when-not static? [this]) + ~@param-names))])) methods) :else (throw (IllegalArgumentException. "no corresponding java.time method with these args")))) bod (if helpful? @@ -179,7 +194,7 @@ 'cljc.java-time.extn.calendar-awareness/calendar-aware-cljs) ~bod) bod)] - `(~(tagged `[~@(when-not static? [this]) ~@arg-vec] ret ext) + `(~(tagged `[~@(when-not static? [(tagged this klazz ext)]) ~@arg-vec] ret ext) ~bod))) (defn wrapper-tail [klazz method ext helpful?] @@ -187,9 +202,15 @@ ret (return-type method) par (parameter-types method) static? (method-static? method) - arg-vec (into (if static? [] [(tagged (gensym "this") klazz ext)]) - (map #(tagged (gensym (class->name %)) % ext)) - par) + param-names (->> (method-fqn method) + (get metadata/java-time-metadata) + (:params) + (mapv (comp symbol camel->kebab))) + _ (assert (= (count par) (count param-names)) (method-fqn method)) + arg-vec (into (if static? [] [(tagged 'this klazz ext)]) + (map #(tagged %1 %2 ext) + param-names + par)) method-call (method-call static? klazz nam ext) bod `(~@method-call ~@(map #(vary-meta % dissoc :tag) arg-vec)) bod (if helpful? @@ -201,12 +222,21 @@ ~bod))) (defn method-wrapper-form [fname klazz methods ext helpful?] - (let [arities (group-by parameter-count methods) + (let [arities (into (sorted-map) (group-by parameter-count methods)) static? (method-static? (first methods))] - `(defn ~fname + `(~(symbol 'defn) ~fname + ~@(when (= 1 (count methods)) + (some->> (first methods) + (method-fqn) + (get metadata/java-time-metadata) + (:doc) + (string/trim) + (#(string/escape % {\newline newline-placeholder})) + (vector))) {:arglists '~(map (comp (partial into (if static? [] [(.getName klazz)])) #(map (fn [x] (.getName x)) %) - parameter-types) methods)} + parameter-types) + (mapcat val arities))} ~@(map (fn [[cnt meths]] (if (= 1 (count meths)) (wrapper-tail klazz (first meths) ext helpful?) @@ -223,6 +253,7 @@ (filter method-public?) (filter concrete?) (remove (set (class-methods Object))) + (sort-by method-fqn) (group-by method-name))) (def helpful-exceptions @@ -255,4 +286,4 @@ (-> (seq (.getDeclaredMethods java.time.LocalDateTime))) (method-wrapper-form "foo" java.time.LocalDateTime meths ext (contains? helpful-fns fname)) - ) \ No newline at end of file + ) diff --git a/dev/gen.clj b/dev/gen.clj index 7319eed..2a98718 100644 --- a/dev/gen.clj +++ b/dev/gen.clj @@ -1,10 +1,13 @@ (ns gen (:require [clojure.reflect :as rf] [clojure.set :as set] + [clojure.walk :as walk] [defwrapper :as df] [clojure.string :as string] [camel-snake-kebab.core :as csk] - [clojure.java.io :as io]) + [clojure.java.io :as io] + [metadata] + [zprint.core :as zprint]) (:import [java.time Period LocalDate LocalTime @@ -66,37 +69,60 @@ ) (symbol (str "^" x))))) +(defn remove-line-column-meta + [form] + (walk/postwalk + (fn [x] + (if (meta x) + (vary-meta x dissoc :line :column) + x)) + form)) + (defn gen-for-class [c sub-p ext] ;; header (println (header (.getSimpleName c) (csk/->kebab-case (.getSimpleName c)) sub-p ext)) ;; fields - (doseq [m (:members (rf/reflect c))] + (doseq [m (:members (rf/reflect c)) + :let [fqn (str (.getName c) \. (:name m)) + doc (some->> fqn + (get metadata/java-time-metadata) + (:doc) + (string/trim) + (#(string/escape % {\newline df/newline-placeholder})))]] (when (and (not (:parameter-types m)) (not-empty (set/intersection #{:public} (:flags m)))) - (println - (list 'def (csk/->kebab-case (:name m)) - (if (= :clj ext) + (prn + `(~(symbol 'def) ~(csk/->kebab-case (:name m)) + ~@(when doc [doc]) + ~(if (= :clj ext) (symbol (str (.getName c) "/" (:name m))) - (list 'goog.object/get c (str "\"" (:name m) "\""))))))) + (list 'goog.object/get c (str (:name m)))))))) ;; constructors (when (= java.time.format.DateTimeFormatterBuilder c) - (prn '(clojure.core/defn new {:arglists (quote ([]))} - (^java.time.format.DateTimeFormatterBuilder [] (java.time.format.DateTimeFormatterBuilder.))))) + (prn (remove-line-column-meta + '(defn new {:arglists (quote ([]))} + (^java.time.format.DateTimeFormatterBuilder [] (java.time.format.DateTimeFormatterBuilder.)))))) ;; methods (doseq [f (df/defwrapper c ext)] (let [f (if (= 'is-leap (second f)) - '(clojure.core/defn is-leap {:arglists (quote (["long"]))} - (^java.lang.Boolean [^long long57050] (. java.time.Year isLeap long57050))) + (remove-line-column-meta + '(defn is-leap {:arglists (quote (["long"]))} + (^java.lang.Boolean [^long year] (. java.time.Year isLeap year)))) f)] (pr f)) (println))) (defn get-and-write [c ext sub-p] - (let [f (str "./src/cljc/java_time/" (when sub-p (str sub-p "/")) (csk/->snake_case (.getSimpleName c)) "." (name ext)) - _ (io/make-parents f) - w (io/writer f)] - (binding [*out* w] - (gen-for-class c sub-p ext)))) + (let [file-name (str (csk/->snake_case (.getSimpleName c)) "." (name ext)) + f (str "./src/cljc/java_time/" (when sub-p (str sub-p "/")) file-name)] + (io/make-parents f) + (with-open [w (io/writer f)] + (binding [*out* w] + (gen-for-class c sub-p ext))) + (zprint/zprint-file f file-name f {:parse {:interpose "\n\n"}}) + (spit f (-> (slurp f) + (string/replace df/newline-placeholder "\n") + (string/replace #"\h*

" ""))))) (defn generate-library-code! [] ;todo - chrono and zone packages. needs cljs.java-time also diff --git a/dev/metadata.clj b/dev/metadata.clj new file mode 100644 index 0000000..3048a5c --- /dev/null +++ b/dev/metadata.clj @@ -0,0 +1,111 @@ +;; required in java 8 +(try + (Class/forName "com.sun.source.util.JavacTask") + (catch ClassNotFoundException _ + (require '[clojure.repl.deps]) + (clojure.repl.deps/add-lib 'com.sun/tools {:local/root (str (System/getProperty "java.home") "/../lib/tools.jar")}))) +(ns metadata + (:require [clojure.java.io :as io] + [clojure.string :as str]) + (:import (com.sun.source.tree ClassTree CompilationUnitTree MethodTree Tree$Kind VariableTree) + (com.sun.source.util DocTrees JavacTask TreePathScanner Trees) + (java.io File PrintWriter StringWriter) + (java.net URI) + (java.util.zip ZipEntry ZipFile) + (javax.tools JavaFileObject$Kind SimpleJavaFileObject ToolProvider))) + +(set! *warn-on-reflection* true) + +(defn- remove-generics + [s] + (let [s' (str/replace s #"<[^>]*>" "")] + (if (= s s') + s + (recur s')))) + +(defn- method-fqn + [package cname method] + (let [fqn (str package \. cname \. (remove-generics method)) + fqn (str/replace fqn "..." "[]")] + (case fqn + "java.lang.Enum.compareTo(E)" + "java.lang.Enum.compareTo(java.lang.Enum)" + + "java.time.temporal.ChronoUnit.addTo(R,long)" + "java.time.temporal.ChronoUnit.addTo(java.time.temporal.Temporal,long)" + + "java.time.temporal.ChronoField.adjustInto(R,long)" + "java.time.temporal.ChronoField.adjustInto(java.time.temporal.Temporal,long)" + + "java.time.temporal.TemporalUnit.addTo(R,long)" + "java.time.temporal.TemporalUnit.addTo(java.time.temporal.Temporal,long)" + + "java.time.temporal.TemporalField.adjustInto(R,long)" + "java.time.temporal.TemporalField.adjustInto(java.time.temporal.Temporal,long)" + fqn))) + +(defn get-method-metadata + "Parse Java source via JavacTask + TreePathScanner and return map of + method/constructor name → javadoc + vector of parameter-names." + [^String code] + (let [compiler (ToolProvider/getSystemJavaCompiler)] + (with-open [fm (.getStandardFileManager compiler nil nil nil)] + (let [;; hide stderr on .analyze + out (PrintWriter. (StringWriter.)) + cu (proxy [SimpleJavaFileObject] + [(URI/create "string:///_.java") JavaFileObject$Kind/SOURCE] + (getCharContent [_] code)) + ^JavacTask task (.getTask compiler out fm nil nil nil [cu]) + ^CompilationUnitTree unit (first (.parse task)) + _ (.analyze task) + trees (Trees/instance task) + doc-trees (DocTrees/instance task) + ^TreePathScanner scanner (proxy [TreePathScanner] [] + (visitVariable [^VariableTree node ctx] + (let [{:keys [result package cname]} ctx + path (.getCurrentPath ^TreePathScanner this) + ;; re-use method-fqn even if a var + fqn (method-fqn package cname (str (.getName node))) + doc (.getDocComment doc-trees path)] + (swap! result assoc fqn {:doc doc, :params nil}))) + (visitMethod [^MethodTree node ctx] + (let [{:keys [result package cname]} ctx + path (.getCurrentPath ^TreePathScanner this) + fqn (method-fqn package cname (str (.getElement trees path))) + doc (.getDocComment doc-trees path) + params (mapv #(str (.getName ^VariableTree %)) (.getParameters node))] + (swap! result assoc fqn {:doc doc, :params params})))) + result (atom {})] + (doseq [^ClassTree td (.getTypeDecls unit) + :when (instance? ClassTree td) + :let [package (.getPackageName unit) + cname (.getSimpleName td)]] + (.scan scanner unit {:result result + :package package + :cname cname}) + (when (= Tree$Kind/ENUM (.getKind td)) + (swap! result assoc + (method-fqn package cname "values()") {:doc nil, :params []} + (method-fqn package cname "valueOf(java.lang.String)") {:doc nil, :params ["name"]}))) + (into (sorted-map) @result))))) + +(defn get-java-time-metadata + "Return a single map of fully qualified method signature → javadoc + parameter-names + for all methods/constructors across the java.time package." + ([] (get-java-time-metadata (io/file (System/getProperty "java.home") "lib" "src.zip"))) + ([^File f] + (with-open [zf (ZipFile. f)] + (->> (enumeration-seq (.entries zf)) + (keep (fn [^ZipEntry e] + (let [n (.getName e)] + (when (and (str/ends-with? n ".java") + (not (str/ends-with? n "package-info.java")) + (or (str/starts-with? n "java/time/") + ;; some methods inherited from Enum, e.g., Month + (= "java/lang/Enum.java" n))) + (get-method-metadata (slurp (.getInputStream zf e))))))) + (mapcat seq) + (into (sorted-map)))))) + +(def java-time-metadata + (get-java-time-metadata (io/file (System/getProperty "java.home") ".." "src.zip"))) diff --git a/src/cljc/java_time/clock.clj b/src/cljc/java_time/clock.clj index d6c5760..7a9efb3 100644 --- a/src/cljc/java_time/clock.clj +++ b/src/cljc/java_time/clock.clj @@ -1,15 +1,208 @@ -(ns cljc.java-time.clock (:refer-clojure :exclude [abs get range format min max next name resolve short]) (:require [cljc.java-time.extn.calendar-awareness]) (:import [java.time Clock])) -(clojure.core/defn tick {:arglists (quote (["java.time.Clock" "java.time.Duration"]))} (^java.time.Clock [^java.time.Clock java-time-Clock15370 ^java.time.Duration java-time-Duration15371] (java.time.Clock/tick java-time-Clock15370 java-time-Duration15371))) -(clojure.core/defn offset {:arglists (quote (["java.time.Clock" "java.time.Duration"]))} (^java.time.Clock [^java.time.Clock java-time-Clock15372 ^java.time.Duration java-time-Duration15373] (java.time.Clock/offset java-time-Clock15372 java-time-Duration15373))) -(clojure.core/defn system-utc {:arglists (quote ([]))} (^java.time.Clock [] (java.time.Clock/systemUTC))) -(clojure.core/defn system-default-zone {:arglists (quote ([]))} (^java.time.Clock [] (java.time.Clock/systemDefaultZone))) -(clojure.core/defn fixed {:arglists (quote (["java.time.Instant" "java.time.ZoneId"]))} (^java.time.Clock [^java.time.Instant java-time-Instant15374 ^java.time.ZoneId java-time-ZoneId15375] (java.time.Clock/fixed java-time-Instant15374 java-time-ZoneId15375))) -(clojure.core/defn tick-minutes {:arglists (quote (["java.time.ZoneId"]))} (^java.time.Clock [^java.time.ZoneId java-time-ZoneId15376] (java.time.Clock/tickMinutes java-time-ZoneId15376))) -(clojure.core/defn tick-seconds {:arglists (quote (["java.time.ZoneId"]))} (^java.time.Clock [^java.time.ZoneId java-time-ZoneId15377] (java.time.Clock/tickSeconds java-time-ZoneId15377))) -(clojure.core/defn millis {:arglists (quote (["java.time.Clock"]))} (^long [^java.time.Clock this15378] (.millis this15378))) -(clojure.core/defn with-zone {:arglists (quote (["java.time.Clock" "java.time.ZoneId"]))} (^java.time.Clock [^java.time.Clock this15379 ^java.time.ZoneId java-time-ZoneId15380] (.withZone this15379 java-time-ZoneId15380))) -(clojure.core/defn get-zone {:arglists (quote (["java.time.Clock"]))} (^java.time.ZoneId [^java.time.Clock this15381] (.getZone this15381))) -(clojure.core/defn hash-code {:arglists (quote (["java.time.Clock"]))} (^java.lang.Integer [^java.time.Clock this15382] (.hashCode this15382))) -(clojure.core/defn system {:arglists (quote (["java.time.ZoneId"]))} (^java.time.Clock [^java.time.ZoneId java-time-ZoneId15383] (java.time.Clock/system java-time-ZoneId15383))) -(clojure.core/defn instant {:arglists (quote (["java.time.Clock"]))} (^java.time.Instant [^java.time.Clock this15384] (.instant this15384))) -(clojure.core/defn equals {:arglists (quote (["java.time.Clock" "java.lang.Object"]))} (^java.lang.Boolean [^java.time.Clock this15385 ^java.lang.Object java-lang-Object15386] (.equals this15385 java-lang-Object15386))) +(ns cljc.java-time.clock + (:refer-clojure :exclude + [abs get range format min max next name resolve short]) + (:require [cljc.java-time.extn.calendar-awareness]) + (:import [java.time Clock])) + +(defn tick + "Obtains a clock that returns instants from the specified clock truncated + to the nearest occurrence of the specified duration. + + This clock will only tick as per the specified duration. Thus, if the duration + is half a second, the clock will return instants truncated to the half second. + + The tick duration must be positive. If it has a part smaller than a whole + millisecond, then the whole duration must divide into one second without + leaving a remainder. All normal tick durations will match these criteria, + including any multiple of hours, minutes, seconds and milliseconds, and + sensible nanosecond durations, such as 20ns, 250,000ns and 500,000ns. + + A duration of zero or one nanosecond would have no truncation effect. + Passing one of these will return the underlying clock. + + Implementations may use a caching strategy for performance reasons. + As such, it is possible that the start of the requested duration observed + via this clock will be later than that observed directly via the underlying clock. + + The returned implementation is immutable, thread-safe and {@code Serializable} + providing that the base clock is. + + @param baseClock the base clock to base the ticking clock on, not null + @param tickDuration the duration of each visible tick, not negative, not null + @return a clock that ticks in whole units of the duration, not null + @throws IllegalArgumentException if the duration is negative, or has a + part smaller than a whole millisecond such that the whole duration is not + divisible into one second + @throws ArithmeticException if the duration is too large to be represented as nanos" + {:arglists (quote (["java.time.Clock" "java.time.Duration"]))} + (^java.time.Clock + [^java.time.Clock base-clock ^java.time.Duration tick-duration] + (java.time.Clock/tick base-clock tick-duration))) + +(defn offset + "Obtains a clock that returns instants from the specified clock with the + specified duration added + + This clock wraps another clock, returning instants that are later by the + specified duration. If the duration is negative, the instants will be + earlier than the current date and time. + The main use case for this is to simulate running in the future or in the past. + + A duration of zero would have no offsetting effect. + Passing zero will return the underlying clock. + + The returned implementation is immutable, thread-safe and {@code Serializable} + providing that the base clock is. + + @param baseClock the base clock to add the duration to, not null + @param offsetDuration the duration to add, not null + @return a clock based on the base clock with the duration added, not null" + {:arglists (quote (["java.time.Clock" "java.time.Duration"]))} + (^java.time.Clock + [^java.time.Clock base-clock ^java.time.Duration offset-duration] + (java.time.Clock/offset base-clock offset-duration))) + +(defn system-utc + "Obtains a clock that returns the current instant using the best available + system clock, converting to date and time using the UTC time-zone. + + This clock, rather than {@link #systemDefaultZone()}, should be used when + you need the current instant without the date or time. + + This clock is based on the best available system clock. + This may use {@link System#currentTimeMillis()}, or a higher resolution + clock if one is available. + + Conversion from instant to date or time uses the {@linkplain ZoneOffset#UTC UTC time-zone}. + + The returned implementation is immutable, thread-safe and {@code Serializable}. + It is equivalent to {@code system(ZoneOffset.UTC)}. + + @return a clock that uses the best available system clock in the UTC zone, not null" + {:arglists (quote ([]))} + (^java.time.Clock [] (java.time.Clock/systemUTC))) + +(defn system-default-zone + "Obtains a clock that returns the current instant using the best available + system clock, converting to date and time using the default time-zone. + + This clock is based on the best available system clock. + This may use {@link System#currentTimeMillis()}, or a higher resolution + clock if one is available. + + Using this method hard codes a dependency to the default time-zone into your application. + It is recommended to avoid this and use a specific time-zone whenever possible. + The {@link #systemUTC() UTC clock} should be used when you need the current instant + without the date or time. + + The returned implementation is immutable, thread-safe and {@code Serializable}. + It is equivalent to {@code system(ZoneId.systemDefault())}. + + @return a clock that uses the best available system clock in the default zone, not null + @see ZoneId#systemDefault()" + {:arglists (quote ([]))} + (^java.time.Clock [] (java.time.Clock/systemDefaultZone))) + +(defn fixed + "Obtains a clock that always returns the same instant. + + This clock simply returns the specified instant. + As such, it is not a clock in the conventional sense. + The main use case for this is in testing, where the fixed clock ensures + tests are not dependent on the current clock. + + The returned implementation is immutable, thread-safe and {@code Serializable}. + + @param fixedInstant the instant to use as the clock, not null + @param zone the time-zone to use to convert the instant to date-time, not null + @return a clock that always returns the same instant, not null" + {:arglists (quote (["java.time.Instant" "java.time.ZoneId"]))} + (^java.time.Clock [^java.time.Instant fixed-instant ^java.time.ZoneId zone] + (java.time.Clock/fixed fixed-instant zone))) + +(defn tick-minutes + "Obtains a clock that returns the current instant ticking in whole minutes + using best available system clock. + + This clock will always have the nano-of-second and second-of-minute fields set to zero. + This ensures that the visible time ticks in whole minutes. + The underlying clock is the best available system clock, equivalent to + using {@link #system(ZoneId)}. + + Implementations may use a caching strategy for performance reasons. + As such, it is possible that the start of the minute observed via this + clock will be later than that observed directly via the underlying clock. + + The returned implementation is immutable, thread-safe and {@code Serializable}. + It is equivalent to {@code tick(system(zone), Duration.ofMinutes(1))}. + + @param zone the time-zone to use to convert the instant to date-time, not null + @return a clock that ticks in whole minutes using the specified zone, not null" + {:arglists (quote (["java.time.ZoneId"]))} + (^java.time.Clock [^java.time.ZoneId zone] + (java.time.Clock/tickMinutes zone))) + +(defn tick-seconds + "Obtains a clock that returns the current instant ticking in whole seconds + using best available system clock. + + This clock will always have the nano-of-second field set to zero. + This ensures that the visible time ticks in whole seconds. + The underlying clock is the best available system clock, equivalent to + using {@link #system(ZoneId)}. + + Implementations may use a caching strategy for performance reasons. + As such, it is possible that the start of the second observed via this + clock will be later than that observed directly via the underlying clock. + + The returned implementation is immutable, thread-safe and {@code Serializable}. + It is equivalent to {@code tick(system(zone), Duration.ofSeconds(1))}. + + @param zone the time-zone to use to convert the instant to date-time, not null + @return a clock that ticks in whole seconds using the specified zone, not null" + {:arglists (quote (["java.time.ZoneId"]))} + (^java.time.Clock [^java.time.ZoneId zone] + (java.time.Clock/tickSeconds zone))) + +(defn millis + {:arglists (quote (["java.time.Clock"]))} + (^long [^java.time.Clock this] (.millis this))) + +(defn with-zone + {:arglists (quote (["java.time.Clock" "java.time.ZoneId"]))} + (^java.time.Clock [^java.time.Clock this ^java.time.ZoneId zone] + (.withZone this zone))) + +(defn get-zone + {:arglists (quote (["java.time.Clock"]))} + (^java.time.ZoneId [^java.time.Clock this] (.getZone this))) + +(defn hash-code + {:arglists (quote (["java.time.Clock"]))} + (^java.lang.Integer [^java.time.Clock this] (.hashCode this))) + +(defn system + "Obtains a clock that returns the current instant using best available + system clock. + + This clock is based on the best available system clock. + This may use {@link System#currentTimeMillis()}, or a higher resolution + clock if one is available. + + Conversion from instant to date or time uses the specified time-zone. + + The returned implementation is immutable, thread-safe and {@code Serializable}. + + @param zone the time-zone to use to convert the instant to date-time, not null + @return a clock that uses the best available system clock in the specified zone, not null" + {:arglists (quote (["java.time.ZoneId"]))} + (^java.time.Clock [^java.time.ZoneId zone] (java.time.Clock/system zone))) + +(defn instant + {:arglists (quote (["java.time.Clock"]))} + (^java.time.Instant [^java.time.Clock this] (.instant this))) + +(defn equals + {:arglists (quote (["java.time.Clock" "java.lang.Object"]))} + (^java.lang.Boolean [^java.time.Clock this ^java.lang.Object obj] + (.equals this obj))) diff --git a/src/cljc/java_time/clock.cljs b/src/cljc/java_time/clock.cljs index c86f2cc..3a37c73 100644 --- a/src/cljc/java_time/clock.cljs +++ b/src/cljc/java_time/clock.cljs @@ -1,15 +1,209 @@ -(ns cljc.java-time.clock (:refer-clojure :exclude [abs get range format min max next name resolve short]) (:require [cljc.java-time.extn.calendar-awareness] [goog.object] [java.time :refer [Clock]])) -(clojure.core/defn tick {:arglists (quote (["java.time.Clock" "java.time.Duration"]))} (^js/JSJoda.Clock [^js/JSJoda.Clock java-time-Clock15387 ^js/JSJoda.Duration java-time-Duration15388] (js-invoke java.time.Clock "tick" java-time-Clock15387 java-time-Duration15388))) -(clojure.core/defn offset {:arglists (quote (["java.time.Clock" "java.time.Duration"]))} (^js/JSJoda.Clock [^js/JSJoda.Clock java-time-Clock15389 ^js/JSJoda.Duration java-time-Duration15390] (js-invoke java.time.Clock "offset" java-time-Clock15389 java-time-Duration15390))) -(clojure.core/defn system-utc {:arglists (quote ([]))} (^js/JSJoda.Clock [] (js-invoke java.time.Clock "systemUTC"))) -(clojure.core/defn system-default-zone {:arglists (quote ([]))} (^js/JSJoda.Clock [] (js-invoke java.time.Clock "systemDefaultZone"))) -(clojure.core/defn fixed {:arglists (quote (["java.time.Instant" "java.time.ZoneId"]))} (^js/JSJoda.Clock [^js/JSJoda.Instant java-time-Instant15391 ^js/JSJoda.ZoneId java-time-ZoneId15392] (js-invoke java.time.Clock "fixed" java-time-Instant15391 java-time-ZoneId15392))) -(clojure.core/defn tick-minutes {:arglists (quote (["java.time.ZoneId"]))} (^js/JSJoda.Clock [^js/JSJoda.ZoneId java-time-ZoneId15393] (js-invoke java.time.Clock "tickMinutes" java-time-ZoneId15393))) -(clojure.core/defn tick-seconds {:arglists (quote (["java.time.ZoneId"]))} (^js/JSJoda.Clock [^js/JSJoda.ZoneId java-time-ZoneId15394] (js-invoke java.time.Clock "tickSeconds" java-time-ZoneId15394))) -(clojure.core/defn millis {:arglists (quote (["java.time.Clock"]))} (^long [^js/JSJoda.Clock this15395] (.millis this15395))) -(clojure.core/defn with-zone {:arglists (quote (["java.time.Clock" "java.time.ZoneId"]))} (^js/JSJoda.Clock [^js/JSJoda.Clock this15396 ^js/JSJoda.ZoneId java-time-ZoneId15397] (.withZone this15396 java-time-ZoneId15397))) -(clojure.core/defn get-zone {:arglists (quote (["java.time.Clock"]))} (^js/JSJoda.ZoneId [^js/JSJoda.Clock this15398] (.zone this15398))) -(clojure.core/defn hash-code {:arglists (quote (["java.time.Clock"]))} (^int [^js/JSJoda.Clock this15399] (.hashCode this15399))) -(clojure.core/defn system {:arglists (quote (["java.time.ZoneId"]))} (^js/JSJoda.Clock [^js/JSJoda.ZoneId java-time-ZoneId15400] (js-invoke java.time.Clock "system" java-time-ZoneId15400))) -(clojure.core/defn instant {:arglists (quote (["java.time.Clock"]))} (^js/JSJoda.Instant [^js/JSJoda.Clock this15401] (.instant this15401))) -(clojure.core/defn equals {:arglists (quote (["java.time.Clock" "java.lang.Object"]))} (^boolean [^js/JSJoda.Clock this15402 ^java.lang.Object java-lang-Object15403] (.equals this15402 java-lang-Object15403))) +(ns cljc.java-time.clock + (:refer-clojure :exclude + [abs get range format min max next name resolve short]) + (:require [cljc.java-time.extn.calendar-awareness] + [goog.object] + [java.time :refer [Clock]])) + +(defn tick + "Obtains a clock that returns instants from the specified clock truncated + to the nearest occurrence of the specified duration. + + This clock will only tick as per the specified duration. Thus, if the duration + is half a second, the clock will return instants truncated to the half second. + + The tick duration must be positive. If it has a part smaller than a whole + millisecond, then the whole duration must divide into one second without + leaving a remainder. All normal tick durations will match these criteria, + including any multiple of hours, minutes, seconds and milliseconds, and + sensible nanosecond durations, such as 20ns, 250,000ns and 500,000ns. + + A duration of zero or one nanosecond would have no truncation effect. + Passing one of these will return the underlying clock. + + Implementations may use a caching strategy for performance reasons. + As such, it is possible that the start of the requested duration observed + via this clock will be later than that observed directly via the underlying clock. + + The returned implementation is immutable, thread-safe and {@code Serializable} + providing that the base clock is. + + @param baseClock the base clock to base the ticking clock on, not null + @param tickDuration the duration of each visible tick, not negative, not null + @return a clock that ticks in whole units of the duration, not null + @throws IllegalArgumentException if the duration is negative, or has a + part smaller than a whole millisecond such that the whole duration is not + divisible into one second + @throws ArithmeticException if the duration is too large to be represented as nanos" + {:arglists (quote (["java.time.Clock" "java.time.Duration"]))} + (^js/JSJoda.Clock + [^js/JSJoda.Clock base-clock ^js/JSJoda.Duration tick-duration] + (js-invoke java.time.Clock "tick" base-clock tick-duration))) + +(defn offset + "Obtains a clock that returns instants from the specified clock with the + specified duration added + + This clock wraps another clock, returning instants that are later by the + specified duration. If the duration is negative, the instants will be + earlier than the current date and time. + The main use case for this is to simulate running in the future or in the past. + + A duration of zero would have no offsetting effect. + Passing zero will return the underlying clock. + + The returned implementation is immutable, thread-safe and {@code Serializable} + providing that the base clock is. + + @param baseClock the base clock to add the duration to, not null + @param offsetDuration the duration to add, not null + @return a clock based on the base clock with the duration added, not null" + {:arglists (quote (["java.time.Clock" "java.time.Duration"]))} + (^js/JSJoda.Clock + [^js/JSJoda.Clock base-clock ^js/JSJoda.Duration offset-duration] + (js-invoke java.time.Clock "offset" base-clock offset-duration))) + +(defn system-utc + "Obtains a clock that returns the current instant using the best available + system clock, converting to date and time using the UTC time-zone. + + This clock, rather than {@link #systemDefaultZone()}, should be used when + you need the current instant without the date or time. + + This clock is based on the best available system clock. + This may use {@link System#currentTimeMillis()}, or a higher resolution + clock if one is available. + + Conversion from instant to date or time uses the {@linkplain ZoneOffset#UTC UTC time-zone}. + + The returned implementation is immutable, thread-safe and {@code Serializable}. + It is equivalent to {@code system(ZoneOffset.UTC)}. + + @return a clock that uses the best available system clock in the UTC zone, not null" + {:arglists (quote ([]))} + (^js/JSJoda.Clock [] (js-invoke java.time.Clock "systemUTC"))) + +(defn system-default-zone + "Obtains a clock that returns the current instant using the best available + system clock, converting to date and time using the default time-zone. + + This clock is based on the best available system clock. + This may use {@link System#currentTimeMillis()}, or a higher resolution + clock if one is available. + + Using this method hard codes a dependency to the default time-zone into your application. + It is recommended to avoid this and use a specific time-zone whenever possible. + The {@link #systemUTC() UTC clock} should be used when you need the current instant + without the date or time. + + The returned implementation is immutable, thread-safe and {@code Serializable}. + It is equivalent to {@code system(ZoneId.systemDefault())}. + + @return a clock that uses the best available system clock in the default zone, not null + @see ZoneId#systemDefault()" + {:arglists (quote ([]))} + (^js/JSJoda.Clock [] (js-invoke java.time.Clock "systemDefaultZone"))) + +(defn fixed + "Obtains a clock that always returns the same instant. + + This clock simply returns the specified instant. + As such, it is not a clock in the conventional sense. + The main use case for this is in testing, where the fixed clock ensures + tests are not dependent on the current clock. + + The returned implementation is immutable, thread-safe and {@code Serializable}. + + @param fixedInstant the instant to use as the clock, not null + @param zone the time-zone to use to convert the instant to date-time, not null + @return a clock that always returns the same instant, not null" + {:arglists (quote (["java.time.Instant" "java.time.ZoneId"]))} + (^js/JSJoda.Clock [^js/JSJoda.Instant fixed-instant ^js/JSJoda.ZoneId zone] + (js-invoke java.time.Clock "fixed" fixed-instant zone))) + +(defn tick-minutes + "Obtains a clock that returns the current instant ticking in whole minutes + using best available system clock. + + This clock will always have the nano-of-second and second-of-minute fields set to zero. + This ensures that the visible time ticks in whole minutes. + The underlying clock is the best available system clock, equivalent to + using {@link #system(ZoneId)}. + + Implementations may use a caching strategy for performance reasons. + As such, it is possible that the start of the minute observed via this + clock will be later than that observed directly via the underlying clock. + + The returned implementation is immutable, thread-safe and {@code Serializable}. + It is equivalent to {@code tick(system(zone), Duration.ofMinutes(1))}. + + @param zone the time-zone to use to convert the instant to date-time, not null + @return a clock that ticks in whole minutes using the specified zone, not null" + {:arglists (quote (["java.time.ZoneId"]))} + (^js/JSJoda.Clock [^js/JSJoda.ZoneId zone] + (js-invoke java.time.Clock "tickMinutes" zone))) + +(defn tick-seconds + "Obtains a clock that returns the current instant ticking in whole seconds + using best available system clock. + + This clock will always have the nano-of-second field set to zero. + This ensures that the visible time ticks in whole seconds. + The underlying clock is the best available system clock, equivalent to + using {@link #system(ZoneId)}. + + Implementations may use a caching strategy for performance reasons. + As such, it is possible that the start of the second observed via this + clock will be later than that observed directly via the underlying clock. + + The returned implementation is immutable, thread-safe and {@code Serializable}. + It is equivalent to {@code tick(system(zone), Duration.ofSeconds(1))}. + + @param zone the time-zone to use to convert the instant to date-time, not null + @return a clock that ticks in whole seconds using the specified zone, not null" + {:arglists (quote (["java.time.ZoneId"]))} + (^js/JSJoda.Clock [^js/JSJoda.ZoneId zone] + (js-invoke java.time.Clock "tickSeconds" zone))) + +(defn millis + {:arglists (quote (["java.time.Clock"]))} + (^long [^js/JSJoda.Clock this] (.millis this))) + +(defn with-zone + {:arglists (quote (["java.time.Clock" "java.time.ZoneId"]))} + (^js/JSJoda.Clock [^js/JSJoda.Clock this ^js/JSJoda.ZoneId zone] + (.withZone this zone))) + +(defn get-zone + {:arglists (quote (["java.time.Clock"]))} + (^js/JSJoda.ZoneId [^js/JSJoda.Clock this] (.zone this))) + +(defn hash-code + {:arglists (quote (["java.time.Clock"]))} + (^int [^js/JSJoda.Clock this] (.hashCode this))) + +(defn system + "Obtains a clock that returns the current instant using best available + system clock. + + This clock is based on the best available system clock. + This may use {@link System#currentTimeMillis()}, or a higher resolution + clock if one is available. + + Conversion from instant to date or time uses the specified time-zone. + + The returned implementation is immutable, thread-safe and {@code Serializable}. + + @param zone the time-zone to use to convert the instant to date-time, not null + @return a clock that uses the best available system clock in the specified zone, not null" + {:arglists (quote (["java.time.ZoneId"]))} + (^js/JSJoda.Clock [^js/JSJoda.ZoneId zone] + (js-invoke java.time.Clock "system" zone))) + +(defn instant + {:arglists (quote (["java.time.Clock"]))} + (^js/JSJoda.Instant [^js/JSJoda.Clock this] (.instant this))) + +(defn equals + {:arglists (quote (["java.time.Clock" "java.lang.Object"]))} + (^boolean [^js/JSJoda.Clock this ^java.lang.Object obj] (.equals this obj))) diff --git a/src/cljc/java_time/day_of_week.clj b/src/cljc/java_time/day_of_week.clj index de77e03..8c4cb9a 100644 --- a/src/cljc/java_time/day_of_week.clj +++ b/src/cljc/java_time/day_of_week.clj @@ -1,29 +1,396 @@ -(ns cljc.java-time.day-of-week (:refer-clojure :exclude [abs get range format min max next name resolve short]) (:require [cljc.java-time.extn.calendar-awareness]) (:import [java.time DayOfWeek])) -(def saturday java.time.DayOfWeek/SATURDAY) -(def thursday java.time.DayOfWeek/THURSDAY) -(def friday java.time.DayOfWeek/FRIDAY) -(def wednesday java.time.DayOfWeek/WEDNESDAY) -(def sunday java.time.DayOfWeek/SUNDAY) -(def monday java.time.DayOfWeek/MONDAY) -(def tuesday java.time.DayOfWeek/TUESDAY) -(clojure.core/defn range {:arglists (quote (["java.time.DayOfWeek" "java.time.temporal.TemporalField"]))} (^java.time.temporal.ValueRange [^java.time.DayOfWeek this14504 ^java.time.temporal.TemporalField java-time-temporal-TemporalField14505] (.range this14504 java-time-temporal-TemporalField14505))) -(clojure.core/defn values {:arglists (quote ([]))} (^"java.lang.Class" [] (java.time.DayOfWeek/values))) -(clojure.core/defn value-of {:arglists (quote (["java.lang.String"] ["java.lang.Class" "java.lang.String"]))} (^java.time.DayOfWeek [^java.lang.String java-lang-String14506] (java.time.DayOfWeek/valueOf java-lang-String14506)) (^java.lang.Enum [^java.lang.Class java-lang-Class14507 ^java.lang.String java-lang-String14508] (java.time.DayOfWeek/valueOf java-lang-Class14507 java-lang-String14508))) -(clojure.core/defn of {:arglists (quote (["int"]))} (^java.time.DayOfWeek [^java.lang.Integer int14509] (java.time.DayOfWeek/of int14509))) -(clojure.core/defn ordinal {:arglists (quote (["java.time.DayOfWeek"]))} (^java.lang.Integer [^java.time.DayOfWeek this14510] (.ordinal this14510))) -(clojure.core/defn plus {:arglists (quote (["java.time.DayOfWeek" "long"]))} (^java.time.DayOfWeek [^java.time.DayOfWeek this14511 ^long long14512] (.plus this14511 long14512))) -(clojure.core/defn query {:arglists (quote (["java.time.DayOfWeek" "java.time.temporal.TemporalQuery"]))} (^java.lang.Object [^java.time.DayOfWeek this14513 ^java.time.temporal.TemporalQuery java-time-temporal-TemporalQuery14514] (.query this14513 java-time-temporal-TemporalQuery14514))) -(clojure.core/defn to-string {:arglists (quote (["java.time.DayOfWeek"]))} (^java.lang.String [^java.time.DayOfWeek this14515] (.toString this14515))) -(clojure.core/defn minus {:arglists (quote (["java.time.DayOfWeek" "long"]))} (^java.time.DayOfWeek [^java.time.DayOfWeek this14516 ^long long14517] (.minus this14516 long14517))) -(clojure.core/defn get-display-name {:arglists (quote (["java.time.DayOfWeek" "java.time.format.TextStyle" "java.util.Locale"]))} (^java.lang.String [^java.time.DayOfWeek this14518 ^java.time.format.TextStyle java-time-format-TextStyle14519 ^java.util.Locale java-util-Locale14520] (.getDisplayName this14518 java-time-format-TextStyle14519 java-util-Locale14520))) -(clojure.core/defn get-value {:arglists (quote (["java.time.DayOfWeek"]))} (^java.lang.Integer [^java.time.DayOfWeek this14521] (.getValue this14521))) -(clojure.core/defn name {:arglists (quote (["java.time.DayOfWeek"]))} (^java.lang.String [^java.time.DayOfWeek this14522] (.name this14522))) -(clojure.core/defn get-long {:arglists (quote (["java.time.DayOfWeek" "java.time.temporal.TemporalField"]))} (^long [^java.time.DayOfWeek this14523 ^java.time.temporal.TemporalField java-time-temporal-TemporalField14524] (.getLong this14523 java-time-temporal-TemporalField14524))) -(clojure.core/defn get-declaring-class {:arglists (quote (["java.time.DayOfWeek"]))} (^java.lang.Class [^java.time.DayOfWeek this14525] (.getDeclaringClass this14525))) -(clojure.core/defn from {:arglists (quote (["java.time.temporal.TemporalAccessor"]))} (^java.time.DayOfWeek [^java.time.temporal.TemporalAccessor java-time-temporal-TemporalAccessor14526] (java.time.DayOfWeek/from java-time-temporal-TemporalAccessor14526))) -(clojure.core/defn is-supported {:arglists (quote (["java.time.DayOfWeek" "java.time.temporal.TemporalField"]))} (^java.lang.Boolean [^java.time.DayOfWeek this14527 ^java.time.temporal.TemporalField java-time-temporal-TemporalField14528] (.isSupported this14527 java-time-temporal-TemporalField14528))) -(clojure.core/defn hash-code {:arglists (quote (["java.time.DayOfWeek"]))} (^java.lang.Integer [^java.time.DayOfWeek this14529] (.hashCode this14529))) -(clojure.core/defn adjust-into {:arglists (quote (["java.time.DayOfWeek" "java.time.temporal.Temporal"]))} (^java.time.temporal.Temporal [^java.time.DayOfWeek this14530 ^java.time.temporal.Temporal java-time-temporal-Temporal14531] (.adjustInto this14530 java-time-temporal-Temporal14531))) -(clojure.core/defn compare-to {:arglists (quote (["java.time.DayOfWeek" "java.lang.Enum"]))} (^java.lang.Integer [^java.time.DayOfWeek this14532 ^java.lang.Enum java-lang-Enum14533] (.compareTo this14532 java-lang-Enum14533))) -(clojure.core/defn get {:arglists (quote (["java.time.DayOfWeek" "java.time.temporal.TemporalField"]))} (^java.lang.Integer [^java.time.DayOfWeek this14534 ^java.time.temporal.TemporalField java-time-temporal-TemporalField14535] (.get this14534 java-time-temporal-TemporalField14535))) -(clojure.core/defn equals {:arglists (quote (["java.time.DayOfWeek" "java.lang.Object"]))} (^java.lang.Boolean [^java.time.DayOfWeek this14536 ^java.lang.Object java-lang-Object14537] (.equals this14536 java-lang-Object14537))) +(ns cljc.java-time.day-of-week + (:refer-clojure :exclude + [abs get range format min max next name resolve short]) + (:require [cljc.java-time.extn.calendar-awareness]) + (:import [java.time DayOfWeek])) + +(def saturday + "The singleton instance for the day-of-week of Saturday. + This has the numeric value of {@code 6}." + java.time.DayOfWeek/SATURDAY) + +(def thursday + "The singleton instance for the day-of-week of Thursday. + This has the numeric value of {@code 4}." + java.time.DayOfWeek/THURSDAY) + +(def friday + "The singleton instance for the day-of-week of Friday. + This has the numeric value of {@code 5}." + java.time.DayOfWeek/FRIDAY) + +(def wednesday + "The singleton instance for the day-of-week of Wednesday. + This has the numeric value of {@code 3}." + java.time.DayOfWeek/WEDNESDAY) + +(def sunday + "The singleton instance for the day-of-week of Sunday. + This has the numeric value of {@code 7}." + java.time.DayOfWeek/SUNDAY) + +(def monday + "The singleton instance for the day-of-week of Monday. + This has the numeric value of {@code 1}." + java.time.DayOfWeek/MONDAY) + +(def tuesday + "The singleton instance for the day-of-week of Tuesday. + This has the numeric value of {@code 2}." + java.time.DayOfWeek/TUESDAY) + +(defn range + "Gets the range of valid values for the specified field. + + The range object expresses the minimum and maximum valid values for a field. + This day-of-week is used to enhance the accuracy of the returned range. + If it is not possible to return the range, because the field is not supported + or for some other reason, an exception is thrown. + + If the field is {@link ChronoField#DAY_OF_WEEK DAY_OF_WEEK} then the + range of the day-of-week, from 1 to 7, will be returned. + All other {@code ChronoField} instances will throw an {@code UnsupportedTemporalTypeException}. + + If the field is not a {@code ChronoField}, then the result of this method + is obtained by invoking {@code TemporalField.rangeRefinedBy(TemporalAccessor)} + passing {@code this} as the argument. + Whether the range can be obtained is determined by the field. + + @param field the field to query the range for, not null + @return the range of valid values for the field, not null + @throws DateTimeException if the range for the field cannot be obtained + @throws UnsupportedTemporalTypeException if the field is not supported" + {:arglists (quote (["java.time.DayOfWeek" + "java.time.temporal.TemporalField"]))} + (^java.time.temporal.ValueRange + [^java.time.DayOfWeek this ^java.time.temporal.TemporalField field] + (.range this field))) + +(defn values + {:arglists (quote ([]))} + (^"java.lang.Class" [] (java.time.DayOfWeek/values))) + +(defn value-of + {:arglists (quote (["java.lang.String"] + ["java.lang.Class" "java.lang.String"]))} + (^java.time.DayOfWeek [^java.lang.String name] + (java.time.DayOfWeek/valueOf name)) + (^java.lang.Enum [^java.lang.Class enum-type ^java.lang.String name] + (java.time.DayOfWeek/valueOf enum-type name))) + +(defn of + "Obtains an instance of {@code DayOfWeek} from an {@code int} value. + + {@code DayOfWeek} is an enum representing the 7 days of the week. + This factory allows the enum to be obtained from the {@code int} value. + The {@code int} value follows the ISO-8601 standard, from 1 (Monday) to 7 (Sunday). + + @param dayOfWeek the day-of-week to represent, from 1 (Monday) to 7 (Sunday) + @return the day-of-week singleton, not null + @throws DateTimeException if the day-of-week is invalid" + {:arglists (quote (["int"]))} + (^java.time.DayOfWeek [^java.lang.Integer day-of-week] + (java.time.DayOfWeek/of day-of-week))) + +(defn ordinal + "Returns the ordinal of this enumeration constant (its position + in its enum declaration, where the initial constant is assigned + an ordinal of zero). + + Most programmers will have no use for this method. It is + designed for use by sophisticated enum-based data structures, such + as {@link java.util.EnumSet} and {@link java.util.EnumMap}. + + @return the ordinal of this enumeration constant" + {:arglists (quote (["java.time.DayOfWeek"]))} + (^java.lang.Integer [^java.time.DayOfWeek this] (.ordinal this))) + +(defn plus + "Returns the day-of-week that is the specified number of days after this one. + + The calculation rolls around the end of the week from Sunday to Monday. + The specified period may be negative. + + This instance is immutable and unaffected by this method call. + + @param days the days to add, positive or negative + @return the resulting day-of-week, not null" + {:arglists (quote (["java.time.DayOfWeek" "long"]))} + (^java.time.DayOfWeek [^java.time.DayOfWeek this ^long days] + (.plus this days))) + +(defn query + "Queries this day-of-week using the specified query. + + This queries this day-of-week using the specified query strategy object. + The {@code TemporalQuery} object defines the logic to be used to + obtain the result. Read the documentation of the query to understand + what the result of this method will be. + + The result of this method is obtained by invoking the + {@link TemporalQuery#queryFrom(TemporalAccessor)} method on the + specified query passing {@code this} as the argument. + + @param the type of the result + @param query the query to invoke, not null + @return the query result, null may be returned (defined by the query) + @throws DateTimeException if unable to query (defined by the query) + @throws ArithmeticException if numeric overflow occurs (defined by the query)" + {:arglists (quote (["java.time.DayOfWeek" + "java.time.temporal.TemporalQuery"]))} + (^java.lang.Object + [^java.time.DayOfWeek this ^java.time.temporal.TemporalQuery query] + (.query this query))) + +(defn to-string + "Returns the name of this enum constant, as contained in the + declaration. This method may be overridden, though it typically + isn't necessary or desirable. An enum type should override this + method when a more \"programmer-friendly\" string form exists. + + @return the name of this enum constant" + {:arglists (quote (["java.time.DayOfWeek"]))} + (^java.lang.String [^java.time.DayOfWeek this] (.toString this))) + +(defn minus + "Returns the day-of-week that is the specified number of days before this one. + + The calculation rolls around the start of the year from Monday to Sunday. + The specified period may be negative. + + This instance is immutable and unaffected by this method call. + + @param days the days to subtract, positive or negative + @return the resulting day-of-week, not null" + {:arglists (quote (["java.time.DayOfWeek" "long"]))} + (^java.time.DayOfWeek [^java.time.DayOfWeek this ^long days] + (.minus this days))) + +(defn get-display-name + "Gets the textual representation, such as 'Mon' or 'Friday'. + + This returns the textual name used to identify the day-of-week, + suitable for presentation to the user. + The parameters control the style of the returned text and the locale. + + If no textual mapping is found then the {@link #getValue() numeric value} is returned. + + @param style the length of the text required, not null + @param locale the locale to use, not null + @return the text value of the day-of-week, not null" + {:arglists (quote (["java.time.DayOfWeek" "java.time.format.TextStyle" + "java.util.Locale"]))} + (^java.lang.String + [^java.time.DayOfWeek this ^java.time.format.TextStyle style + ^java.util.Locale locale] + (.getDisplayName this style locale))) + +(defn get-value + "Gets the day-of-week {@code int} value. + + The values are numbered following the ISO-8601 standard, from 1 (Monday) to 7 (Sunday). + See {@link java.time.temporal.WeekFields#dayOfWeek()} for localized week-numbering. + + @return the day-of-week, from 1 (Monday) to 7 (Sunday)" + {:arglists (quote (["java.time.DayOfWeek"]))} + (^java.lang.Integer [^java.time.DayOfWeek this] (.getValue this))) + +(defn name + "Returns the name of this enum constant, exactly as declared in its + enum declaration. + + Most programmers should use the {@link #toString} method in + preference to this one, as the toString method may return + a more user-friendly name. This method is designed primarily for + use in specialized situations where correctness depends on getting the + exact name, which will not vary from release to release. + + @return the name of this enum constant" + {:arglists (quote (["java.time.DayOfWeek"]))} + (^java.lang.String [^java.time.DayOfWeek this] (.name this))) + +(defn get-long + "Gets the value of the specified field from this day-of-week as a {@code long}. + + This queries this day-of-week for the value of the specified field. + If it is not possible to return the value, because the field is not supported + or for some other reason, an exception is thrown. + + If the field is {@link ChronoField#DAY_OF_WEEK DAY_OF_WEEK} then the + value of the day-of-week, from 1 to 7, will be returned. + All other {@code ChronoField} instances will throw an {@code UnsupportedTemporalTypeException}. + + If the field is not a {@code ChronoField}, then the result of this method + is obtained by invoking {@code TemporalField.getFrom(TemporalAccessor)} + passing {@code this} as the argument. Whether the value can be obtained, + and what the value represents, is determined by the field. + + @param field the field to get, not null + @return the value for the field + @throws DateTimeException if a value for the field cannot be obtained + @throws UnsupportedTemporalTypeException if the field is not supported + @throws ArithmeticException if numeric overflow occurs" + {:arglists (quote (["java.time.DayOfWeek" + "java.time.temporal.TemporalField"]))} + (^long [^java.time.DayOfWeek this ^java.time.temporal.TemporalField field] + (.getLong this field))) + +(defn get-declaring-class + "Returns the Class object corresponding to this enum constant's + enum type. Two enum constants e1 and e2 are of the + same enum type if and only if + e1.getDeclaringClass() == e2.getDeclaringClass(). + (The value returned by this method may differ from the one returned + by the {@link Object#getClass} method for enum constants with + constant-specific class bodies.) + + @return the Class object corresponding to this enum constant's + enum type" + {:arglists (quote (["java.time.DayOfWeek"]))} + (^java.lang.Class [^java.time.DayOfWeek this] (.getDeclaringClass this))) + +(defn from + "Obtains an instance of {@code DayOfWeek} from a temporal object. + + This obtains a day-of-week based on the specified temporal. + A {@code TemporalAccessor} represents an arbitrary set of date and time information, + which this factory converts to an instance of {@code DayOfWeek}. + + The conversion extracts the {@link ChronoField#DAY_OF_WEEK DAY_OF_WEEK} field. + + This method matches the signature of the functional interface {@link TemporalQuery} + allowing it to be used as a query via method reference, {@code DayOfWeek::from}. + + @param temporal the temporal object to convert, not null + @return the day-of-week, not null + @throws DateTimeException if unable to convert to a {@code DayOfWeek}" + {:arglists (quote (["java.time.temporal.TemporalAccessor"]))} + (^java.time.DayOfWeek [^java.time.temporal.TemporalAccessor temporal] + (java.time.DayOfWeek/from temporal))) + +(defn is-supported + "Checks if the specified field is supported. + + This checks if this day-of-week can be queried for the specified field. + If false, then calling the {@link #range(TemporalField) range} and + {@link #get(TemporalField) get} methods will throw an exception. + + If the field is {@link ChronoField#DAY_OF_WEEK DAY_OF_WEEK} then + this method returns true. + All other {@code ChronoField} instances will return false. + + If the field is not a {@code ChronoField}, then the result of this method + is obtained by invoking {@code TemporalField.isSupportedBy(TemporalAccessor)} + passing {@code this} as the argument. + Whether the field is supported is determined by the field. + + @param field the field to check, null returns false + @return true if the field is supported on this day-of-week, false if not" + {:arglists (quote (["java.time.DayOfWeek" + "java.time.temporal.TemporalField"]))} + (^java.lang.Boolean + [^java.time.DayOfWeek this ^java.time.temporal.TemporalField field] + (.isSupported this field))) + +(defn hash-code + "Returns a hash code for this enum constant. + + @return a hash code for this enum constant." + {:arglists (quote (["java.time.DayOfWeek"]))} + (^java.lang.Integer [^java.time.DayOfWeek this] (.hashCode this))) + +(defn adjust-into + "Adjusts the specified temporal object to have this day-of-week. + + This returns a temporal object of the same observable type as the input + with the day-of-week changed to be the same as this. + + The adjustment is equivalent to using {@link Temporal#with(TemporalField, long)} + passing {@link ChronoField#DAY_OF_WEEK} as the field. + Note that this adjusts forwards or backwards within a Monday to Sunday week. + See {@link java.time.temporal.WeekFields#dayOfWeek()} for localized week start days. + See {@code TemporalAdjuster} for other adjusters with more control, + such as {@code next(MONDAY)}. + + In most cases, it is clearer to reverse the calling pattern by using + {@link Temporal#with(TemporalAdjuster)}: +

+   // these two lines are equivalent, but the second approach is recommended
+   temporal = thisDayOfWeek.adjustInto(temporal);
+   temporal = temporal.with(thisDayOfWeek);
+ 
+ + For example, given a date that is a Wednesday, the following are output: +
+   dateOnWed.with(MONDAY);     // two days earlier
+   dateOnWed.with(TUESDAY);    // one day earlier
+   dateOnWed.with(WEDNESDAY);  // same date
+   dateOnWed.with(THURSDAY);   // one day later
+   dateOnWed.with(FRIDAY);     // two days later
+   dateOnWed.with(SATURDAY);   // three days later
+   dateOnWed.with(SUNDAY);     // four days later
+ 
+ + This instance is immutable and unaffected by this method call. + + @param temporal the target object to be adjusted, not null + @return the adjusted object, not null + @throws DateTimeException if unable to make the adjustment + @throws ArithmeticException if numeric overflow occurs" + {:arglists (quote (["java.time.DayOfWeek" "java.time.temporal.Temporal"]))} + (^java.time.temporal.Temporal + [^java.time.DayOfWeek this ^java.time.temporal.Temporal temporal] + (.adjustInto this temporal))) + +(defn compare-to + "Compares this enum with the specified object for order. Returns a + negative integer, zero, or a positive integer as this object is less + than, equal to, or greater than the specified object. + + Enum constants are only comparable to other enum constants of the + same enum type. The natural order implemented by this + method is the order in which the constants are declared." + {:arglists (quote (["java.time.DayOfWeek" "java.lang.Enum"]))} + (^java.lang.Integer [^java.time.DayOfWeek this ^java.lang.Enum o] + (.compareTo this o))) + +(defn get + "Gets the value of the specified field from this day-of-week as an {@code int}. + + This queries this day-of-week for the value of the specified field. + The returned value will always be within the valid range of values for the field. + If it is not possible to return the value, because the field is not supported + or for some other reason, an exception is thrown. + + If the field is {@link ChronoField#DAY_OF_WEEK DAY_OF_WEEK} then the + value of the day-of-week, from 1 to 7, will be returned. + All other {@code ChronoField} instances will throw an {@code UnsupportedTemporalTypeException}. + + If the field is not a {@code ChronoField}, then the result of this method + is obtained by invoking {@code TemporalField.getFrom(TemporalAccessor)} + passing {@code this} as the argument. Whether the value can be obtained, + and what the value represents, is determined by the field. + + @param field the field to get, not null + @return the value for the field, within the valid range of values + @throws DateTimeException if a value for the field cannot be obtained or + the value is outside the range of valid values for the field + @throws UnsupportedTemporalTypeException if the field is not supported or + the range of values exceeds an {@code int} + @throws ArithmeticException if numeric overflow occurs" + {:arglists (quote (["java.time.DayOfWeek" + "java.time.temporal.TemporalField"]))} + (^java.lang.Integer + [^java.time.DayOfWeek this ^java.time.temporal.TemporalField field] + (.get this field))) + +(defn equals + "Returns true if the specified object is equal to this + enum constant. + + @param other the object to be compared for equality with this object. + @return true if the specified object is equal to this + enum constant." + {:arglists (quote (["java.time.DayOfWeek" "java.lang.Object"]))} + (^java.lang.Boolean [^java.time.DayOfWeek this ^java.lang.Object other] + (.equals this other))) diff --git a/src/cljc/java_time/day_of_week.cljs b/src/cljc/java_time/day_of_week.cljs index c20c495..1528fed 100644 --- a/src/cljc/java_time/day_of_week.cljs +++ b/src/cljc/java_time/day_of_week.cljs @@ -1,29 +1,392 @@ -(ns cljc.java-time.day-of-week (:refer-clojure :exclude [abs get range format min max next name resolve short]) (:require [cljc.java-time.extn.calendar-awareness] [goog.object] [java.time :refer [DayOfWeek]])) -(def saturday (goog.object/get java.time.DayOfWeek "SATURDAY")) -(def thursday (goog.object/get java.time.DayOfWeek "THURSDAY")) -(def friday (goog.object/get java.time.DayOfWeek "FRIDAY")) -(def wednesday (goog.object/get java.time.DayOfWeek "WEDNESDAY")) -(def sunday (goog.object/get java.time.DayOfWeek "SUNDAY")) -(def monday (goog.object/get java.time.DayOfWeek "MONDAY")) -(def tuesday (goog.object/get java.time.DayOfWeek "TUESDAY")) -(clojure.core/defn range {:arglists (quote (["java.time.DayOfWeek" "java.time.temporal.TemporalField"]))} (^js/JSJoda.ValueRange [^js/JSJoda.DayOfWeek this14538 ^js/JSJoda.TemporalField java-time-temporal-TemporalField14539] (.range this14538 java-time-temporal-TemporalField14539))) -(clojure.core/defn values {:arglists (quote ([]))} (^"java.lang.Class" [] (js-invoke java.time.DayOfWeek "values"))) -(clojure.core/defn value-of {:arglists (quote (["java.lang.String"] ["java.lang.Class" "java.lang.String"]))} (^js/JSJoda.DayOfWeek [^java.lang.String java-lang-String14540] (js-invoke java.time.DayOfWeek "valueOf" java-lang-String14540)) (^java.lang.Enum [^java.lang.Class java-lang-Class14541 ^java.lang.String java-lang-String14542] (js-invoke java.time.DayOfWeek "valueOf" java-lang-Class14541 java-lang-String14542))) -(clojure.core/defn of {:arglists (quote (["int"]))} (^js/JSJoda.DayOfWeek [^int int14543] (js-invoke java.time.DayOfWeek "of" int14543))) -(clojure.core/defn ordinal {:arglists (quote (["java.time.DayOfWeek"]))} (^int [^js/JSJoda.DayOfWeek this14544] (.ordinal this14544))) -(clojure.core/defn plus {:arglists (quote (["java.time.DayOfWeek" "long"]))} (^js/JSJoda.DayOfWeek [^js/JSJoda.DayOfWeek this14545 ^long long14546] (.plus this14545 long14546))) -(clojure.core/defn query {:arglists (quote (["java.time.DayOfWeek" "java.time.temporal.TemporalQuery"]))} (^java.lang.Object [^js/JSJoda.DayOfWeek this14547 ^js/JSJoda.TemporalQuery java-time-temporal-TemporalQuery14548] (.query this14547 java-time-temporal-TemporalQuery14548))) -(clojure.core/defn to-string {:arglists (quote (["java.time.DayOfWeek"]))} (^java.lang.String [^js/JSJoda.DayOfWeek this14549] (.toString this14549))) -(clojure.core/defn minus {:arglists (quote (["java.time.DayOfWeek" "long"]))} (^js/JSJoda.DayOfWeek [^js/JSJoda.DayOfWeek this14550 ^long long14551] (.minus this14550 long14551))) -(clojure.core/defn get-display-name {:arglists (quote (["java.time.DayOfWeek" "java.time.format.TextStyle" "java.util.Locale"]))} (^java.lang.String [^js/JSJoda.DayOfWeek this14552 ^js/JSJoda.TextStyle java-time-format-TextStyle14553 ^java.util.Locale java-util-Locale14554] (.displayName this14552 java-time-format-TextStyle14553 java-util-Locale14554))) -(clojure.core/defn get-value {:arglists (quote (["java.time.DayOfWeek"]))} (^int [^js/JSJoda.DayOfWeek this14555] (.value this14555))) -(clojure.core/defn name {:arglists (quote (["java.time.DayOfWeek"]))} (^java.lang.String [^js/JSJoda.DayOfWeek this14556] (.name this14556))) -(clojure.core/defn get-long {:arglists (quote (["java.time.DayOfWeek" "java.time.temporal.TemporalField"]))} (^long [^js/JSJoda.DayOfWeek this14557 ^js/JSJoda.TemporalField java-time-temporal-TemporalField14558] (.getLong this14557 java-time-temporal-TemporalField14558))) -(clojure.core/defn get-declaring-class {:arglists (quote (["java.time.DayOfWeek"]))} (^java.lang.Class [^js/JSJoda.DayOfWeek this14559] (.declaringClass this14559))) -(clojure.core/defn from {:arglists (quote (["java.time.temporal.TemporalAccessor"]))} (^js/JSJoda.DayOfWeek [^js/JSJoda.TemporalAccessor java-time-temporal-TemporalAccessor14560] (js-invoke java.time.DayOfWeek "from" java-time-temporal-TemporalAccessor14560))) -(clojure.core/defn is-supported {:arglists (quote (["java.time.DayOfWeek" "java.time.temporal.TemporalField"]))} (^boolean [^js/JSJoda.DayOfWeek this14561 ^js/JSJoda.TemporalField java-time-temporal-TemporalField14562] (.isSupported this14561 java-time-temporal-TemporalField14562))) -(clojure.core/defn hash-code {:arglists (quote (["java.time.DayOfWeek"]))} (^int [^js/JSJoda.DayOfWeek this14563] (.hashCode this14563))) -(clojure.core/defn adjust-into {:arglists (quote (["java.time.DayOfWeek" "java.time.temporal.Temporal"]))} (^js/JSJoda.Temporal [^js/JSJoda.DayOfWeek this14564 ^js/JSJoda.Temporal java-time-temporal-Temporal14565] (.adjustInto this14564 java-time-temporal-Temporal14565))) -(clojure.core/defn compare-to {:arglists (quote (["java.time.DayOfWeek" "java.lang.Enum"]))} (^int [^js/JSJoda.DayOfWeek this14566 ^java.lang.Enum java-lang-Enum14567] (.compareTo this14566 java-lang-Enum14567))) -(clojure.core/defn get {:arglists (quote (["java.time.DayOfWeek" "java.time.temporal.TemporalField"]))} (^int [^js/JSJoda.DayOfWeek this14568 ^js/JSJoda.TemporalField java-time-temporal-TemporalField14569] (.get this14568 java-time-temporal-TemporalField14569))) -(clojure.core/defn equals {:arglists (quote (["java.time.DayOfWeek" "java.lang.Object"]))} (^boolean [^js/JSJoda.DayOfWeek this14570 ^java.lang.Object java-lang-Object14571] (.equals this14570 java-lang-Object14571))) +(ns cljc.java-time.day-of-week + (:refer-clojure :exclude + [abs get range format min max next name resolve short]) + (:require [cljc.java-time.extn.calendar-awareness] + [goog.object] + [java.time :refer [DayOfWeek]])) + +(def saturday + "The singleton instance for the day-of-week of Saturday. + This has the numeric value of {@code 6}." + (goog.object/get java.time.DayOfWeek "SATURDAY")) + +(def thursday + "The singleton instance for the day-of-week of Thursday. + This has the numeric value of {@code 4}." + (goog.object/get java.time.DayOfWeek "THURSDAY")) + +(def friday + "The singleton instance for the day-of-week of Friday. + This has the numeric value of {@code 5}." + (goog.object/get java.time.DayOfWeek "FRIDAY")) + +(def wednesday + "The singleton instance for the day-of-week of Wednesday. + This has the numeric value of {@code 3}." + (goog.object/get java.time.DayOfWeek "WEDNESDAY")) + +(def sunday + "The singleton instance for the day-of-week of Sunday. + This has the numeric value of {@code 7}." + (goog.object/get java.time.DayOfWeek "SUNDAY")) + +(def monday + "The singleton instance for the day-of-week of Monday. + This has the numeric value of {@code 1}." + (goog.object/get java.time.DayOfWeek "MONDAY")) + +(def tuesday + "The singleton instance for the day-of-week of Tuesday. + This has the numeric value of {@code 2}." + (goog.object/get java.time.DayOfWeek "TUESDAY")) + +(defn range + "Gets the range of valid values for the specified field. + + The range object expresses the minimum and maximum valid values for a field. + This day-of-week is used to enhance the accuracy of the returned range. + If it is not possible to return the range, because the field is not supported + or for some other reason, an exception is thrown. + + If the field is {@link ChronoField#DAY_OF_WEEK DAY_OF_WEEK} then the + range of the day-of-week, from 1 to 7, will be returned. + All other {@code ChronoField} instances will throw an {@code UnsupportedTemporalTypeException}. + + If the field is not a {@code ChronoField}, then the result of this method + is obtained by invoking {@code TemporalField.rangeRefinedBy(TemporalAccessor)} + passing {@code this} as the argument. + Whether the range can be obtained is determined by the field. + + @param field the field to query the range for, not null + @return the range of valid values for the field, not null + @throws DateTimeException if the range for the field cannot be obtained + @throws UnsupportedTemporalTypeException if the field is not supported" + {:arglists (quote (["java.time.DayOfWeek" + "java.time.temporal.TemporalField"]))} + (^js/JSJoda.ValueRange + [^js/JSJoda.DayOfWeek this ^js/JSJoda.TemporalField field] + (.range this field))) + +(defn values + {:arglists (quote ([]))} + (^"java.lang.Class" [] (js-invoke java.time.DayOfWeek "values"))) + +(defn value-of + {:arglists (quote (["java.lang.String"] + ["java.lang.Class" "java.lang.String"]))} + (^js/JSJoda.DayOfWeek [^java.lang.String name] + (js-invoke java.time.DayOfWeek "valueOf" name)) + (^java.lang.Enum [^java.lang.Class enum-type ^java.lang.String name] + (js-invoke java.time.DayOfWeek "valueOf" enum-type name))) + +(defn of + "Obtains an instance of {@code DayOfWeek} from an {@code int} value. + + {@code DayOfWeek} is an enum representing the 7 days of the week. + This factory allows the enum to be obtained from the {@code int} value. + The {@code int} value follows the ISO-8601 standard, from 1 (Monday) to 7 (Sunday). + + @param dayOfWeek the day-of-week to represent, from 1 (Monday) to 7 (Sunday) + @return the day-of-week singleton, not null + @throws DateTimeException if the day-of-week is invalid" + {:arglists (quote (["int"]))} + (^js/JSJoda.DayOfWeek [^int day-of-week] + (js-invoke java.time.DayOfWeek "of" day-of-week))) + +(defn ordinal + "Returns the ordinal of this enumeration constant (its position + in its enum declaration, where the initial constant is assigned + an ordinal of zero). + + Most programmers will have no use for this method. It is + designed for use by sophisticated enum-based data structures, such + as {@link java.util.EnumSet} and {@link java.util.EnumMap}. + + @return the ordinal of this enumeration constant" + {:arglists (quote (["java.time.DayOfWeek"]))} + (^int [^js/JSJoda.DayOfWeek this] (.ordinal this))) + +(defn plus + "Returns the day-of-week that is the specified number of days after this one. + + The calculation rolls around the end of the week from Sunday to Monday. + The specified period may be negative. + + This instance is immutable and unaffected by this method call. + + @param days the days to add, positive or negative + @return the resulting day-of-week, not null" + {:arglists (quote (["java.time.DayOfWeek" "long"]))} + (^js/JSJoda.DayOfWeek [^js/JSJoda.DayOfWeek this ^long days] + (.plus this days))) + +(defn query + "Queries this day-of-week using the specified query. + + This queries this day-of-week using the specified query strategy object. + The {@code TemporalQuery} object defines the logic to be used to + obtain the result. Read the documentation of the query to understand + what the result of this method will be. + + The result of this method is obtained by invoking the + {@link TemporalQuery#queryFrom(TemporalAccessor)} method on the + specified query passing {@code this} as the argument. + + @param the type of the result + @param query the query to invoke, not null + @return the query result, null may be returned (defined by the query) + @throws DateTimeException if unable to query (defined by the query) + @throws ArithmeticException if numeric overflow occurs (defined by the query)" + {:arglists (quote (["java.time.DayOfWeek" + "java.time.temporal.TemporalQuery"]))} + (^java.lang.Object [^js/JSJoda.DayOfWeek this ^js/JSJoda.TemporalQuery query] + (.query this query))) + +(defn to-string + "Returns the name of this enum constant, as contained in the + declaration. This method may be overridden, though it typically + isn't necessary or desirable. An enum type should override this + method when a more \"programmer-friendly\" string form exists. + + @return the name of this enum constant" + {:arglists (quote (["java.time.DayOfWeek"]))} + (^java.lang.String [^js/JSJoda.DayOfWeek this] (.toString this))) + +(defn minus + "Returns the day-of-week that is the specified number of days before this one. + + The calculation rolls around the start of the year from Monday to Sunday. + The specified period may be negative. + + This instance is immutable and unaffected by this method call. + + @param days the days to subtract, positive or negative + @return the resulting day-of-week, not null" + {:arglists (quote (["java.time.DayOfWeek" "long"]))} + (^js/JSJoda.DayOfWeek [^js/JSJoda.DayOfWeek this ^long days] + (.minus this days))) + +(defn get-display-name + "Gets the textual representation, such as 'Mon' or 'Friday'. + + This returns the textual name used to identify the day-of-week, + suitable for presentation to the user. + The parameters control the style of the returned text and the locale. + + If no textual mapping is found then the {@link #getValue() numeric value} is returned. + + @param style the length of the text required, not null + @param locale the locale to use, not null + @return the text value of the day-of-week, not null" + {:arglists (quote (["java.time.DayOfWeek" "java.time.format.TextStyle" + "java.util.Locale"]))} + (^java.lang.String + [^js/JSJoda.DayOfWeek this ^js/JSJoda.TextStyle style + ^java.util.Locale locale] + (.displayName this style locale))) + +(defn get-value + "Gets the day-of-week {@code int} value. + + The values are numbered following the ISO-8601 standard, from 1 (Monday) to 7 (Sunday). + See {@link java.time.temporal.WeekFields#dayOfWeek()} for localized week-numbering. + + @return the day-of-week, from 1 (Monday) to 7 (Sunday)" + {:arglists (quote (["java.time.DayOfWeek"]))} + (^int [^js/JSJoda.DayOfWeek this] (.value this))) + +(defn name + "Returns the name of this enum constant, exactly as declared in its + enum declaration. + + Most programmers should use the {@link #toString} method in + preference to this one, as the toString method may return + a more user-friendly name. This method is designed primarily for + use in specialized situations where correctness depends on getting the + exact name, which will not vary from release to release. + + @return the name of this enum constant" + {:arglists (quote (["java.time.DayOfWeek"]))} + (^java.lang.String [^js/JSJoda.DayOfWeek this] (.name this))) + +(defn get-long + "Gets the value of the specified field from this day-of-week as a {@code long}. + + This queries this day-of-week for the value of the specified field. + If it is not possible to return the value, because the field is not supported + or for some other reason, an exception is thrown. + + If the field is {@link ChronoField#DAY_OF_WEEK DAY_OF_WEEK} then the + value of the day-of-week, from 1 to 7, will be returned. + All other {@code ChronoField} instances will throw an {@code UnsupportedTemporalTypeException}. + + If the field is not a {@code ChronoField}, then the result of this method + is obtained by invoking {@code TemporalField.getFrom(TemporalAccessor)} + passing {@code this} as the argument. Whether the value can be obtained, + and what the value represents, is determined by the field. + + @param field the field to get, not null + @return the value for the field + @throws DateTimeException if a value for the field cannot be obtained + @throws UnsupportedTemporalTypeException if the field is not supported + @throws ArithmeticException if numeric overflow occurs" + {:arglists (quote (["java.time.DayOfWeek" + "java.time.temporal.TemporalField"]))} + (^long [^js/JSJoda.DayOfWeek this ^js/JSJoda.TemporalField field] + (.getLong this field))) + +(defn get-declaring-class + "Returns the Class object corresponding to this enum constant's + enum type. Two enum constants e1 and e2 are of the + same enum type if and only if + e1.getDeclaringClass() == e2.getDeclaringClass(). + (The value returned by this method may differ from the one returned + by the {@link Object#getClass} method for enum constants with + constant-specific class bodies.) + + @return the Class object corresponding to this enum constant's + enum type" + {:arglists (quote (["java.time.DayOfWeek"]))} + (^java.lang.Class [^js/JSJoda.DayOfWeek this] (.declaringClass this))) + +(defn from + "Obtains an instance of {@code DayOfWeek} from a temporal object. + + This obtains a day-of-week based on the specified temporal. + A {@code TemporalAccessor} represents an arbitrary set of date and time information, + which this factory converts to an instance of {@code DayOfWeek}. + + The conversion extracts the {@link ChronoField#DAY_OF_WEEK DAY_OF_WEEK} field. + + This method matches the signature of the functional interface {@link TemporalQuery} + allowing it to be used as a query via method reference, {@code DayOfWeek::from}. + + @param temporal the temporal object to convert, not null + @return the day-of-week, not null + @throws DateTimeException if unable to convert to a {@code DayOfWeek}" + {:arglists (quote (["java.time.temporal.TemporalAccessor"]))} + (^js/JSJoda.DayOfWeek [^js/JSJoda.TemporalAccessor temporal] + (js-invoke java.time.DayOfWeek "from" temporal))) + +(defn is-supported + "Checks if the specified field is supported. + + This checks if this day-of-week can be queried for the specified field. + If false, then calling the {@link #range(TemporalField) range} and + {@link #get(TemporalField) get} methods will throw an exception. + + If the field is {@link ChronoField#DAY_OF_WEEK DAY_OF_WEEK} then + this method returns true. + All other {@code ChronoField} instances will return false. + + If the field is not a {@code ChronoField}, then the result of this method + is obtained by invoking {@code TemporalField.isSupportedBy(TemporalAccessor)} + passing {@code this} as the argument. + Whether the field is supported is determined by the field. + + @param field the field to check, null returns false + @return true if the field is supported on this day-of-week, false if not" + {:arglists (quote (["java.time.DayOfWeek" + "java.time.temporal.TemporalField"]))} + (^boolean [^js/JSJoda.DayOfWeek this ^js/JSJoda.TemporalField field] + (.isSupported this field))) + +(defn hash-code + "Returns a hash code for this enum constant. + + @return a hash code for this enum constant." + {:arglists (quote (["java.time.DayOfWeek"]))} + (^int [^js/JSJoda.DayOfWeek this] (.hashCode this))) + +(defn adjust-into + "Adjusts the specified temporal object to have this day-of-week. + + This returns a temporal object of the same observable type as the input + with the day-of-week changed to be the same as this. + + The adjustment is equivalent to using {@link Temporal#with(TemporalField, long)} + passing {@link ChronoField#DAY_OF_WEEK} as the field. + Note that this adjusts forwards or backwards within a Monday to Sunday week. + See {@link java.time.temporal.WeekFields#dayOfWeek()} for localized week start days. + See {@code TemporalAdjuster} for other adjusters with more control, + such as {@code next(MONDAY)}. + + In most cases, it is clearer to reverse the calling pattern by using + {@link Temporal#with(TemporalAdjuster)}: +
+   // these two lines are equivalent, but the second approach is recommended
+   temporal = thisDayOfWeek.adjustInto(temporal);
+   temporal = temporal.with(thisDayOfWeek);
+ 
+ + For example, given a date that is a Wednesday, the following are output: +
+   dateOnWed.with(MONDAY);     // two days earlier
+   dateOnWed.with(TUESDAY);    // one day earlier
+   dateOnWed.with(WEDNESDAY);  // same date
+   dateOnWed.with(THURSDAY);   // one day later
+   dateOnWed.with(FRIDAY);     // two days later
+   dateOnWed.with(SATURDAY);   // three days later
+   dateOnWed.with(SUNDAY);     // four days later
+ 
+ + This instance is immutable and unaffected by this method call. + + @param temporal the target object to be adjusted, not null + @return the adjusted object, not null + @throws DateTimeException if unable to make the adjustment + @throws ArithmeticException if numeric overflow occurs" + {:arglists (quote (["java.time.DayOfWeek" "java.time.temporal.Temporal"]))} + (^js/JSJoda.Temporal [^js/JSJoda.DayOfWeek this ^js/JSJoda.Temporal temporal] + (.adjustInto this temporal))) + +(defn compare-to + "Compares this enum with the specified object for order. Returns a + negative integer, zero, or a positive integer as this object is less + than, equal to, or greater than the specified object. + + Enum constants are only comparable to other enum constants of the + same enum type. The natural order implemented by this + method is the order in which the constants are declared." + {:arglists (quote (["java.time.DayOfWeek" "java.lang.Enum"]))} + (^int [^js/JSJoda.DayOfWeek this ^java.lang.Enum o] (.compareTo this o))) + +(defn get + "Gets the value of the specified field from this day-of-week as an {@code int}. + + This queries this day-of-week for the value of the specified field. + The returned value will always be within the valid range of values for the field. + If it is not possible to return the value, because the field is not supported + or for some other reason, an exception is thrown. + + If the field is {@link ChronoField#DAY_OF_WEEK DAY_OF_WEEK} then the + value of the day-of-week, from 1 to 7, will be returned. + All other {@code ChronoField} instances will throw an {@code UnsupportedTemporalTypeException}. + + If the field is not a {@code ChronoField}, then the result of this method + is obtained by invoking {@code TemporalField.getFrom(TemporalAccessor)} + passing {@code this} as the argument. Whether the value can be obtained, + and what the value represents, is determined by the field. + + @param field the field to get, not null + @return the value for the field, within the valid range of values + @throws DateTimeException if a value for the field cannot be obtained or + the value is outside the range of valid values for the field + @throws UnsupportedTemporalTypeException if the field is not supported or + the range of values exceeds an {@code int} + @throws ArithmeticException if numeric overflow occurs" + {:arglists (quote (["java.time.DayOfWeek" + "java.time.temporal.TemporalField"]))} + (^int [^js/JSJoda.DayOfWeek this ^js/JSJoda.TemporalField field] + (.get this field))) + +(defn equals + "Returns true if the specified object is equal to this + enum constant. + + @param other the object to be compared for equality with this object. + @return true if the specified object is equal to this + enum constant." + {:arglists (quote (["java.time.DayOfWeek" "java.lang.Object"]))} + (^boolean [^js/JSJoda.DayOfWeek this ^java.lang.Object other] + (.equals this other))) diff --git a/src/cljc/java_time/duration.clj b/src/cljc/java_time/duration.clj index 0bd8d89..3fb7d37 100644 --- a/src/cljc/java_time/duration.clj +++ b/src/cljc/java_time/duration.clj @@ -1,49 +1,704 @@ -(ns cljc.java-time.duration (:refer-clojure :exclude [abs get range format min max next name resolve short]) (:require [cljc.java-time.extn.calendar-awareness]) (:import [java.time Duration])) -(def zero java.time.Duration/ZERO) -(clojure.core/defn minus-minutes {:arglists (quote (["java.time.Duration" "long"]))} (^java.time.Duration [^java.time.Duration this14936 ^long long14937] (.minusMinutes this14936 long14937))) -(clojure.core/defn to-nanos {:arglists (quote (["java.time.Duration"]))} (^long [^java.time.Duration this14938] (.toNanos this14938))) -(clojure.core/defn minus-millis {:arglists (quote (["java.time.Duration" "long"]))} (^java.time.Duration [^java.time.Duration this14939 ^long long14940] (.minusMillis this14939 long14940))) -(clojure.core/defn minus-hours {:arglists (quote (["java.time.Duration" "long"]))} (^java.time.Duration [^java.time.Duration this14941 ^long long14942] (.minusHours this14941 long14942))) -(clojure.core/defn of-days {:arglists (quote (["long"]))} (^java.time.Duration [^long long14943] (java.time.Duration/ofDays long14943))) -(clojure.core/defn is-negative {:arglists (quote (["java.time.Duration"]))} (^java.lang.Boolean [^java.time.Duration this14944] (.isNegative this14944))) -(clojure.core/defn of {:arglists (quote (["long" "java.time.temporal.TemporalUnit"]))} (^java.time.Duration [^long long14945 ^java.time.temporal.ChronoUnit java-time-temporal-TemporalUnit14946] (java.time.Duration/of long14945 java-time-temporal-TemporalUnit14946))) -(clojure.core/defn is-zero {:arglists (quote (["java.time.Duration"]))} (^java.lang.Boolean [^java.time.Duration this14947] (.isZero this14947))) -(clojure.core/defn multiplied-by {:arglists (quote (["java.time.Duration" "long"]))} (^java.time.Duration [^java.time.Duration this14948 ^long long14949] (.multipliedBy this14948 long14949))) -(clojure.core/defn with-nanos {:arglists (quote (["java.time.Duration" "int"]))} (^java.time.Duration [^java.time.Duration this14950 ^java.lang.Integer int14951] (.withNanos this14950 int14951))) -(clojure.core/defn get-units {:arglists (quote (["java.time.Duration"]))} (^java.util.List [^java.time.Duration this14952] (.getUnits this14952))) -(clojure.core/defn get-nano {:arglists (quote (["java.time.Duration"]))} (^java.lang.Integer [^java.time.Duration this14953] (.getNano this14953))) -(clojure.core/defn plus-millis {:arglists (quote (["java.time.Duration" "long"]))} (^java.time.Duration [^java.time.Duration this14954 ^long long14955] (.plusMillis this14954 long14955))) -(clojure.core/defn to-minutes {:arglists (quote (["java.time.Duration"]))} (^long [^java.time.Duration this14956] (.toMinutes this14956))) -(clojure.core/defn minus-seconds {:arglists (quote (["java.time.Duration" "long"]))} (^java.time.Duration [^java.time.Duration this14957 ^long long14958] (.minusSeconds this14957 long14958))) -(clojure.core/defn plus-nanos {:arglists (quote (["java.time.Duration" "long"]))} (^java.time.Duration [^java.time.Duration this14959 ^long long14960] (.plusNanos this14959 long14960))) -(clojure.core/defn plus {:arglists (quote (["java.time.Duration" "java.time.Duration"] ["java.time.Duration" "long" "java.time.temporal.TemporalUnit"]))} (^java.time.Duration [^java.time.Duration this14961 ^java.time.Duration java-time-Duration14962] (.plus this14961 java-time-Duration14962)) (^java.time.Duration [^java.time.Duration this14963 ^long long14964 ^java.time.temporal.ChronoUnit java-time-temporal-TemporalUnit14965] (.plus this14963 long14964 java-time-temporal-TemporalUnit14965))) -(clojure.core/defn divided-by {:arglists (quote (["java.time.Duration" "long"]))} (^java.time.Duration [^java.time.Duration this14966 ^long long14967] (.dividedBy this14966 long14967))) -(clojure.core/defn plus-minutes {:arglists (quote (["java.time.Duration" "long"]))} (^java.time.Duration [^java.time.Duration this14968 ^long long14969] (.plusMinutes this14968 long14969))) -(clojure.core/defn to-string {:arglists (quote (["java.time.Duration"]))} (^java.lang.String [^java.time.Duration this14970] (.toString this14970))) -(clojure.core/defn minus {:arglists (quote (["java.time.Duration" "java.time.Duration"] ["java.time.Duration" "long" "java.time.temporal.TemporalUnit"]))} (^java.time.Duration [^java.time.Duration this14971 ^java.time.Duration java-time-Duration14972] (.minus this14971 java-time-Duration14972)) (^java.time.Duration [^java.time.Duration this14973 ^long long14974 ^java.time.temporal.ChronoUnit java-time-temporal-TemporalUnit14975] (.minus this14973 long14974 java-time-temporal-TemporalUnit14975))) -(clojure.core/defn add-to {:arglists (quote (["java.time.Duration" "java.time.temporal.Temporal"]))} (^java.time.temporal.Temporal [^java.time.Duration this14976 ^java.time.temporal.Temporal java-time-temporal-Temporal14977] (.addTo this14976 java-time-temporal-Temporal14977))) -(clojure.core/defn plus-hours {:arglists (quote (["java.time.Duration" "long"]))} (^java.time.Duration [^java.time.Duration this14978 ^long long14979] (.plusHours this14978 long14979))) -(clojure.core/defn plus-days {:arglists (quote (["java.time.Duration" "long"]))} (^java.time.Duration [^java.time.Duration this14980 ^long long14981] (.plusDays this14980 long14981))) -(clojure.core/defn of-hours {:arglists (quote (["long"]))} (^java.time.Duration [^long long14982] (java.time.Duration/ofHours long14982))) -(clojure.core/defn to-millis {:arglists (quote (["java.time.Duration"]))} (^long [^java.time.Duration this14983] (.toMillis this14983))) -(clojure.core/defn to-hours {:arglists (quote (["java.time.Duration"]))} (^long [^java.time.Duration this14984] (.toHours this14984))) -(clojure.core/defn of-nanos {:arglists (quote (["long"]))} (^java.time.Duration [^long long14985] (java.time.Duration/ofNanos long14985))) -(clojure.core/defn of-millis {:arglists (quote (["long"]))} (^java.time.Duration [^long long14986] (java.time.Duration/ofMillis long14986))) -(clojure.core/defn negated {:arglists (quote (["java.time.Duration"]))} (^java.time.Duration [^java.time.Duration this14987] (.negated this14987))) -(clojure.core/defn abs {:arglists (quote (["java.time.Duration"]))} (^java.time.Duration [^java.time.Duration this14988] (.abs this14988))) -(clojure.core/defn between {:arglists (quote (["java.time.temporal.Temporal" "java.time.temporal.Temporal"]))} (^java.time.Duration [^java.time.temporal.Temporal java-time-temporal-Temporal14989 ^java.time.temporal.Temporal java-time-temporal-Temporal14990] (java.time.Duration/between java-time-temporal-Temporal14989 java-time-temporal-Temporal14990))) -(clojure.core/defn get-seconds {:arglists (quote (["java.time.Duration"]))} (^long [^java.time.Duration this14991] (.getSeconds this14991))) -(clojure.core/defn from {:arglists (quote (["java.time.temporal.TemporalAmount"]))} (^java.time.Duration [^java.time.temporal.TemporalAmount java-time-temporal-TemporalAmount14992] (java.time.Duration/from java-time-temporal-TemporalAmount14992))) -(clojure.core/defn minus-nanos {:arglists (quote (["java.time.Duration" "long"]))} (^java.time.Duration [^java.time.Duration this14993 ^long long14994] (.minusNanos this14993 long14994))) -(clojure.core/defn parse {:arglists (quote (["java.lang.CharSequence"]))} (^java.time.Duration [^java.lang.CharSequence java-lang-CharSequence14995] (java.time.Duration/parse java-lang-CharSequence14995))) -(clojure.core/defn hash-code {:arglists (quote (["java.time.Duration"]))} (^java.lang.Integer [^java.time.Duration this14996] (.hashCode this14996))) -(clojure.core/defn with-seconds {:arglists (quote (["java.time.Duration" "long"]))} (^java.time.Duration [^java.time.Duration this14997 ^long long14998] (.withSeconds this14997 long14998))) -(clojure.core/defn of-minutes {:arglists (quote (["long"]))} (^java.time.Duration [^long long14999] (java.time.Duration/ofMinutes long14999))) -(clojure.core/defn subtract-from {:arglists (quote (["java.time.Duration" "java.time.temporal.Temporal"]))} (^java.time.temporal.Temporal [^java.time.Duration this15000 ^java.time.temporal.Temporal java-time-temporal-Temporal15001] (.subtractFrom this15000 java-time-temporal-Temporal15001))) -(clojure.core/defn compare-to {:arglists (quote (["java.time.Duration" "java.time.Duration"]))} (^java.lang.Integer [^java.time.Duration this15002 ^java.time.Duration java-time-Duration15003] (.compareTo this15002 java-time-Duration15003))) -(clojure.core/defn plus-seconds {:arglists (quote (["java.time.Duration" "long"]))} (^java.time.Duration [^java.time.Duration this15004 ^long long15005] (.plusSeconds this15004 long15005))) -(clojure.core/defn get {:arglists (quote (["java.time.Duration" "java.time.temporal.TemporalUnit"]))} (^long [^java.time.Duration this15006 ^java.time.temporal.ChronoUnit java-time-temporal-TemporalUnit15007] (.get this15006 java-time-temporal-TemporalUnit15007))) -(clojure.core/defn equals {:arglists (quote (["java.time.Duration" "java.lang.Object"]))} (^java.lang.Boolean [^java.time.Duration this15008 ^java.lang.Object java-lang-Object15009] (.equals this15008 java-lang-Object15009))) -(clojure.core/defn of-seconds {:arglists (quote (["long" "long"] ["long"]))} (^java.time.Duration [^long long15010 ^long long15011] (java.time.Duration/ofSeconds long15010 long15011)) (^java.time.Duration [^long long15012] (java.time.Duration/ofSeconds long15012))) -(clojure.core/defn minus-days {:arglists (quote (["java.time.Duration" "long"]))} (^java.time.Duration [^java.time.Duration this15013 ^long long15014] (.minusDays this15013 long15014))) -(clojure.core/defn to-days {:arglists (quote (["java.time.Duration"]))} (^long [^java.time.Duration this15015] (.toDays this15015))) +(ns cljc.java-time.duration + (:refer-clojure :exclude + [abs get range format min max next name resolve short]) + (:require [cljc.java-time.extn.calendar-awareness]) + (:import [java.time Duration])) + +(def zero "Constant for a duration of zero." java.time.Duration/ZERO) + +(defn minus-minutes + "Returns a copy of this duration with the specified duration in minutes subtracted. + + The number of hours is multiplied by 60 to obtain the number of seconds to subtract. + + This instance is immutable and unaffected by this method call. + + @param minutesToSubtract the minutes to subtract, positive or negative + @return a {@code Duration} based on this duration with the specified minutes subtracted, not null + @throws ArithmeticException if numeric overflow occurs" + {:arglists (quote (["java.time.Duration" "long"]))} + (^java.time.Duration [^java.time.Duration this ^long minutes-to-subtract] + (.minusMinutes this minutes-to-subtract))) + +(defn to-nanos + "Converts this duration to the total length in nanoseconds expressed as a {@code long}. + + If this duration is too large to fit in a {@code long} nanoseconds, then an + exception is thrown. + + @return the total length of the duration in nanoseconds + @throws ArithmeticException if numeric overflow occurs" + {:arglists (quote (["java.time.Duration"]))} + (^long [^java.time.Duration this] (.toNanos this))) + +(defn minus-millis + "Returns a copy of this duration with the specified duration in milliseconds subtracted. + + This instance is immutable and unaffected by this method call. + + @param millisToSubtract the milliseconds to subtract, positive or negative + @return a {@code Duration} based on this duration with the specified milliseconds subtracted, not null + @throws ArithmeticException if numeric overflow occurs" + {:arglists (quote (["java.time.Duration" "long"]))} + (^java.time.Duration [^java.time.Duration this ^long millis-to-subtract] + (.minusMillis this millis-to-subtract))) + +(defn minus-hours + "Returns a copy of this duration with the specified duration in hours subtracted. + + The number of hours is multiplied by 3600 to obtain the number of seconds to subtract. + + This instance is immutable and unaffected by this method call. + + @param hoursToSubtract the hours to subtract, positive or negative + @return a {@code Duration} based on this duration with the specified hours subtracted, not null + @throws ArithmeticException if numeric overflow occurs" + {:arglists (quote (["java.time.Duration" "long"]))} + (^java.time.Duration [^java.time.Duration this ^long hours-to-subtract] + (.minusHours this hours-to-subtract))) + +(defn of-days + "Obtains a {@code Duration} representing a number of standard 24 hour days. + + The seconds are calculated based on the standard definition of a day, + where each day is 86400 seconds which implies a 24 hour day. + The nanosecond in second field is set to zero. + + @param days the number of days, positive or negative + @return a {@code Duration}, not null + @throws ArithmeticException if the input days exceeds the capacity of {@code Duration}" + {:arglists (quote (["long"]))} + (^java.time.Duration [^long days] (java.time.Duration/ofDays days))) + +(defn is-negative + "Checks if this duration is negative, excluding zero. + + A {@code Duration} represents a directed distance between two points on + the time-line and can therefore be positive, zero or negative. + This method checks whether the length is less than zero. + + @return true if this duration has a total length less than zero" + {:arglists (quote (["java.time.Duration"]))} + (^java.lang.Boolean [^java.time.Duration this] (.isNegative this))) + +(defn of + "Obtains a {@code Duration} representing an amount in the specified unit. + + The parameters represent the two parts of a phrase like '6 Hours'. For example: +
+  Duration.of(3, SECONDS);
+  Duration.of(465, HOURS);
+ 
+ Only a subset of units are accepted by this method. + The unit must either have an {@linkplain TemporalUnit#isDurationEstimated() exact duration} or + be {@link ChronoUnit#DAYS} which is treated as 24 hours. Other units throw an exception. + + @param amount the amount of the duration, measured in terms of the unit, positive or negative + @param unit the unit that the duration is measured in, must have an exact duration, not null + @return a {@code Duration}, not null + @throws DateTimeException if the period unit has an estimated duration + @throws ArithmeticException if a numeric overflow occurs" + {:arglists (quote (["long" "java.time.temporal.TemporalUnit"]))} + (^java.time.Duration [^long amount ^java.time.temporal.ChronoUnit unit] + (java.time.Duration/of amount unit))) + +(defn is-zero + "Checks if this duration is zero length. + + A {@code Duration} represents a directed distance between two points on + the time-line and can therefore be positive, zero or negative. + This method checks whether the length is zero. + + @return true if this duration has a total length equal to zero" + {:arglists (quote (["java.time.Duration"]))} + (^java.lang.Boolean [^java.time.Duration this] (.isZero this))) + +(defn multiplied-by + "Returns a copy of this duration multiplied by the scalar. + + This instance is immutable and unaffected by this method call. + + @param multiplicand the value to multiply the duration by, positive or negative + @return a {@code Duration} based on this duration multiplied by the specified scalar, not null + @throws ArithmeticException if numeric overflow occurs" + {:arglists (quote (["java.time.Duration" "long"]))} + (^java.time.Duration [^java.time.Duration this ^long multiplicand] + (.multipliedBy this multiplicand))) + +(defn with-nanos + "Returns a copy of this duration with the specified nano-of-second. + + This returns a duration with the specified nano-of-second, retaining the + seconds part of this duration. + + This instance is immutable and unaffected by this method call. + + @param nanoOfSecond the nano-of-second to represent, from 0 to 999,999,999 + @return a {@code Duration} based on this period with the requested nano-of-second, not null + @throws DateTimeException if the nano-of-second is invalid" + {:arglists (quote (["java.time.Duration" "int"]))} + (^java.time.Duration + [^java.time.Duration this ^java.lang.Integer nano-of-second] + (.withNanos this nano-of-second))) + +(defn get-units + "Gets the set of units supported by this duration. + + The supported units are {@link ChronoUnit#SECONDS SECONDS}, + and {@link ChronoUnit#NANOS NANOS}. + They are returned in the order seconds, nanos. + + This set can be used in conjunction with {@link #get(TemporalUnit)} + to access the entire state of the duration. + + @return a list containing the seconds and nanos units, not null" + {:arglists (quote (["java.time.Duration"]))} + (^java.util.List [^java.time.Duration this] (.getUnits this))) + +(defn get-nano + "Gets the number of nanoseconds within the second in this duration. + + The length of the duration is stored using two fields - seconds and nanoseconds. + The nanoseconds part is a value from 0 to 999,999,999 that is an adjustment to + the length in seconds. + The total duration is defined by calling this method and {@link #getSeconds()}. + + A {@code Duration} represents a directed distance between two points on the time-line. + A negative duration is expressed by the negative sign of the seconds part. + A duration of -1 nanosecond is stored as -1 seconds plus 999,999,999 nanoseconds. + + @return the nanoseconds within the second part of the length of the duration, from 0 to 999,999,999" + {:arglists (quote (["java.time.Duration"]))} + (^java.lang.Integer [^java.time.Duration this] (.getNano this))) + +(defn plus-millis + "Returns a copy of this duration with the specified duration in milliseconds added. + + This instance is immutable and unaffected by this method call. + + @param millisToAdd the milliseconds to add, positive or negative + @return a {@code Duration} based on this duration with the specified milliseconds added, not null + @throws ArithmeticException if numeric overflow occurs" + {:arglists (quote (["java.time.Duration" "long"]))} + (^java.time.Duration [^java.time.Duration this ^long millis-to-add] + (.plusMillis this millis-to-add))) + +(defn to-minutes + "Gets the number of minutes in this duration. + + This returns the total number of minutes in the duration by dividing the + number of seconds by 60. + + This instance is immutable and unaffected by this method call. + + @return the number of minutes in the duration, may be negative" + {:arglists (quote (["java.time.Duration"]))} + (^long [^java.time.Duration this] (.toMinutes this))) + +(defn minus-seconds + "Returns a copy of this duration with the specified duration in seconds subtracted. + + This instance is immutable and unaffected by this method call. + + @param secondsToSubtract the seconds to subtract, positive or negative + @return a {@code Duration} based on this duration with the specified seconds subtracted, not null + @throws ArithmeticException if numeric overflow occurs" + {:arglists (quote (["java.time.Duration" "long"]))} + (^java.time.Duration [^java.time.Duration this ^long seconds-to-subtract] + (.minusSeconds this seconds-to-subtract))) + +(defn plus-nanos + "Returns a copy of this duration with the specified duration in nanoseconds added. + + This instance is immutable and unaffected by this method call. + + @param nanosToAdd the nanoseconds to add, positive or negative + @return a {@code Duration} based on this duration with the specified nanoseconds added, not null + @throws ArithmeticException if numeric overflow occurs" + {:arglists (quote (["java.time.Duration" "long"]))} + (^java.time.Duration [^java.time.Duration this ^long nanos-to-add] + (.plusNanos this nanos-to-add))) + +(defn plus + {:arglists (quote (["java.time.Duration" "java.time.Duration"] + ["java.time.Duration" "long" + "java.time.temporal.TemporalUnit"]))} + (^java.time.Duration [^java.time.Duration this ^java.time.Duration duration] + (.plus this duration)) + (^java.time.Duration + [^java.time.Duration this ^long amount-to-add + ^java.time.temporal.ChronoUnit unit] + (.plus this amount-to-add unit))) + +(defn divided-by + "Returns a copy of this duration divided by the specified value. + + This instance is immutable and unaffected by this method call. + + @param divisor the value to divide the duration by, positive or negative, not zero + @return a {@code Duration} based on this duration divided by the specified divisor, not null + @throws ArithmeticException if the divisor is zero or if numeric overflow occurs" + {:arglists (quote (["java.time.Duration" "long"]))} + (^java.time.Duration [^java.time.Duration this ^long divisor] + (.dividedBy this divisor))) + +(defn plus-minutes + "Returns a copy of this duration with the specified duration in minutes added. + + This instance is immutable and unaffected by this method call. + + @param minutesToAdd the minutes to add, positive or negative + @return a {@code Duration} based on this duration with the specified minutes added, not null + @throws ArithmeticException if numeric overflow occurs" + {:arglists (quote (["java.time.Duration" "long"]))} + (^java.time.Duration [^java.time.Duration this ^long minutes-to-add] + (.plusMinutes this minutes-to-add))) + +(defn to-string + "A string representation of this duration using ISO-8601 seconds + based representation, such as {@code PT8H6M12.345S}. + + The format of the returned string will be {@code PTnHnMnS}, where n is + the relevant hours, minutes or seconds part of the duration. + Any fractional seconds are placed after a decimal point i the seconds section. + If a section has a zero value, it is omitted. + The hours, minutes and seconds will all have the same sign. + + Examples: +
+    \"20.345 seconds\"                 -- \"PT20.345S
+    \"15 minutes\" (15 * 60 seconds)   -- \"PT15M\"
+    \"10 hours\" (10 * 3600 seconds)   -- \"PT10H\"
+    \"2 days\" (2 * 86400 seconds)     -- \"PT48H\"
+ 
+ Note that multiples of 24 hours are not output as days to avoid confusion + with {@code Period}. + + @return an ISO-8601 representation of this duration, not null" + {:arglists (quote (["java.time.Duration"]))} + (^java.lang.String [^java.time.Duration this] (.toString this))) + +(defn minus + {:arglists (quote (["java.time.Duration" "java.time.Duration"] + ["java.time.Duration" "long" + "java.time.temporal.TemporalUnit"]))} + (^java.time.Duration [^java.time.Duration this ^java.time.Duration duration] + (.minus this duration)) + (^java.time.Duration + [^java.time.Duration this ^long amount-to-subtract + ^java.time.temporal.ChronoUnit unit] + (.minus this amount-to-subtract unit))) + +(defn add-to + "Adds this duration to the specified temporal object. + + This returns a temporal object of the same observable type as the input + with this duration added. + + In most cases, it is clearer to reverse the calling pattern by using + {@link Temporal#plus(TemporalAmount)}. +
+   // these two lines are equivalent, but the second approach is recommended
+   dateTime = thisDuration.addTo(dateTime);
+   dateTime = dateTime.plus(thisDuration);
+ 
+ + The calculation will add the seconds, then nanos. + Only non-zero amounts will be added. + + This instance is immutable and unaffected by this method call. + + @param temporal the temporal object to adjust, not null + @return an object of the same type with the adjustment made, not null + @throws DateTimeException if unable to add + @throws ArithmeticException if numeric overflow occurs" + {:arglists (quote (["java.time.Duration" "java.time.temporal.Temporal"]))} + (^java.time.temporal.Temporal + [^java.time.Duration this ^java.time.temporal.Temporal temporal] + (.addTo this temporal))) + +(defn plus-hours + "Returns a copy of this duration with the specified duration in hours added. + + This instance is immutable and unaffected by this method call. + + @param hoursToAdd the hours to add, positive or negative + @return a {@code Duration} based on this duration with the specified hours added, not null + @throws ArithmeticException if numeric overflow occurs" + {:arglists (quote (["java.time.Duration" "long"]))} + (^java.time.Duration [^java.time.Duration this ^long hours-to-add] + (.plusHours this hours-to-add))) + +(defn plus-days + "Returns a copy of this duration with the specified duration in standard 24 hour days added. + + The number of days is multiplied by 86400 to obtain the number of seconds to add. + This is based on the standard definition of a day as 24 hours. + + This instance is immutable and unaffected by this method call. + + @param daysToAdd the days to add, positive or negative + @return a {@code Duration} based on this duration with the specified days added, not null + @throws ArithmeticException if numeric overflow occurs" + {:arglists (quote (["java.time.Duration" "long"]))} + (^java.time.Duration [^java.time.Duration this ^long days-to-add] + (.plusDays this days-to-add))) + +(defn of-hours + "Obtains a {@code Duration} representing a number of standard hours. + + The seconds are calculated based on the standard definition of an hour, + where each hour is 3600 seconds. + The nanosecond in second field is set to zero. + + @param hours the number of hours, positive or negative + @return a {@code Duration}, not null + @throws ArithmeticException if the input hours exceeds the capacity of {@code Duration}" + {:arglists (quote (["long"]))} + (^java.time.Duration [^long hours] (java.time.Duration/ofHours hours))) + +(defn to-millis + "Converts this duration to the total length in milliseconds. + + If this duration is too large to fit in a {@code long} milliseconds, then an + exception is thrown. + + If this duration has greater than millisecond precision, then the conversion + will drop any excess precision information as though the amount in nanoseconds + was subject to integer division by one million. + + @return the total length of the duration in milliseconds + @throws ArithmeticException if numeric overflow occurs" + {:arglists (quote (["java.time.Duration"]))} + (^long [^java.time.Duration this] (.toMillis this))) + +(defn to-hours + "Gets the number of hours in this duration. + + This returns the total number of hours in the duration by dividing the + number of seconds by 3600. + + This instance is immutable and unaffected by this method call. + + @return the number of hours in the duration, may be negative" + {:arglists (quote (["java.time.Duration"]))} + (^long [^java.time.Duration this] (.toHours this))) + +(defn of-nanos + "Obtains a {@code Duration} representing a number of nanoseconds. + + The seconds and nanoseconds are extracted from the specified nanoseconds. + + @param nanos the number of nanoseconds, positive or negative + @return a {@code Duration}, not null" + {:arglists (quote (["long"]))} + (^java.time.Duration [^long nanos] (java.time.Duration/ofNanos nanos))) + +(defn of-millis + "Obtains a {@code Duration} representing a number of milliseconds. + + The seconds and nanoseconds are extracted from the specified milliseconds. + + @param millis the number of milliseconds, positive or negative + @return a {@code Duration}, not null" + {:arglists (quote (["long"]))} + (^java.time.Duration [^long millis] (java.time.Duration/ofMillis millis))) + +(defn negated + "Returns a copy of this duration with the length negated. + + This method swaps the sign of the total length of this duration. + For example, {@code PT1.3S} will be returned as {@code PT-1.3S}. + + This instance is immutable and unaffected by this method call. + + @return a {@code Duration} based on this duration with the amount negated, not null + @throws ArithmeticException if numeric overflow occurs" + {:arglists (quote (["java.time.Duration"]))} + (^java.time.Duration [^java.time.Duration this] (.negated this))) + +(defn abs + "Returns a copy of this duration with a positive length. + + This method returns a positive duration by effectively removing the sign from any negative total length. + For example, {@code PT-1.3S} will be returned as {@code PT1.3S}. + + This instance is immutable and unaffected by this method call. + + @return a {@code Duration} based on this duration with an absolute length, not null + @throws ArithmeticException if numeric overflow occurs" + {:arglists (quote (["java.time.Duration"]))} + (^java.time.Duration [^java.time.Duration this] (.abs this))) + +(defn between + "Obtains a {@code Duration} representing the duration between two temporal objects. + + This calculates the duration between two temporal objects. If the objects + are of different types, then the duration is calculated based on the type + of the first object. For example, if the first argument is a {@code LocalTime} + then the second argument is converted to a {@code LocalTime}. + + The specified temporal objects must support the {@link ChronoUnit#SECONDS SECONDS} unit. + For full accuracy, either the {@link ChronoUnit#NANOS NANOS} unit or the + {@link ChronoField#NANO_OF_SECOND NANO_OF_SECOND} field should be supported. + + The result of this method can be a negative period if the end is before the start. + To guarantee to obtain a positive duration call {@link #abs()} on the result. + + @param startInclusive the start instant, inclusive, not null + @param endExclusive the end instant, exclusive, not null + @return a {@code Duration}, not null + @throws DateTimeException if the seconds between the temporals cannot be obtained + @throws ArithmeticException if the calculation exceeds the capacity of {@code Duration}" + {:arglists (quote (["java.time.temporal.Temporal" + "java.time.temporal.Temporal"]))} + (^java.time.Duration + [^java.time.temporal.Temporal start-inclusive + ^java.time.temporal.Temporal end-exclusive] + (java.time.Duration/between start-inclusive end-exclusive))) + +(defn get-seconds + "Gets the number of seconds in this duration. + + The length of the duration is stored using two fields - seconds and nanoseconds. + The nanoseconds part is a value from 0 to 999,999,999 that is an adjustment to + the length in seconds. + The total duration is defined by calling this method and {@link #getNano()}. + + A {@code Duration} represents a directed distance between two points on the time-line. + A negative duration is expressed by the negative sign of the seconds part. + A duration of -1 nanosecond is stored as -1 seconds plus 999,999,999 nanoseconds. + + @return the whole seconds part of the length of the duration, positive or negative" + {:arglists (quote (["java.time.Duration"]))} + (^long [^java.time.Duration this] (.getSeconds this))) + +(defn from + "Obtains an instance of {@code Duration} from a temporal amount. + + This obtains a duration based on the specified amount. + A {@code TemporalAmount} represents an amount of time, which may be + date-based or time-based, which this factory extracts to a duration. + + The conversion loops around the set of units from the amount and uses + the {@linkplain TemporalUnit#getDuration() duration} of the unit to + calculate the total {@code Duration}. + Only a subset of units are accepted by this method. The unit must either + have an {@linkplain TemporalUnit#isDurationEstimated() exact duration} + or be {@link ChronoUnit#DAYS} which is treated as 24 hours. + If any other units are found then an exception is thrown. + + @param amount the temporal amount to convert, not null + @return the equivalent duration, not null + @throws DateTimeException if unable to convert to a {@code Duration} + @throws ArithmeticException if numeric overflow occurs" + {:arglists (quote (["java.time.temporal.TemporalAmount"]))} + (^java.time.Duration [^java.time.temporal.TemporalAmount amount] + (java.time.Duration/from amount))) + +(defn minus-nanos + "Returns a copy of this duration with the specified duration in nanoseconds subtracted. + + This instance is immutable and unaffected by this method call. + + @param nanosToSubtract the nanoseconds to subtract, positive or negative + @return a {@code Duration} based on this duration with the specified nanoseconds subtracted, not null + @throws ArithmeticException if numeric overflow occurs" + {:arglists (quote (["java.time.Duration" "long"]))} + (^java.time.Duration [^java.time.Duration this ^long nanos-to-subtract] + (.minusNanos this nanos-to-subtract))) + +(defn parse + "Obtains a {@code Duration} from a text string such as {@code PnDTnHnMn.nS}. + + This will parse a textual representation of a duration, including the + string produced by {@code toString()}. The formats accepted are based + on the ISO-8601 duration format {@code PnDTnHnMn.nS} with days + considered to be exactly 24 hours. + + The string starts with an optional sign, denoted by the ASCII negative + or positive symbol. If negative, the whole period is negated. + The ASCII letter \"P\" is next in upper or lower case. + There are then four sections, each consisting of a number and a suffix. + The sections have suffixes in ASCII of \"D\", \"H\", \"M\" and \"S\" for + days, hours, minutes and seconds, accepted in upper or lower case. + The suffixes must occur in order. The ASCII letter \"T\" must occur before + the first occurrence, if any, of an hour, minute or second section. + At least one of the four sections must be present, and if \"T\" is present + there must be at least one section after the \"T\". + The number part of each section must consist of one or more ASCII digits. + The number may be prefixed by the ASCII negative or positive symbol. + The number of days, hours and minutes must parse to an {@code long}. + The number of seconds must parse to an {@code long} with optional fraction. + The decimal point may be either a dot or a comma. + The fractional part may have from zero to 9 digits. + + The leading plus/minus sign, and negative values for other units are + not part of the ISO-8601 standard. + + Examples: +
+    \"PT20.345S\" -- parses as \"20.345 seconds\"
+    \"PT15M\"     -- parses as \"15 minutes\" (where a minute is 60 seconds)
+    \"PT10H\"     -- parses as \"10 hours\" (where an hour is 3600 seconds)
+    \"P2D\"       -- parses as \"2 days\" (where a day is 24 hours or 86400 seconds)
+    \"P2DT3H4M\"  -- parses as \"2 days, 3 hours and 4 minutes\"
+    \"P-6H3M\"    -- parses as \"-6 hours and +3 minutes\"
+    \"-P6H3M\"    -- parses as \"-6 hours and -3 minutes\"
+    \"-P-6H+3M\"  -- parses as \"+6 hours and -3 minutes\"
+ 
+ + @param text the text to parse, not null + @return the parsed duration, not null + @throws DateTimeParseException if the text cannot be parsed to a duration" + {:arglists (quote (["java.lang.CharSequence"]))} + (^java.time.Duration [^java.lang.CharSequence text] + (java.time.Duration/parse text))) + +(defn hash-code + "A hash code for this duration. + + @return a suitable hash code" + {:arglists (quote (["java.time.Duration"]))} + (^java.lang.Integer [^java.time.Duration this] (.hashCode this))) + +(defn with-seconds + "Returns a copy of this duration with the specified amount of seconds. + + This returns a duration with the specified seconds, retaining the + nano-of-second part of this duration. + + This instance is immutable and unaffected by this method call. + + @param seconds the seconds to represent, may be negative + @return a {@code Duration} based on this period with the requested seconds, not null" + {:arglists (quote (["java.time.Duration" "long"]))} + (^java.time.Duration [^java.time.Duration this ^long seconds] + (.withSeconds this seconds))) + +(defn of-minutes + "Obtains a {@code Duration} representing a number of standard minutes. + + The seconds are calculated based on the standard definition of a minute, + where each minute is 60 seconds. + The nanosecond in second field is set to zero. + + @param minutes the number of minutes, positive or negative + @return a {@code Duration}, not null + @throws ArithmeticException if the input minutes exceeds the capacity of {@code Duration}" + {:arglists (quote (["long"]))} + (^java.time.Duration [^long minutes] (java.time.Duration/ofMinutes minutes))) + +(defn subtract-from + "Subtracts this duration from the specified temporal object. + + This returns a temporal object of the same observable type as the input + with this duration subtracted. + + In most cases, it is clearer to reverse the calling pattern by using + {@link Temporal#minus(TemporalAmount)}. +
+   // these two lines are equivalent, but the second approach is recommended
+   dateTime = thisDuration.subtractFrom(dateTime);
+   dateTime = dateTime.minus(thisDuration);
+ 
+ + The calculation will subtract the seconds, then nanos. + Only non-zero amounts will be added. + + This instance is immutable and unaffected by this method call. + + @param temporal the temporal object to adjust, not null + @return an object of the same type with the adjustment made, not null + @throws DateTimeException if unable to subtract + @throws ArithmeticException if numeric overflow occurs" + {:arglists (quote (["java.time.Duration" "java.time.temporal.Temporal"]))} + (^java.time.temporal.Temporal + [^java.time.Duration this ^java.time.temporal.Temporal temporal] + (.subtractFrom this temporal))) + +(defn compare-to + "Compares this duration to the specified {@code Duration}. + + The comparison is based on the total length of the durations. + It is \"consistent with equals\", as defined by {@link Comparable}. + + @param otherDuration the other duration to compare to, not null + @return the comparator value, negative if less, positive if greater" + {:arglists (quote (["java.time.Duration" "java.time.Duration"]))} + (^java.lang.Integer + [^java.time.Duration this ^java.time.Duration other-duration] + (.compareTo this other-duration))) + +(defn plus-seconds + "Returns a copy of this duration with the specified duration in seconds added. + + This instance is immutable and unaffected by this method call. + + @param secondsToAdd the seconds to add, positive or negative + @return a {@code Duration} based on this duration with the specified seconds added, not null + @throws ArithmeticException if numeric overflow occurs" + {:arglists (quote (["java.time.Duration" "long"]))} + (^java.time.Duration [^java.time.Duration this ^long seconds-to-add] + (.plusSeconds this seconds-to-add))) + +(defn get + "Gets the value of the requested unit. + + This returns a value for each of the two supported units, + {@link ChronoUnit#SECONDS SECONDS} and {@link ChronoUnit#NANOS NANOS}. + All other units throw an exception. + + @param unit the {@code TemporalUnit} for which to return the value + @return the long value of the unit + @throws DateTimeException if the unit is not supported + @throws UnsupportedTemporalTypeException if the unit is not supported" + {:arglists (quote (["java.time.Duration" "java.time.temporal.TemporalUnit"]))} + (^long [^java.time.Duration this ^java.time.temporal.ChronoUnit unit] + (.get this unit))) + +(defn equals + "Checks if this duration is equal to the specified {@code Duration}. + + The comparison is based on the total length of the durations. + + @param otherDuration the other duration, null returns false + @return true if the other duration is equal to this one" + {:arglists (quote (["java.time.Duration" "java.lang.Object"]))} + (^java.lang.Boolean + [^java.time.Duration this ^java.lang.Object other-duration] + (.equals this other-duration))) + +(defn of-seconds + {:arglists (quote (["long"] ["long" "long"]))} + (^java.time.Duration [^long seconds] (java.time.Duration/ofSeconds seconds)) + (^java.time.Duration [^long seconds ^long nano-adjustment] + (java.time.Duration/ofSeconds seconds nano-adjustment))) + +(defn minus-days + "Returns a copy of this duration with the specified duration in standard 24 hour days subtracted. + + The number of days is multiplied by 86400 to obtain the number of seconds to subtract. + This is based on the standard definition of a day as 24 hours. + + This instance is immutable and unaffected by this method call. + + @param daysToSubtract the days to subtract, positive or negative + @return a {@code Duration} based on this duration with the specified days subtracted, not null + @throws ArithmeticException if numeric overflow occurs" + {:arglists (quote (["java.time.Duration" "long"]))} + (^java.time.Duration [^java.time.Duration this ^long days-to-subtract] + (.minusDays this days-to-subtract))) + +(defn to-days + "Gets the number of days in this duration. + + This returns the total number of days in the duration by dividing the + number of seconds by 86400. + This is based on the standard definition of a day as 24 hours. + + This instance is immutable and unaffected by this method call. + + @return the number of days in the duration, may be negative" + {:arglists (quote (["java.time.Duration"]))} + (^long [^java.time.Duration this] (.toDays this))) diff --git a/src/cljc/java_time/duration.cljs b/src/cljc/java_time/duration.cljs index 4b51932..0f96fed 100644 --- a/src/cljc/java_time/duration.cljs +++ b/src/cljc/java_time/duration.cljs @@ -1,49 +1,706 @@ -(ns cljc.java-time.duration (:refer-clojure :exclude [abs get range format min max next name resolve short]) (:require [cljc.java-time.extn.calendar-awareness] [goog.object] [java.time :refer [Duration]])) -(def zero (goog.object/get java.time.Duration "ZERO")) -(clojure.core/defn minus-minutes {:arglists (quote (["java.time.Duration" "long"]))} (^js/JSJoda.Duration [^js/JSJoda.Duration this15016 ^long long15017] (.minusMinutes this15016 long15017))) -(clojure.core/defn to-nanos {:arglists (quote (["java.time.Duration"]))} (^long [^js/JSJoda.Duration this15018] (.toNanos this15018))) -(clojure.core/defn minus-millis {:arglists (quote (["java.time.Duration" "long"]))} (^js/JSJoda.Duration [^js/JSJoda.Duration this15019 ^long long15020] (.minusMillis this15019 long15020))) -(clojure.core/defn minus-hours {:arglists (quote (["java.time.Duration" "long"]))} (^js/JSJoda.Duration [^js/JSJoda.Duration this15021 ^long long15022] (.minusHours this15021 long15022))) -(clojure.core/defn of-days {:arglists (quote (["long"]))} (^js/JSJoda.Duration [^long long15023] (js-invoke java.time.Duration "ofDays" long15023))) -(clojure.core/defn is-negative {:arglists (quote (["java.time.Duration"]))} (^boolean [^js/JSJoda.Duration this15024] (.isNegative this15024))) -(clojure.core/defn of {:arglists (quote (["long" "java.time.temporal.TemporalUnit"]))} (^js/JSJoda.Duration [^long long15025 ^js/JSJoda.TemporalUnit java-time-temporal-TemporalUnit15026] (js-invoke java.time.Duration "of" long15025 java-time-temporal-TemporalUnit15026))) -(clojure.core/defn is-zero {:arglists (quote (["java.time.Duration"]))} (^boolean [^js/JSJoda.Duration this15027] (.isZero this15027))) -(clojure.core/defn multiplied-by {:arglists (quote (["java.time.Duration" "long"]))} (^js/JSJoda.Duration [^js/JSJoda.Duration this15028 ^long long15029] (.multipliedBy this15028 long15029))) -(clojure.core/defn with-nanos {:arglists (quote (["java.time.Duration" "int"]))} (^js/JSJoda.Duration [^js/JSJoda.Duration this15030 ^int int15031] (.withNanos this15030 int15031))) -(clojure.core/defn get-units {:arglists (quote (["java.time.Duration"]))} (^java.util.List [^js/JSJoda.Duration this15032] (.units this15032))) -(clojure.core/defn get-nano {:arglists (quote (["java.time.Duration"]))} (^int [^js/JSJoda.Duration this15033] (.nano this15033))) -(clojure.core/defn plus-millis {:arglists (quote (["java.time.Duration" "long"]))} (^js/JSJoda.Duration [^js/JSJoda.Duration this15034 ^long long15035] (.plusMillis this15034 long15035))) -(clojure.core/defn to-minutes {:arglists (quote (["java.time.Duration"]))} (^long [^js/JSJoda.Duration this15036] (.toMinutes this15036))) -(clojure.core/defn minus-seconds {:arglists (quote (["java.time.Duration" "long"]))} (^js/JSJoda.Duration [^js/JSJoda.Duration this15037 ^long long15038] (.minusSeconds this15037 long15038))) -(clojure.core/defn plus-nanos {:arglists (quote (["java.time.Duration" "long"]))} (^js/JSJoda.Duration [^js/JSJoda.Duration this15039 ^long long15040] (.plusNanos this15039 long15040))) -(clojure.core/defn plus {:arglists (quote (["java.time.Duration" "java.time.Duration"] ["java.time.Duration" "long" "java.time.temporal.TemporalUnit"]))} (^js/JSJoda.Duration [^js/JSJoda.Duration this15041 ^js/JSJoda.Duration java-time-Duration15042] (.plus this15041 java-time-Duration15042)) (^js/JSJoda.Duration [^js/JSJoda.Duration this15043 ^long long15044 ^js/JSJoda.TemporalUnit java-time-temporal-TemporalUnit15045] (.plus this15043 long15044 java-time-temporal-TemporalUnit15045))) -(clojure.core/defn divided-by {:arglists (quote (["java.time.Duration" "long"]))} (^js/JSJoda.Duration [^js/JSJoda.Duration this15046 ^long long15047] (.dividedBy this15046 long15047))) -(clojure.core/defn plus-minutes {:arglists (quote (["java.time.Duration" "long"]))} (^js/JSJoda.Duration [^js/JSJoda.Duration this15048 ^long long15049] (.plusMinutes this15048 long15049))) -(clojure.core/defn to-string {:arglists (quote (["java.time.Duration"]))} (^java.lang.String [^js/JSJoda.Duration this15050] (.toString this15050))) -(clojure.core/defn minus {:arglists (quote (["java.time.Duration" "java.time.Duration"] ["java.time.Duration" "long" "java.time.temporal.TemporalUnit"]))} (^js/JSJoda.Duration [^js/JSJoda.Duration this15051 ^js/JSJoda.Duration java-time-Duration15052] (.minus this15051 java-time-Duration15052)) (^js/JSJoda.Duration [^js/JSJoda.Duration this15053 ^long long15054 ^js/JSJoda.TemporalUnit java-time-temporal-TemporalUnit15055] (.minus this15053 long15054 java-time-temporal-TemporalUnit15055))) -(clojure.core/defn add-to {:arglists (quote (["java.time.Duration" "java.time.temporal.Temporal"]))} (^js/JSJoda.Temporal [^js/JSJoda.Duration this15056 ^js/JSJoda.Temporal java-time-temporal-Temporal15057] (.addTo this15056 java-time-temporal-Temporal15057))) -(clojure.core/defn plus-hours {:arglists (quote (["java.time.Duration" "long"]))} (^js/JSJoda.Duration [^js/JSJoda.Duration this15058 ^long long15059] (.plusHours this15058 long15059))) -(clojure.core/defn plus-days {:arglists (quote (["java.time.Duration" "long"]))} (^js/JSJoda.Duration [^js/JSJoda.Duration this15060 ^long long15061] (.plusDays this15060 long15061))) -(clojure.core/defn of-hours {:arglists (quote (["long"]))} (^js/JSJoda.Duration [^long long15062] (js-invoke java.time.Duration "ofHours" long15062))) -(clojure.core/defn to-millis {:arglists (quote (["java.time.Duration"]))} (^long [^js/JSJoda.Duration this15063] (.toMillis this15063))) -(clojure.core/defn to-hours {:arglists (quote (["java.time.Duration"]))} (^long [^js/JSJoda.Duration this15064] (.toHours this15064))) -(clojure.core/defn of-nanos {:arglists (quote (["long"]))} (^js/JSJoda.Duration [^long long15065] (js-invoke java.time.Duration "ofNanos" long15065))) -(clojure.core/defn of-millis {:arglists (quote (["long"]))} (^js/JSJoda.Duration [^long long15066] (js-invoke java.time.Duration "ofMillis" long15066))) -(clojure.core/defn negated {:arglists (quote (["java.time.Duration"]))} (^js/JSJoda.Duration [^js/JSJoda.Duration this15067] (.negated this15067))) -(clojure.core/defn abs {:arglists (quote (["java.time.Duration"]))} (^js/JSJoda.Duration [^js/JSJoda.Duration this15068] (.abs this15068))) -(clojure.core/defn between {:arglists (quote (["java.time.temporal.Temporal" "java.time.temporal.Temporal"]))} (^js/JSJoda.Duration [^js/JSJoda.Temporal java-time-temporal-Temporal15069 ^js/JSJoda.Temporal java-time-temporal-Temporal15070] (js-invoke java.time.Duration "between" java-time-temporal-Temporal15069 java-time-temporal-Temporal15070))) -(clojure.core/defn get-seconds {:arglists (quote (["java.time.Duration"]))} (^long [^js/JSJoda.Duration this15071] (.seconds this15071))) -(clojure.core/defn from {:arglists (quote (["java.time.temporal.TemporalAmount"]))} (^js/JSJoda.Duration [^js/JSJoda.TemporalAmount java-time-temporal-TemporalAmount15072] (js-invoke java.time.Duration "from" java-time-temporal-TemporalAmount15072))) -(clojure.core/defn minus-nanos {:arglists (quote (["java.time.Duration" "long"]))} (^js/JSJoda.Duration [^js/JSJoda.Duration this15073 ^long long15074] (.minusNanos this15073 long15074))) -(clojure.core/defn parse {:arglists (quote (["java.lang.CharSequence"]))} (^js/JSJoda.Duration [^java.lang.CharSequence java-lang-CharSequence15075] (js-invoke java.time.Duration "parse" java-lang-CharSequence15075))) -(clojure.core/defn hash-code {:arglists (quote (["java.time.Duration"]))} (^int [^js/JSJoda.Duration this15076] (.hashCode this15076))) -(clojure.core/defn with-seconds {:arglists (quote (["java.time.Duration" "long"]))} (^js/JSJoda.Duration [^js/JSJoda.Duration this15077 ^long long15078] (.withSeconds this15077 long15078))) -(clojure.core/defn of-minutes {:arglists (quote (["long"]))} (^js/JSJoda.Duration [^long long15079] (js-invoke java.time.Duration "ofMinutes" long15079))) -(clojure.core/defn subtract-from {:arglists (quote (["java.time.Duration" "java.time.temporal.Temporal"]))} (^js/JSJoda.Temporal [^js/JSJoda.Duration this15080 ^js/JSJoda.Temporal java-time-temporal-Temporal15081] (.subtractFrom this15080 java-time-temporal-Temporal15081))) -(clojure.core/defn compare-to {:arglists (quote (["java.time.Duration" "java.time.Duration"]))} (^int [^js/JSJoda.Duration this15082 ^js/JSJoda.Duration java-time-Duration15083] (.compareTo this15082 java-time-Duration15083))) -(clojure.core/defn plus-seconds {:arglists (quote (["java.time.Duration" "long"]))} (^js/JSJoda.Duration [^js/JSJoda.Duration this15084 ^long long15085] (.plusSeconds this15084 long15085))) -(clojure.core/defn get {:arglists (quote (["java.time.Duration" "java.time.temporal.TemporalUnit"]))} (^long [^js/JSJoda.Duration this15086 ^js/JSJoda.TemporalUnit java-time-temporal-TemporalUnit15087] (.get this15086 java-time-temporal-TemporalUnit15087))) -(clojure.core/defn equals {:arglists (quote (["java.time.Duration" "java.lang.Object"]))} (^boolean [^js/JSJoda.Duration this15088 ^java.lang.Object java-lang-Object15089] (.equals this15088 java-lang-Object15089))) -(clojure.core/defn of-seconds {:arglists (quote (["long" "long"] ["long"]))} (^js/JSJoda.Duration [^long long15090 ^long long15091] (js-invoke java.time.Duration "ofSeconds" long15090 long15091)) (^js/JSJoda.Duration [^long long15092] (js-invoke java.time.Duration "ofSeconds" long15092))) -(clojure.core/defn minus-days {:arglists (quote (["java.time.Duration" "long"]))} (^js/JSJoda.Duration [^js/JSJoda.Duration this15093 ^long long15094] (.minusDays this15093 long15094))) -(clojure.core/defn to-days {:arglists (quote (["java.time.Duration"]))} (^long [^js/JSJoda.Duration this15095] (.toDays this15095))) +(ns cljc.java-time.duration + (:refer-clojure :exclude + [abs get range format min max next name resolve short]) + (:require [cljc.java-time.extn.calendar-awareness] + [goog.object] + [java.time :refer [Duration]])) + +(def zero + "Constant for a duration of zero." + (goog.object/get java.time.Duration "ZERO")) + +(defn minus-minutes + "Returns a copy of this duration with the specified duration in minutes subtracted. + + The number of hours is multiplied by 60 to obtain the number of seconds to subtract. + + This instance is immutable and unaffected by this method call. + + @param minutesToSubtract the minutes to subtract, positive or negative + @return a {@code Duration} based on this duration with the specified minutes subtracted, not null + @throws ArithmeticException if numeric overflow occurs" + {:arglists (quote (["java.time.Duration" "long"]))} + (^js/JSJoda.Duration [^js/JSJoda.Duration this ^long minutes-to-subtract] + (.minusMinutes this minutes-to-subtract))) + +(defn to-nanos + "Converts this duration to the total length in nanoseconds expressed as a {@code long}. + + If this duration is too large to fit in a {@code long} nanoseconds, then an + exception is thrown. + + @return the total length of the duration in nanoseconds + @throws ArithmeticException if numeric overflow occurs" + {:arglists (quote (["java.time.Duration"]))} + (^long [^js/JSJoda.Duration this] (.toNanos this))) + +(defn minus-millis + "Returns a copy of this duration with the specified duration in milliseconds subtracted. + + This instance is immutable and unaffected by this method call. + + @param millisToSubtract the milliseconds to subtract, positive or negative + @return a {@code Duration} based on this duration with the specified milliseconds subtracted, not null + @throws ArithmeticException if numeric overflow occurs" + {:arglists (quote (["java.time.Duration" "long"]))} + (^js/JSJoda.Duration [^js/JSJoda.Duration this ^long millis-to-subtract] + (.minusMillis this millis-to-subtract))) + +(defn minus-hours + "Returns a copy of this duration with the specified duration in hours subtracted. + + The number of hours is multiplied by 3600 to obtain the number of seconds to subtract. + + This instance is immutable and unaffected by this method call. + + @param hoursToSubtract the hours to subtract, positive or negative + @return a {@code Duration} based on this duration with the specified hours subtracted, not null + @throws ArithmeticException if numeric overflow occurs" + {:arglists (quote (["java.time.Duration" "long"]))} + (^js/JSJoda.Duration [^js/JSJoda.Duration this ^long hours-to-subtract] + (.minusHours this hours-to-subtract))) + +(defn of-days + "Obtains a {@code Duration} representing a number of standard 24 hour days. + + The seconds are calculated based on the standard definition of a day, + where each day is 86400 seconds which implies a 24 hour day. + The nanosecond in second field is set to zero. + + @param days the number of days, positive or negative + @return a {@code Duration}, not null + @throws ArithmeticException if the input days exceeds the capacity of {@code Duration}" + {:arglists (quote (["long"]))} + (^js/JSJoda.Duration [^long days] + (js-invoke java.time.Duration "ofDays" days))) + +(defn is-negative + "Checks if this duration is negative, excluding zero. + + A {@code Duration} represents a directed distance between two points on + the time-line and can therefore be positive, zero or negative. + This method checks whether the length is less than zero. + + @return true if this duration has a total length less than zero" + {:arglists (quote (["java.time.Duration"]))} + (^boolean [^js/JSJoda.Duration this] (.isNegative this))) + +(defn of + "Obtains a {@code Duration} representing an amount in the specified unit. + + The parameters represent the two parts of a phrase like '6 Hours'. For example: +
+  Duration.of(3, SECONDS);
+  Duration.of(465, HOURS);
+ 
+ Only a subset of units are accepted by this method. + The unit must either have an {@linkplain TemporalUnit#isDurationEstimated() exact duration} or + be {@link ChronoUnit#DAYS} which is treated as 24 hours. Other units throw an exception. + + @param amount the amount of the duration, measured in terms of the unit, positive or negative + @param unit the unit that the duration is measured in, must have an exact duration, not null + @return a {@code Duration}, not null + @throws DateTimeException if the period unit has an estimated duration + @throws ArithmeticException if a numeric overflow occurs" + {:arglists (quote (["long" "java.time.temporal.TemporalUnit"]))} + (^js/JSJoda.Duration [^long amount ^js/JSJoda.TemporalUnit unit] + (js-invoke java.time.Duration "of" amount unit))) + +(defn is-zero + "Checks if this duration is zero length. + + A {@code Duration} represents a directed distance between two points on + the time-line and can therefore be positive, zero or negative. + This method checks whether the length is zero. + + @return true if this duration has a total length equal to zero" + {:arglists (quote (["java.time.Duration"]))} + (^boolean [^js/JSJoda.Duration this] (.isZero this))) + +(defn multiplied-by + "Returns a copy of this duration multiplied by the scalar. + + This instance is immutable and unaffected by this method call. + + @param multiplicand the value to multiply the duration by, positive or negative + @return a {@code Duration} based on this duration multiplied by the specified scalar, not null + @throws ArithmeticException if numeric overflow occurs" + {:arglists (quote (["java.time.Duration" "long"]))} + (^js/JSJoda.Duration [^js/JSJoda.Duration this ^long multiplicand] + (.multipliedBy this multiplicand))) + +(defn with-nanos + "Returns a copy of this duration with the specified nano-of-second. + + This returns a duration with the specified nano-of-second, retaining the + seconds part of this duration. + + This instance is immutable and unaffected by this method call. + + @param nanoOfSecond the nano-of-second to represent, from 0 to 999,999,999 + @return a {@code Duration} based on this period with the requested nano-of-second, not null + @throws DateTimeException if the nano-of-second is invalid" + {:arglists (quote (["java.time.Duration" "int"]))} + (^js/JSJoda.Duration [^js/JSJoda.Duration this ^int nano-of-second] + (.withNanos this nano-of-second))) + +(defn get-units + "Gets the set of units supported by this duration. + + The supported units are {@link ChronoUnit#SECONDS SECONDS}, + and {@link ChronoUnit#NANOS NANOS}. + They are returned in the order seconds, nanos. + + This set can be used in conjunction with {@link #get(TemporalUnit)} + to access the entire state of the duration. + + @return a list containing the seconds and nanos units, not null" + {:arglists (quote (["java.time.Duration"]))} + (^java.util.List [^js/JSJoda.Duration this] (.units this))) + +(defn get-nano + "Gets the number of nanoseconds within the second in this duration. + + The length of the duration is stored using two fields - seconds and nanoseconds. + The nanoseconds part is a value from 0 to 999,999,999 that is an adjustment to + the length in seconds. + The total duration is defined by calling this method and {@link #getSeconds()}. + + A {@code Duration} represents a directed distance between two points on the time-line. + A negative duration is expressed by the negative sign of the seconds part. + A duration of -1 nanosecond is stored as -1 seconds plus 999,999,999 nanoseconds. + + @return the nanoseconds within the second part of the length of the duration, from 0 to 999,999,999" + {:arglists (quote (["java.time.Duration"]))} + (^int [^js/JSJoda.Duration this] (.nano this))) + +(defn plus-millis + "Returns a copy of this duration with the specified duration in milliseconds added. + + This instance is immutable and unaffected by this method call. + + @param millisToAdd the milliseconds to add, positive or negative + @return a {@code Duration} based on this duration with the specified milliseconds added, not null + @throws ArithmeticException if numeric overflow occurs" + {:arglists (quote (["java.time.Duration" "long"]))} + (^js/JSJoda.Duration [^js/JSJoda.Duration this ^long millis-to-add] + (.plusMillis this millis-to-add))) + +(defn to-minutes + "Gets the number of minutes in this duration. + + This returns the total number of minutes in the duration by dividing the + number of seconds by 60. + + This instance is immutable and unaffected by this method call. + + @return the number of minutes in the duration, may be negative" + {:arglists (quote (["java.time.Duration"]))} + (^long [^js/JSJoda.Duration this] (.toMinutes this))) + +(defn minus-seconds + "Returns a copy of this duration with the specified duration in seconds subtracted. + + This instance is immutable and unaffected by this method call. + + @param secondsToSubtract the seconds to subtract, positive or negative + @return a {@code Duration} based on this duration with the specified seconds subtracted, not null + @throws ArithmeticException if numeric overflow occurs" + {:arglists (quote (["java.time.Duration" "long"]))} + (^js/JSJoda.Duration [^js/JSJoda.Duration this ^long seconds-to-subtract] + (.minusSeconds this seconds-to-subtract))) + +(defn plus-nanos + "Returns a copy of this duration with the specified duration in nanoseconds added. + + This instance is immutable and unaffected by this method call. + + @param nanosToAdd the nanoseconds to add, positive or negative + @return a {@code Duration} based on this duration with the specified nanoseconds added, not null + @throws ArithmeticException if numeric overflow occurs" + {:arglists (quote (["java.time.Duration" "long"]))} + (^js/JSJoda.Duration [^js/JSJoda.Duration this ^long nanos-to-add] + (.plusNanos this nanos-to-add))) + +(defn plus + {:arglists (quote (["java.time.Duration" "java.time.Duration"] + ["java.time.Duration" "long" + "java.time.temporal.TemporalUnit"]))} + (^js/JSJoda.Duration [^js/JSJoda.Duration this ^js/JSJoda.Duration duration] + (.plus this duration)) + (^js/JSJoda.Duration + [^js/JSJoda.Duration this ^long amount-to-add ^js/JSJoda.TemporalUnit unit] + (.plus this amount-to-add unit))) + +(defn divided-by + "Returns a copy of this duration divided by the specified value. + + This instance is immutable and unaffected by this method call. + + @param divisor the value to divide the duration by, positive or negative, not zero + @return a {@code Duration} based on this duration divided by the specified divisor, not null + @throws ArithmeticException if the divisor is zero or if numeric overflow occurs" + {:arglists (quote (["java.time.Duration" "long"]))} + (^js/JSJoda.Duration [^js/JSJoda.Duration this ^long divisor] + (.dividedBy this divisor))) + +(defn plus-minutes + "Returns a copy of this duration with the specified duration in minutes added. + + This instance is immutable and unaffected by this method call. + + @param minutesToAdd the minutes to add, positive or negative + @return a {@code Duration} based on this duration with the specified minutes added, not null + @throws ArithmeticException if numeric overflow occurs" + {:arglists (quote (["java.time.Duration" "long"]))} + (^js/JSJoda.Duration [^js/JSJoda.Duration this ^long minutes-to-add] + (.plusMinutes this minutes-to-add))) + +(defn to-string + "A string representation of this duration using ISO-8601 seconds + based representation, such as {@code PT8H6M12.345S}. + + The format of the returned string will be {@code PTnHnMnS}, where n is + the relevant hours, minutes or seconds part of the duration. + Any fractional seconds are placed after a decimal point i the seconds section. + If a section has a zero value, it is omitted. + The hours, minutes and seconds will all have the same sign. + + Examples: +
+    \"20.345 seconds\"                 -- \"PT20.345S
+    \"15 minutes\" (15 * 60 seconds)   -- \"PT15M\"
+    \"10 hours\" (10 * 3600 seconds)   -- \"PT10H\"
+    \"2 days\" (2 * 86400 seconds)     -- \"PT48H\"
+ 
+ Note that multiples of 24 hours are not output as days to avoid confusion + with {@code Period}. + + @return an ISO-8601 representation of this duration, not null" + {:arglists (quote (["java.time.Duration"]))} + (^java.lang.String [^js/JSJoda.Duration this] (.toString this))) + +(defn minus + {:arglists (quote (["java.time.Duration" "java.time.Duration"] + ["java.time.Duration" "long" + "java.time.temporal.TemporalUnit"]))} + (^js/JSJoda.Duration [^js/JSJoda.Duration this ^js/JSJoda.Duration duration] + (.minus this duration)) + (^js/JSJoda.Duration + [^js/JSJoda.Duration this ^long amount-to-subtract + ^js/JSJoda.TemporalUnit unit] + (.minus this amount-to-subtract unit))) + +(defn add-to + "Adds this duration to the specified temporal object. + + This returns a temporal object of the same observable type as the input + with this duration added. + + In most cases, it is clearer to reverse the calling pattern by using + {@link Temporal#plus(TemporalAmount)}. +
+   // these two lines are equivalent, but the second approach is recommended
+   dateTime = thisDuration.addTo(dateTime);
+   dateTime = dateTime.plus(thisDuration);
+ 
+ + The calculation will add the seconds, then nanos. + Only non-zero amounts will be added. + + This instance is immutable and unaffected by this method call. + + @param temporal the temporal object to adjust, not null + @return an object of the same type with the adjustment made, not null + @throws DateTimeException if unable to add + @throws ArithmeticException if numeric overflow occurs" + {:arglists (quote (["java.time.Duration" "java.time.temporal.Temporal"]))} + (^js/JSJoda.Temporal [^js/JSJoda.Duration this ^js/JSJoda.Temporal temporal] + (.addTo this temporal))) + +(defn plus-hours + "Returns a copy of this duration with the specified duration in hours added. + + This instance is immutable and unaffected by this method call. + + @param hoursToAdd the hours to add, positive or negative + @return a {@code Duration} based on this duration with the specified hours added, not null + @throws ArithmeticException if numeric overflow occurs" + {:arglists (quote (["java.time.Duration" "long"]))} + (^js/JSJoda.Duration [^js/JSJoda.Duration this ^long hours-to-add] + (.plusHours this hours-to-add))) + +(defn plus-days + "Returns a copy of this duration with the specified duration in standard 24 hour days added. + + The number of days is multiplied by 86400 to obtain the number of seconds to add. + This is based on the standard definition of a day as 24 hours. + + This instance is immutable and unaffected by this method call. + + @param daysToAdd the days to add, positive or negative + @return a {@code Duration} based on this duration with the specified days added, not null + @throws ArithmeticException if numeric overflow occurs" + {:arglists (quote (["java.time.Duration" "long"]))} + (^js/JSJoda.Duration [^js/JSJoda.Duration this ^long days-to-add] + (.plusDays this days-to-add))) + +(defn of-hours + "Obtains a {@code Duration} representing a number of standard hours. + + The seconds are calculated based on the standard definition of an hour, + where each hour is 3600 seconds. + The nanosecond in second field is set to zero. + + @param hours the number of hours, positive or negative + @return a {@code Duration}, not null + @throws ArithmeticException if the input hours exceeds the capacity of {@code Duration}" + {:arglists (quote (["long"]))} + (^js/JSJoda.Duration [^long hours] + (js-invoke java.time.Duration "ofHours" hours))) + +(defn to-millis + "Converts this duration to the total length in milliseconds. + + If this duration is too large to fit in a {@code long} milliseconds, then an + exception is thrown. + + If this duration has greater than millisecond precision, then the conversion + will drop any excess precision information as though the amount in nanoseconds + was subject to integer division by one million. + + @return the total length of the duration in milliseconds + @throws ArithmeticException if numeric overflow occurs" + {:arglists (quote (["java.time.Duration"]))} + (^long [^js/JSJoda.Duration this] (.toMillis this))) + +(defn to-hours + "Gets the number of hours in this duration. + + This returns the total number of hours in the duration by dividing the + number of seconds by 3600. + + This instance is immutable and unaffected by this method call. + + @return the number of hours in the duration, may be negative" + {:arglists (quote (["java.time.Duration"]))} + (^long [^js/JSJoda.Duration this] (.toHours this))) + +(defn of-nanos + "Obtains a {@code Duration} representing a number of nanoseconds. + + The seconds and nanoseconds are extracted from the specified nanoseconds. + + @param nanos the number of nanoseconds, positive or negative + @return a {@code Duration}, not null" + {:arglists (quote (["long"]))} + (^js/JSJoda.Duration [^long nanos] + (js-invoke java.time.Duration "ofNanos" nanos))) + +(defn of-millis + "Obtains a {@code Duration} representing a number of milliseconds. + + The seconds and nanoseconds are extracted from the specified milliseconds. + + @param millis the number of milliseconds, positive or negative + @return a {@code Duration}, not null" + {:arglists (quote (["long"]))} + (^js/JSJoda.Duration [^long millis] + (js-invoke java.time.Duration "ofMillis" millis))) + +(defn negated + "Returns a copy of this duration with the length negated. + + This method swaps the sign of the total length of this duration. + For example, {@code PT1.3S} will be returned as {@code PT-1.3S}. + + This instance is immutable and unaffected by this method call. + + @return a {@code Duration} based on this duration with the amount negated, not null + @throws ArithmeticException if numeric overflow occurs" + {:arglists (quote (["java.time.Duration"]))} + (^js/JSJoda.Duration [^js/JSJoda.Duration this] (.negated this))) + +(defn abs + "Returns a copy of this duration with a positive length. + + This method returns a positive duration by effectively removing the sign from any negative total length. + For example, {@code PT-1.3S} will be returned as {@code PT1.3S}. + + This instance is immutable and unaffected by this method call. + + @return a {@code Duration} based on this duration with an absolute length, not null + @throws ArithmeticException if numeric overflow occurs" + {:arglists (quote (["java.time.Duration"]))} + (^js/JSJoda.Duration [^js/JSJoda.Duration this] (.abs this))) + +(defn between + "Obtains a {@code Duration} representing the duration between two temporal objects. + + This calculates the duration between two temporal objects. If the objects + are of different types, then the duration is calculated based on the type + of the first object. For example, if the first argument is a {@code LocalTime} + then the second argument is converted to a {@code LocalTime}. + + The specified temporal objects must support the {@link ChronoUnit#SECONDS SECONDS} unit. + For full accuracy, either the {@link ChronoUnit#NANOS NANOS} unit or the + {@link ChronoField#NANO_OF_SECOND NANO_OF_SECOND} field should be supported. + + The result of this method can be a negative period if the end is before the start. + To guarantee to obtain a positive duration call {@link #abs()} on the result. + + @param startInclusive the start instant, inclusive, not null + @param endExclusive the end instant, exclusive, not null + @return a {@code Duration}, not null + @throws DateTimeException if the seconds between the temporals cannot be obtained + @throws ArithmeticException if the calculation exceeds the capacity of {@code Duration}" + {:arglists (quote (["java.time.temporal.Temporal" + "java.time.temporal.Temporal"]))} + (^js/JSJoda.Duration + [^js/JSJoda.Temporal start-inclusive ^js/JSJoda.Temporal end-exclusive] + (js-invoke java.time.Duration "between" start-inclusive end-exclusive))) + +(defn get-seconds + "Gets the number of seconds in this duration. + + The length of the duration is stored using two fields - seconds and nanoseconds. + The nanoseconds part is a value from 0 to 999,999,999 that is an adjustment to + the length in seconds. + The total duration is defined by calling this method and {@link #getNano()}. + + A {@code Duration} represents a directed distance between two points on the time-line. + A negative duration is expressed by the negative sign of the seconds part. + A duration of -1 nanosecond is stored as -1 seconds plus 999,999,999 nanoseconds. + + @return the whole seconds part of the length of the duration, positive or negative" + {:arglists (quote (["java.time.Duration"]))} + (^long [^js/JSJoda.Duration this] (.seconds this))) + +(defn from + "Obtains an instance of {@code Duration} from a temporal amount. + + This obtains a duration based on the specified amount. + A {@code TemporalAmount} represents an amount of time, which may be + date-based or time-based, which this factory extracts to a duration. + + The conversion loops around the set of units from the amount and uses + the {@linkplain TemporalUnit#getDuration() duration} of the unit to + calculate the total {@code Duration}. + Only a subset of units are accepted by this method. The unit must either + have an {@linkplain TemporalUnit#isDurationEstimated() exact duration} + or be {@link ChronoUnit#DAYS} which is treated as 24 hours. + If any other units are found then an exception is thrown. + + @param amount the temporal amount to convert, not null + @return the equivalent duration, not null + @throws DateTimeException if unable to convert to a {@code Duration} + @throws ArithmeticException if numeric overflow occurs" + {:arglists (quote (["java.time.temporal.TemporalAmount"]))} + (^js/JSJoda.Duration [^js/JSJoda.TemporalAmount amount] + (js-invoke java.time.Duration "from" amount))) + +(defn minus-nanos + "Returns a copy of this duration with the specified duration in nanoseconds subtracted. + + This instance is immutable and unaffected by this method call. + + @param nanosToSubtract the nanoseconds to subtract, positive or negative + @return a {@code Duration} based on this duration with the specified nanoseconds subtracted, not null + @throws ArithmeticException if numeric overflow occurs" + {:arglists (quote (["java.time.Duration" "long"]))} + (^js/JSJoda.Duration [^js/JSJoda.Duration this ^long nanos-to-subtract] + (.minusNanos this nanos-to-subtract))) + +(defn parse + "Obtains a {@code Duration} from a text string such as {@code PnDTnHnMn.nS}. + + This will parse a textual representation of a duration, including the + string produced by {@code toString()}. The formats accepted are based + on the ISO-8601 duration format {@code PnDTnHnMn.nS} with days + considered to be exactly 24 hours. + + The string starts with an optional sign, denoted by the ASCII negative + or positive symbol. If negative, the whole period is negated. + The ASCII letter \"P\" is next in upper or lower case. + There are then four sections, each consisting of a number and a suffix. + The sections have suffixes in ASCII of \"D\", \"H\", \"M\" and \"S\" for + days, hours, minutes and seconds, accepted in upper or lower case. + The suffixes must occur in order. The ASCII letter \"T\" must occur before + the first occurrence, if any, of an hour, minute or second section. + At least one of the four sections must be present, and if \"T\" is present + there must be at least one section after the \"T\". + The number part of each section must consist of one or more ASCII digits. + The number may be prefixed by the ASCII negative or positive symbol. + The number of days, hours and minutes must parse to an {@code long}. + The number of seconds must parse to an {@code long} with optional fraction. + The decimal point may be either a dot or a comma. + The fractional part may have from zero to 9 digits. + + The leading plus/minus sign, and negative values for other units are + not part of the ISO-8601 standard. + + Examples: +
+    \"PT20.345S\" -- parses as \"20.345 seconds\"
+    \"PT15M\"     -- parses as \"15 minutes\" (where a minute is 60 seconds)
+    \"PT10H\"     -- parses as \"10 hours\" (where an hour is 3600 seconds)
+    \"P2D\"       -- parses as \"2 days\" (where a day is 24 hours or 86400 seconds)
+    \"P2DT3H4M\"  -- parses as \"2 days, 3 hours and 4 minutes\"
+    \"P-6H3M\"    -- parses as \"-6 hours and +3 minutes\"
+    \"-P6H3M\"    -- parses as \"-6 hours and -3 minutes\"
+    \"-P-6H+3M\"  -- parses as \"+6 hours and -3 minutes\"
+ 
+ + @param text the text to parse, not null + @return the parsed duration, not null + @throws DateTimeParseException if the text cannot be parsed to a duration" + {:arglists (quote (["java.lang.CharSequence"]))} + (^js/JSJoda.Duration [^java.lang.CharSequence text] + (js-invoke java.time.Duration "parse" text))) + +(defn hash-code + "A hash code for this duration. + + @return a suitable hash code" + {:arglists (quote (["java.time.Duration"]))} + (^int [^js/JSJoda.Duration this] (.hashCode this))) + +(defn with-seconds + "Returns a copy of this duration with the specified amount of seconds. + + This returns a duration with the specified seconds, retaining the + nano-of-second part of this duration. + + This instance is immutable and unaffected by this method call. + + @param seconds the seconds to represent, may be negative + @return a {@code Duration} based on this period with the requested seconds, not null" + {:arglists (quote (["java.time.Duration" "long"]))} + (^js/JSJoda.Duration [^js/JSJoda.Duration this ^long seconds] + (.withSeconds this seconds))) + +(defn of-minutes + "Obtains a {@code Duration} representing a number of standard minutes. + + The seconds are calculated based on the standard definition of a minute, + where each minute is 60 seconds. + The nanosecond in second field is set to zero. + + @param minutes the number of minutes, positive or negative + @return a {@code Duration}, not null + @throws ArithmeticException if the input minutes exceeds the capacity of {@code Duration}" + {:arglists (quote (["long"]))} + (^js/JSJoda.Duration [^long minutes] + (js-invoke java.time.Duration "ofMinutes" minutes))) + +(defn subtract-from + "Subtracts this duration from the specified temporal object. + + This returns a temporal object of the same observable type as the input + with this duration subtracted. + + In most cases, it is clearer to reverse the calling pattern by using + {@link Temporal#minus(TemporalAmount)}. +
+   // these two lines are equivalent, but the second approach is recommended
+   dateTime = thisDuration.subtractFrom(dateTime);
+   dateTime = dateTime.minus(thisDuration);
+ 
+ + The calculation will subtract the seconds, then nanos. + Only non-zero amounts will be added. + + This instance is immutable and unaffected by this method call. + + @param temporal the temporal object to adjust, not null + @return an object of the same type with the adjustment made, not null + @throws DateTimeException if unable to subtract + @throws ArithmeticException if numeric overflow occurs" + {:arglists (quote (["java.time.Duration" "java.time.temporal.Temporal"]))} + (^js/JSJoda.Temporal [^js/JSJoda.Duration this ^js/JSJoda.Temporal temporal] + (.subtractFrom this temporal))) + +(defn compare-to + "Compares this duration to the specified {@code Duration}. + + The comparison is based on the total length of the durations. + It is \"consistent with equals\", as defined by {@link Comparable}. + + @param otherDuration the other duration to compare to, not null + @return the comparator value, negative if less, positive if greater" + {:arglists (quote (["java.time.Duration" "java.time.Duration"]))} + (^int [^js/JSJoda.Duration this ^js/JSJoda.Duration other-duration] + (.compareTo this other-duration))) + +(defn plus-seconds + "Returns a copy of this duration with the specified duration in seconds added. + + This instance is immutable and unaffected by this method call. + + @param secondsToAdd the seconds to add, positive or negative + @return a {@code Duration} based on this duration with the specified seconds added, not null + @throws ArithmeticException if numeric overflow occurs" + {:arglists (quote (["java.time.Duration" "long"]))} + (^js/JSJoda.Duration [^js/JSJoda.Duration this ^long seconds-to-add] + (.plusSeconds this seconds-to-add))) + +(defn get + "Gets the value of the requested unit. + + This returns a value for each of the two supported units, + {@link ChronoUnit#SECONDS SECONDS} and {@link ChronoUnit#NANOS NANOS}. + All other units throw an exception. + + @param unit the {@code TemporalUnit} for which to return the value + @return the long value of the unit + @throws DateTimeException if the unit is not supported + @throws UnsupportedTemporalTypeException if the unit is not supported" + {:arglists (quote (["java.time.Duration" "java.time.temporal.TemporalUnit"]))} + (^long [^js/JSJoda.Duration this ^js/JSJoda.TemporalUnit unit] + (.get this unit))) + +(defn equals + "Checks if this duration is equal to the specified {@code Duration}. + + The comparison is based on the total length of the durations. + + @param otherDuration the other duration, null returns false + @return true if the other duration is equal to this one" + {:arglists (quote (["java.time.Duration" "java.lang.Object"]))} + (^boolean [^js/JSJoda.Duration this ^java.lang.Object other-duration] + (.equals this other-duration))) + +(defn of-seconds + {:arglists (quote (["long"] ["long" "long"]))} + (^js/JSJoda.Duration [^long seconds] + (js-invoke java.time.Duration "ofSeconds" seconds)) + (^js/JSJoda.Duration [^long seconds ^long nano-adjustment] + (js-invoke java.time.Duration "ofSeconds" seconds nano-adjustment))) + +(defn minus-days + "Returns a copy of this duration with the specified duration in standard 24 hour days subtracted. + + The number of days is multiplied by 86400 to obtain the number of seconds to subtract. + This is based on the standard definition of a day as 24 hours. + + This instance is immutable and unaffected by this method call. + + @param daysToSubtract the days to subtract, positive or negative + @return a {@code Duration} based on this duration with the specified days subtracted, not null + @throws ArithmeticException if numeric overflow occurs" + {:arglists (quote (["java.time.Duration" "long"]))} + (^js/JSJoda.Duration [^js/JSJoda.Duration this ^long days-to-subtract] + (.minusDays this days-to-subtract))) + +(defn to-days + "Gets the number of days in this duration. + + This returns the total number of days in the duration by dividing the + number of seconds by 86400. + This is based on the standard definition of a day as 24 hours. + + This instance is immutable and unaffected by this method call. + + @return the number of days in the duration, may be negative" + {:arglists (quote (["java.time.Duration"]))} + (^long [^js/JSJoda.Duration this] (.toDays this))) diff --git a/src/cljc/java_time/format/date_time_formatter.clj b/src/cljc/java_time/format/date_time_formatter.clj index 756967d..a7d5169 100644 --- a/src/cljc/java_time/format/date_time_formatter.clj +++ b/src/cljc/java_time/format/date_time_formatter.clj @@ -1,41 +1,924 @@ -(ns cljc.java-time.format.date-time-formatter (:refer-clojure :exclude [abs get range format min max next name resolve short]) (:require [cljc.java-time.extn.calendar-awareness]) (:import [java.time.format DateTimeFormatter])) -(def iso-local-time java.time.format.DateTimeFormatter/ISO_LOCAL_TIME) -(def iso-ordinal-date java.time.format.DateTimeFormatter/ISO_ORDINAL_DATE) -(def iso-offset-date java.time.format.DateTimeFormatter/ISO_OFFSET_DATE) -(def iso-time java.time.format.DateTimeFormatter/ISO_TIME) -(def iso-local-date-time java.time.format.DateTimeFormatter/ISO_LOCAL_DATE_TIME) -(def iso-instant java.time.format.DateTimeFormatter/ISO_INSTANT) -(def rfc-1123-date-time java.time.format.DateTimeFormatter/RFC_1123_DATE_TIME) -(def iso-date java.time.format.DateTimeFormatter/ISO_DATE) -(def iso-week-date java.time.format.DateTimeFormatter/ISO_WEEK_DATE) -(def iso-offset-time java.time.format.DateTimeFormatter/ISO_OFFSET_TIME) -(def iso-local-date java.time.format.DateTimeFormatter/ISO_LOCAL_DATE) -(def iso-zoned-date-time java.time.format.DateTimeFormatter/ISO_ZONED_DATE_TIME) -(def iso-offset-date-time java.time.format.DateTimeFormatter/ISO_OFFSET_DATE_TIME) -(def iso-date-time java.time.format.DateTimeFormatter/ISO_DATE_TIME) -(def basic-iso-date java.time.format.DateTimeFormatter/BASIC_ISO_DATE) -(clojure.core/defn of-pattern {:arglists (quote (["java.lang.String"] ["java.lang.String" "java.util.Locale"]))} (^java.time.format.DateTimeFormatter [^java.lang.String java-lang-String15874] (java.time.format.DateTimeFormatter/ofPattern java-lang-String15874)) (^java.time.format.DateTimeFormatter [^java.lang.String java-lang-String15875 ^java.util.Locale java-util-Locale15876] (java.time.format.DateTimeFormatter/ofPattern java-lang-String15875 java-util-Locale15876))) -(clojure.core/defn parse-best {:arglists (quote (["java.time.format.DateTimeFormatter" "java.lang.CharSequence" "[Ljava.time.temporal.TemporalQuery;"]))} (^java.time.temporal.TemporalAccessor [^java.time.format.DateTimeFormatter this15877 ^java.lang.CharSequence java-lang-CharSequence15878 ^"java.lang.Class" java-time-temporal-TemporalQuery-array15879] (.parseBest this15877 java-lang-CharSequence15878 java-time-temporal-TemporalQuery-array15879))) -(clojure.core/defn format-to {:arglists (quote (["java.time.format.DateTimeFormatter" "java.time.temporal.TemporalAccessor" "java.lang.Appendable"]))} (^java.lang.Object [^java.time.format.DateTimeFormatter this15880 ^java.time.temporal.TemporalAccessor java-time-temporal-TemporalAccessor15881 ^java.lang.Appendable java-lang-Appendable15882] (.formatTo this15880 java-time-temporal-TemporalAccessor15881 java-lang-Appendable15882))) -(clojure.core/defn get-decimal-style {:arglists (quote (["java.time.format.DateTimeFormatter"]))} (^java.time.format.DecimalStyle [^java.time.format.DateTimeFormatter this15883] (.getDecimalStyle this15883))) -(clojure.core/defn with-chronology {:arglists (quote (["java.time.format.DateTimeFormatter" "java.time.chrono.Chronology"]))} (^java.time.format.DateTimeFormatter [^java.time.format.DateTimeFormatter this15884 ^java.time.chrono.Chronology java-time-chrono-Chronology15885] (.withChronology this15884 java-time-chrono-Chronology15885))) -(clojure.core/defn get-resolver-style {:arglists (quote (["java.time.format.DateTimeFormatter"]))} (^java.time.format.ResolverStyle [^java.time.format.DateTimeFormatter this15886] (.getResolverStyle this15886))) -(clojure.core/defn with-decimal-style {:arglists (quote (["java.time.format.DateTimeFormatter" "java.time.format.DecimalStyle"]))} (^java.time.format.DateTimeFormatter [^java.time.format.DateTimeFormatter this15887 ^java.time.format.DecimalStyle java-time-format-DecimalStyle15888] (.withDecimalStyle this15887 java-time-format-DecimalStyle15888))) -(clojure.core/defn get-locale {:arglists (quote (["java.time.format.DateTimeFormatter"]))} (^java.util.Locale [^java.time.format.DateTimeFormatter this15889] (.getLocale this15889))) -(clojure.core/defn to-string {:arglists (quote (["java.time.format.DateTimeFormatter"]))} (^java.lang.String [^java.time.format.DateTimeFormatter this15890] (.toString this15890))) -(clojure.core/defn parsed-leap-second {:arglists (quote ([]))} (^java.time.temporal.TemporalQuery [] (java.time.format.DateTimeFormatter/parsedLeapSecond))) -(clojure.core/defn with-zone {:arglists (quote (["java.time.format.DateTimeFormatter" "java.time.ZoneId"]))} (^java.time.format.DateTimeFormatter [^java.time.format.DateTimeFormatter this15891 ^java.time.ZoneId java-time-ZoneId15892] (.withZone this15891 java-time-ZoneId15892))) -(clojure.core/defn parsed-excess-days {:arglists (quote ([]))} (^java.time.temporal.TemporalQuery [] (java.time.format.DateTimeFormatter/parsedExcessDays))) -(clojure.core/defn get-zone {:arglists (quote (["java.time.format.DateTimeFormatter"]))} (^java.time.ZoneId [^java.time.format.DateTimeFormatter this15893] (.getZone this15893))) -(clojure.core/defn of-localized-date-time {:arglists (quote (["java.time.format.FormatStyle"] ["java.time.format.FormatStyle" "java.time.format.FormatStyle"]))} (^java.time.format.DateTimeFormatter [^java.time.format.FormatStyle java-time-format-FormatStyle15894] (java.time.format.DateTimeFormatter/ofLocalizedDateTime java-time-format-FormatStyle15894)) (^java.time.format.DateTimeFormatter [^java.time.format.FormatStyle java-time-format-FormatStyle15895 ^java.time.format.FormatStyle java-time-format-FormatStyle15896] (java.time.format.DateTimeFormatter/ofLocalizedDateTime java-time-format-FormatStyle15895 java-time-format-FormatStyle15896))) -(clojure.core/defn get-resolver-fields {:arglists (quote (["java.time.format.DateTimeFormatter"]))} (^java.util.Set [^java.time.format.DateTimeFormatter this15897] (.getResolverFields this15897))) -(clojure.core/defn get-chronology {:arglists (quote (["java.time.format.DateTimeFormatter"]))} (^java.time.chrono.Chronology [^java.time.format.DateTimeFormatter this15898] (.getChronology this15898))) -(clojure.core/defn parse {:arglists (quote (["java.time.format.DateTimeFormatter" "java.lang.CharSequence" "java.time.temporal.TemporalQuery"] ["java.time.format.DateTimeFormatter" "java.lang.CharSequence"] ["java.time.format.DateTimeFormatter" "java.lang.CharSequence" "java.text.ParsePosition"]))} (^java.lang.Object [this15899 G__15900 G__15901] (clojure.core/cond (clojure.core/and (clojure.core/instance? java.lang.CharSequence G__15900) (clojure.core/instance? java.time.temporal.TemporalQuery G__15901)) (clojure.core/let [G__15900 ^"java.lang.CharSequence" G__15900 G__15901 ^"java.time.temporal.TemporalQuery" G__15901] (.parse ^java.time.format.DateTimeFormatter this15899 G__15900 G__15901)) (clojure.core/and (clojure.core/instance? java.lang.CharSequence G__15900) (clojure.core/instance? java.text.ParsePosition G__15901)) (clojure.core/let [G__15900 ^"java.lang.CharSequence" G__15900 G__15901 ^"java.text.ParsePosition" G__15901] (.parse ^java.time.format.DateTimeFormatter this15899 G__15900 G__15901)) :else (throw (java.lang.IllegalArgumentException. "no corresponding java.time method with these args")))) (^java.time.temporal.TemporalAccessor [^java.time.format.DateTimeFormatter this15902 ^java.lang.CharSequence java-lang-CharSequence15903] (.parse this15902 java-lang-CharSequence15903))) -(clojure.core/defn with-locale {:arglists (quote (["java.time.format.DateTimeFormatter" "java.util.Locale"]))} (^java.time.format.DateTimeFormatter [^java.time.format.DateTimeFormatter this15904 ^java.util.Locale java-util-Locale15905] (.withLocale this15904 java-util-Locale15905))) -(clojure.core/defn with-resolver-fields {:arglists (quote (["java.time.format.DateTimeFormatter" "java.util.Set"] ["java.time.format.DateTimeFormatter" "[Ljava.time.temporal.TemporalField;"]))} (^java.time.format.DateTimeFormatter [this15906 G__15907] (clojure.core/cond (clojure.core/and (clojure.core/instance? java.util.Set G__15907)) (clojure.core/let [G__15907 ^"java.util.Set" G__15907] (.withResolverFields ^java.time.format.DateTimeFormatter this15906 G__15907)) (clojure.core/and (clojure.core/= java.time.temporal.TemporalField (.getComponentType (clojure.core/class G__15907)))) (clojure.core/let [G__15907 ^"[Ljava.time.temporal.TemporalField;" G__15907] (.withResolverFields ^java.time.format.DateTimeFormatter this15906 G__15907)) :else (throw (java.lang.IllegalArgumentException. "no corresponding java.time method with these args"))))) -(clojure.core/defn parse-unresolved {:arglists (quote (["java.time.format.DateTimeFormatter" "java.lang.CharSequence" "java.text.ParsePosition"]))} (^java.time.temporal.TemporalAccessor [^java.time.format.DateTimeFormatter this15908 ^java.lang.CharSequence java-lang-CharSequence15909 ^java.text.ParsePosition java-text-ParsePosition15910] (.parseUnresolved this15908 java-lang-CharSequence15909 java-text-ParsePosition15910))) -(clojure.core/defn of-localized-time {:arglists (quote (["java.time.format.FormatStyle"]))} (^java.time.format.DateTimeFormatter [^java.time.format.FormatStyle java-time-format-FormatStyle15911] (java.time.format.DateTimeFormatter/ofLocalizedTime java-time-format-FormatStyle15911))) -(clojure.core/defn of-localized-date {:arglists (quote (["java.time.format.FormatStyle"]))} (^java.time.format.DateTimeFormatter [^java.time.format.FormatStyle java-time-format-FormatStyle15912] (java.time.format.DateTimeFormatter/ofLocalizedDate java-time-format-FormatStyle15912))) -(clojure.core/defn format {:arglists (quote (["java.time.format.DateTimeFormatter" "java.time.temporal.TemporalAccessor"]))} (^java.lang.String [^java.time.format.DateTimeFormatter this15913 ^java.time.temporal.TemporalAccessor java-time-temporal-TemporalAccessor15914] (cljc.java-time.extn.calendar-awareness/calendar-aware-clj (.format this15913 java-time-temporal-TemporalAccessor15914)))) -(clojure.core/defn to-format {:arglists (quote (["java.time.format.DateTimeFormatter"] ["java.time.format.DateTimeFormatter" "java.time.temporal.TemporalQuery"]))} (^java.text.Format [^java.time.format.DateTimeFormatter this15915] (.toFormat this15915)) (^java.text.Format [^java.time.format.DateTimeFormatter this15916 ^java.time.temporal.TemporalQuery java-time-temporal-TemporalQuery15917] (.toFormat this15916 java-time-temporal-TemporalQuery15917))) -(clojure.core/defn with-resolver-style {:arglists (quote (["java.time.format.DateTimeFormatter" "java.time.format.ResolverStyle"]))} (^java.time.format.DateTimeFormatter [^java.time.format.DateTimeFormatter this15918 ^java.time.format.ResolverStyle java-time-format-ResolverStyle15919] (.withResolverStyle this15918 java-time-format-ResolverStyle15919))) +(ns cljc.java-time.format.date-time-formatter + (:refer-clojure :exclude + [abs get range format min max next name resolve short]) + (:require [cljc.java-time.extn.calendar-awareness]) + (:import [java.time.format DateTimeFormatter])) + +(def iso-local-time + "The ISO time formatter that formats or parses a time without an + offset, such as '10:15' or '10:15:30'. + + This returns an immutable formatter capable of formatting and parsing + the ISO-8601 extended local time format. + The format consists of: + + + The returned formatter has no override chronology or zone. + It uses the {@link ResolverStyle#STRICT STRICT} resolver style." + java.time.format.DateTimeFormatter/ISO_LOCAL_TIME) + +(def iso-ordinal-date + "The ISO date formatter that formats or parses the ordinal date + without an offset, such as '2012-337'. + + This returns an immutable formatter capable of formatting and parsing + the ISO-8601 extended ordinal date format. + The format consists of: + + + As this formatter has an optional element, it may be necessary to parse using + {@link DateTimeFormatter#parseBest}. + + The returned formatter has a chronology of ISO set to ensure dates in + other calendar systems are correctly converted. + It has no override zone and uses the {@link ResolverStyle#STRICT STRICT} resolver style." + java.time.format.DateTimeFormatter/ISO_ORDINAL_DATE) + +(def iso-offset-date + "The ISO date formatter that formats or parses a date with an + offset, such as '2011-12-03+01:00'. + + This returns an immutable formatter capable of formatting and parsing + the ISO-8601 extended offset date format. + The format consists of: + + + The returned formatter has a chronology of ISO set to ensure dates in + other calendar systems are correctly converted. + It has no override zone and uses the {@link ResolverStyle#STRICT STRICT} resolver style." + java.time.format.DateTimeFormatter/ISO_OFFSET_DATE) + +(def iso-time + "The ISO time formatter that formats or parses a time, with the + offset if available, such as '10:15', '10:15:30' or '10:15:30+01:00'. + + This returns an immutable formatter capable of formatting and parsing + the ISO-8601 extended offset time format. + The format consists of: + + + As this formatter has an optional element, it may be necessary to parse using + {@link DateTimeFormatter#parseBest}. + + The returned formatter has no override chronology or zone. + It uses the {@link ResolverStyle#STRICT STRICT} resolver style." + java.time.format.DateTimeFormatter/ISO_TIME) + +(def iso-local-date-time + "The ISO date-time formatter that formats or parses a date-time without + an offset, such as '2011-12-03T10:15:30'. + + This returns an immutable formatter capable of formatting and parsing + the ISO-8601 extended offset date-time format. + The format consists of: + + + The returned formatter has a chronology of ISO set to ensure dates in + other calendar systems are correctly converted. + It has no override zone and uses the {@link ResolverStyle#STRICT STRICT} resolver style." + java.time.format.DateTimeFormatter/ISO_LOCAL_DATE_TIME) + +(def iso-instant + "The ISO instant formatter that formats or parses an instant in UTC, + such as '2011-12-03T10:15:30Z'. + + This returns an immutable formatter capable of formatting and parsing + the ISO-8601 instant format. + When formatting, the second-of-minute is always output. + The nano-of-second outputs zero, three, six or nine digits digits as necessary. + When parsing, time to at least the seconds field is required. + Fractional seconds from zero to nine are parsed. + The localized decimal style is not used. + + This is a special case formatter intended to allow a human readable form + of an {@link java.time.Instant}. The {@code Instant} class is designed to + only represent a point in time and internally stores a value in nanoseconds + from a fixed epoch of 1970-01-01Z. As such, an {@code Instant} cannot be + formatted as a date or time without providing some form of time-zone. + This formatter allows the {@code Instant} to be formatted, by providing + a suitable conversion using {@code ZoneOffset.UTC}. + + The format consists of: + + + The returned formatter has no override chronology or zone. + It uses the {@link ResolverStyle#STRICT STRICT} resolver style." + java.time.format.DateTimeFormatter/ISO_INSTANT) + +(def rfc-1123-date-time + "The RFC-1123 date-time formatter, such as 'Tue, 3 Jun 2008 11:05:30 GMT'. + + This returns an immutable formatter capable of formatting and parsing + most of the RFC-1123 format. + RFC-1123 updates RFC-822 changing the year from two digits to four. + This implementation requires a four digit year. + This implementation also does not handle North American or military zone + names, only 'GMT' and offset amounts. + + The format consists of: + + + Parsing is case insensitive. + + The returned formatter has a chronology of ISO set to ensure dates in + other calendar systems are correctly converted. + It has no override zone and uses the {@link ResolverStyle#SMART SMART} resolver style." + java.time.format.DateTimeFormatter/RFC_1123_DATE_TIME) + +(def iso-date + "The ISO date formatter that formats or parses a date with the + offset if available, such as '2011-12-03' or '2011-12-03+01:00'. + + This returns an immutable formatter capable of formatting and parsing + the ISO-8601 extended date format. + The format consists of: + + + As this formatter has an optional element, it may be necessary to parse using + {@link DateTimeFormatter#parseBest}. + + The returned formatter has a chronology of ISO set to ensure dates in + other calendar systems are correctly converted. + It has no override zone and uses the {@link ResolverStyle#STRICT STRICT} resolver style." + java.time.format.DateTimeFormatter/ISO_DATE) + +(def iso-week-date + "The ISO date formatter that formats or parses the week-based date + without an offset, such as '2012-W48-6'. + + This returns an immutable formatter capable of formatting and parsing + the ISO-8601 extended week-based date format. + The format consists of: + + + As this formatter has an optional element, it may be necessary to parse using + {@link DateTimeFormatter#parseBest}. + + The returned formatter has a chronology of ISO set to ensure dates in + other calendar systems are correctly converted. + It has no override zone and uses the {@link ResolverStyle#STRICT STRICT} resolver style." + java.time.format.DateTimeFormatter/ISO_WEEK_DATE) + +(def iso-offset-time + "The ISO time formatter that formats or parses a time with an + offset, such as '10:15+01:00' or '10:15:30+01:00'. + + This returns an immutable formatter capable of formatting and parsing + the ISO-8601 extended offset time format. + The format consists of: + + + The returned formatter has no override chronology or zone. + It uses the {@link ResolverStyle#STRICT STRICT} resolver style." + java.time.format.DateTimeFormatter/ISO_OFFSET_TIME) + +(def iso-local-date + "The ISO date formatter that formats or parses a date without an + offset, such as '2011-12-03'. + + This returns an immutable formatter capable of formatting and parsing + the ISO-8601 extended local date format. + The format consists of: + + + The returned formatter has a chronology of ISO set to ensure dates in + other calendar systems are correctly converted. + It has no override zone and uses the {@link ResolverStyle#STRICT STRICT} resolver style." + java.time.format.DateTimeFormatter/ISO_LOCAL_DATE) + +(def iso-zoned-date-time + "The ISO-like date-time formatter that formats or parses a date-time with + offset and zone, such as '2011-12-03T10:15:30+01:00[Europe/Paris]'. + + This returns an immutable formatter capable of formatting and parsing + a format that extends the ISO-8601 extended offset date-time format + to add the time-zone. + The section in square brackets is not part of the ISO-8601 standard. + The format consists of: + + + The returned formatter has a chronology of ISO set to ensure dates in + other calendar systems are correctly converted. + It has no override zone and uses the {@link ResolverStyle#STRICT STRICT} resolver style." + java.time.format.DateTimeFormatter/ISO_ZONED_DATE_TIME) + +(def iso-offset-date-time + "The ISO date-time formatter that formats or parses a date-time with an + offset, such as '2011-12-03T10:15:30+01:00'. + + This returns an immutable formatter capable of formatting and parsing + the ISO-8601 extended offset date-time format. + The format consists of: + + + The returned formatter has a chronology of ISO set to ensure dates in + other calendar systems are correctly converted. + It has no override zone and uses the {@link ResolverStyle#STRICT STRICT} resolver style." + java.time.format.DateTimeFormatter/ISO_OFFSET_DATE_TIME) + +(def iso-date-time + "The ISO-like date-time formatter that formats or parses a date-time with + the offset and zone if available, such as '2011-12-03T10:15:30', + '2011-12-03T10:15:30+01:00' or '2011-12-03T10:15:30+01:00[Europe/Paris]'. + + This returns an immutable formatter capable of formatting and parsing + the ISO-8601 extended local or offset date-time format, as well as the + extended non-ISO form specifying the time-zone. + The format consists of: + + + As this formatter has an optional element, it may be necessary to parse using + {@link DateTimeFormatter#parseBest}. + + The returned formatter has a chronology of ISO set to ensure dates in + other calendar systems are correctly converted. + It has no override zone and uses the {@link ResolverStyle#STRICT STRICT} resolver style." + java.time.format.DateTimeFormatter/ISO_DATE_TIME) + +(def basic-iso-date + "The ISO date formatter that formats or parses a date without an + offset, such as '20111203'. + + This returns an immutable formatter capable of formatting and parsing + the ISO-8601 basic local date format. + The format consists of: + + + As this formatter has an optional element, it may be necessary to parse using + {@link DateTimeFormatter#parseBest}. + + The returned formatter has a chronology of ISO set to ensure dates in + other calendar systems are correctly converted. + It has no override zone and uses the {@link ResolverStyle#STRICT STRICT} resolver style." + java.time.format.DateTimeFormatter/BASIC_ISO_DATE) + +(defn of-pattern + {:arglists (quote (["java.lang.String"] + ["java.lang.String" "java.util.Locale"]))} + (^java.time.format.DateTimeFormatter [^java.lang.String pattern] + (java.time.format.DateTimeFormatter/ofPattern pattern)) + (^java.time.format.DateTimeFormatter + [^java.lang.String pattern ^java.util.Locale locale] + (java.time.format.DateTimeFormatter/ofPattern pattern locale))) + +(defn parse-best + "Fully parses the text producing an object of one of the specified types. + + This parse method is convenient for use when the parser can handle optional elements. + For example, a pattern of 'uuuu-MM-dd HH.mm[ VV]' can be fully parsed to a {@code ZonedDateTime}, + or partially parsed to a {@code LocalDateTime}. + The queries must be specified in order, starting from the best matching full-parse option + and ending with the worst matching minimal parse option. + The query is typically a method reference to a {@code from(TemporalAccessor)} method. + + The result is associated with the first type that successfully parses. + Normally, applications will use {@code instanceof} to check the result. + For example: +
+  TemporalAccessor dt = parser.parseBest(str, ZonedDateTime::from, LocalDateTime::from);
+  if (dt instanceof ZonedDateTime) {
+   ...
+  } else {
+   ...
+  }
+ 
+ If the parse completes without reading the entire length of the text, + or a problem occurs during parsing or merging, then an exception is thrown. + + @param text the text to parse, not null + @param queries the queries defining the types to attempt to parse to, + must implement {@code TemporalAccessor}, not null + @return the parsed date-time, not null + @throws IllegalArgumentException if less than 2 types are specified + @throws DateTimeParseException if unable to parse the requested result" + {:arglists (quote (["java.time.format.DateTimeFormatter" + "java.lang.CharSequence" + "[Ljava.time.temporal.TemporalQuery;"]))} + (^java.time.temporal.TemporalAccessor + [^java.time.format.DateTimeFormatter this ^java.lang.CharSequence text + ^"java.lang.Class" queries] + (.parseBest this text queries))) + +(defn format-to + "Formats a date-time object to an {@code Appendable} using this formatter. + + This outputs the formatted date-time to the specified destination. + {@link Appendable} is a general purpose interface that is implemented by all + key character output classes including {@code StringBuffer}, {@code StringBuilder}, + {@code PrintStream} and {@code Writer}. + + Although {@code Appendable} methods throw an {@code IOException}, this method does not. + Instead, any {@code IOException} is wrapped in a runtime exception. + + @param temporal the temporal object to format, not null + @param appendable the appendable to format to, not null + @throws DateTimeException if an error occurs during formatting" + {:arglists (quote (["java.time.format.DateTimeFormatter" + "java.time.temporal.TemporalAccessor" + "java.lang.Appendable"]))} + (^java.lang.Object + [^java.time.format.DateTimeFormatter this + ^java.time.temporal.TemporalAccessor temporal + ^java.lang.Appendable appendable] + (.formatTo this temporal appendable))) + +(defn get-decimal-style + "Gets the DecimalStyle to be used during formatting. + + @return the locale of this formatter, not null" + {:arglists (quote (["java.time.format.DateTimeFormatter"]))} + (^java.time.format.DecimalStyle [^java.time.format.DateTimeFormatter this] + (.getDecimalStyle this))) + +(defn with-chronology + "Returns a copy of this formatter with a new override chronology. + + This returns a formatter with similar state to this formatter but + with the override chronology set. + By default, a formatter has no override chronology, returning null. + + If an override is added, then any date that is formatted or parsed will be affected. + + When formatting, if the temporal object contains a date, then it will + be converted to a date in the override chronology. + Whether the temporal contains a date is determined by querying the + {@link ChronoField#EPOCH_DAY EPOCH_DAY} field. + Any time or zone will be retained unaltered unless overridden. + + If the temporal object does not contain a date, but does contain one + or more {@code ChronoField} date fields, then a {@code DateTimeException} + is thrown. In all other cases, the override chronology is added to the temporal, + replacing any previous chronology, but without changing the date/time. + + When parsing, there are two distinct cases to consider. + If a chronology has been parsed directly from the text, perhaps because + {@link DateTimeFormatterBuilder#appendChronologyId()} was used, then + this override chronology has no effect. + If no zone has been parsed, then this override chronology will be used + to interpret the {@code ChronoField} values into a date according to the + date resolving rules of the chronology. + + This instance is immutable and unaffected by this method call. + + @param chrono the new chronology, null if no override + @return a formatter based on this formatter with the requested override chronology, not null" + {:arglists (quote (["java.time.format.DateTimeFormatter" + "java.time.chrono.Chronology"]))} + (^java.time.format.DateTimeFormatter + [^java.time.format.DateTimeFormatter this + ^java.time.chrono.Chronology chrono] + (.withChronology this chrono))) + +(defn get-resolver-style + "Gets the resolver style to use during parsing. + + This returns the resolver style, used during the second phase of parsing + when fields are resolved into dates and times. + By default, a formatter has the {@link ResolverStyle#SMART SMART} resolver style. + See {@link #withResolverStyle(ResolverStyle)} for more details. + + @return the resolver style of this formatter, not null" + {:arglists (quote (["java.time.format.DateTimeFormatter"]))} + (^java.time.format.ResolverStyle [^java.time.format.DateTimeFormatter this] + (.getResolverStyle this))) + +(defn with-decimal-style + "Returns a copy of this formatter with a new DecimalStyle. + + This instance is immutable and unaffected by this method call. + + @param decimalStyle the new DecimalStyle, not null + @return a formatter based on this formatter with the requested DecimalStyle, not null" + {:arglists (quote (["java.time.format.DateTimeFormatter" + "java.time.format.DecimalStyle"]))} + (^java.time.format.DateTimeFormatter + [^java.time.format.DateTimeFormatter this + ^java.time.format.DecimalStyle decimal-style] + (.withDecimalStyle this decimal-style))) + +(defn get-locale + "Gets the locale to be used during formatting. + + This is used to lookup any part of the formatter needing specific + localization, such as the text or localized pattern. + + @return the locale of this formatter, not null" + {:arglists (quote (["java.time.format.DateTimeFormatter"]))} + (^java.util.Locale [^java.time.format.DateTimeFormatter this] + (.getLocale this))) + +(defn to-string + "Returns a description of the underlying formatters. + + @return a description of this formatter, not null" + {:arglists (quote (["java.time.format.DateTimeFormatter"]))} + (^java.lang.String [^java.time.format.DateTimeFormatter this] + (.toString this))) + +(defn parsed-leap-second + "A query that provides access to whether a leap-second was parsed. + + This returns a singleton {@linkplain TemporalQuery query} that provides + access to additional information from the parse. The query always returns + a non-null boolean, true if parsing saw a leap-second, false if not. + + Instant parsing handles the special \"leap second\" time of '23:59:60'. + Leap seconds occur at '23:59:60' in the UTC time-zone, but at other + local times in different time-zones. To avoid this potential ambiguity, + the handling of leap-seconds is limited to + {@link DateTimeFormatterBuilder#appendInstant()}, as that method + always parses the instant with the UTC zone offset. + + If the time '23:59:60' is received, then a simple conversion is applied, + replacing the second-of-minute of 60 with 59. This query can be used + on the parse result to determine if the leap-second adjustment was made. + The query will return {@code true} if it did adjust to remove the + leap-second, and {@code false} if not. Note that applying a leap-second + smoothing mechanism, such as UTC-SLS, is the responsibility of the + application, as follows: +
+  TemporalAccessor parsed = formatter.parse(str);
+  Instant instant = parsed.query(Instant::from);
+  if (parsed.query(DateTimeFormatter.parsedLeapSecond())) {
+    // validate leap-second is correct and apply correct smoothing
+  }
+ 
+ @return a query that provides access to whether a leap-second was parsed" + {:arglists (quote ([]))} + (^java.time.temporal.TemporalQuery [] + (java.time.format.DateTimeFormatter/parsedLeapSecond))) + +(defn with-zone + "Returns a copy of this formatter with a new override zone. + + This returns a formatter with similar state to this formatter but + with the override zone set. + By default, a formatter has no override zone, returning null. + + If an override is added, then any instant that is formatted or parsed will be affected. + + When formatting, if the temporal object contains an instant, then it will + be converted to a zoned date-time using the override zone. + Whether the temporal is an instant is determined by querying the + {@link ChronoField#INSTANT_SECONDS INSTANT_SECONDS} field. + If the input has a chronology then it will be retained unless overridden. + If the input does not have a chronology, such as {@code Instant}, then + the ISO chronology will be used. + + If the temporal object does not contain an instant, but does contain + an offset then an additional check is made. If the normalized override + zone is an offset that differs from the offset of the temporal, then + a {@code DateTimeException} is thrown. In all other cases, the override + zone is added to the temporal, replacing any previous zone, but without + changing the date/time. + + When parsing, there are two distinct cases to consider. + If a zone has been parsed directly from the text, perhaps because + {@link DateTimeFormatterBuilder#appendZoneId()} was used, then + this override zone has no effect. + If no zone has been parsed, then this override zone will be included in + the result of the parse where it can be used to build instants and date-times. + + This instance is immutable and unaffected by this method call. + + @param zone the new override zone, null if no override + @return a formatter based on this formatter with the requested override zone, not null" + {:arglists (quote (["java.time.format.DateTimeFormatter" + "java.time.ZoneId"]))} + (^java.time.format.DateTimeFormatter + [^java.time.format.DateTimeFormatter this ^java.time.ZoneId zone] + (.withZone this zone))) + +(defn parsed-excess-days + "A query that provides access to the excess days that were parsed. + + This returns a singleton {@linkplain TemporalQuery query} that provides + access to additional information from the parse. The query always returns + a non-null period, with a zero period returned instead of null. + + There are two situations where this query may return a non-zero period. + + + In both cases, if a complete {@code ChronoLocalDateTime} or {@code Instant} + is parsed, then the excess days are added to the date part. + As a result, this query will return a zero period. + + The {@code SMART} behaviour handles the common \"end of day\" 24:00 value. + Processing in {@code LENIENT} mode also produces the same result: +
+  Text to parse        Parsed object                         Excess days
+  \"2012-12-03T00:00\"   LocalDateTime.of(2012, 12, 3, 0, 0)   ZERO
+  \"2012-12-03T24:00\"   LocalDateTime.of(2012, 12, 4, 0, 0)   ZERO
+  \"00:00\"              LocalTime.of(0, 0)                    ZERO
+  \"24:00\"              LocalTime.of(0, 0)                    Period.ofDays(1)
+ 
+ The query can be used as follows: +
+  TemporalAccessor parsed = formatter.parse(str);
+  LocalTime time = parsed.query(LocalTime::from);
+  Period extraDays = parsed.query(DateTimeFormatter.parsedExcessDays());
+ 
+ @return a query that provides access to the excess days that were parsed" + {:arglists (quote ([]))} + (^java.time.temporal.TemporalQuery [] + (java.time.format.DateTimeFormatter/parsedExcessDays))) + +(defn get-zone + "Gets the overriding zone to be used during formatting. + + This returns the override zone, used to convert instants. + By default, a formatter has no override zone, returning null. + See {@link #withZone(ZoneId)} for more details on overriding. + + @return the override zone of this formatter, null if no override" + {:arglists (quote (["java.time.format.DateTimeFormatter"]))} + (^java.time.ZoneId [^java.time.format.DateTimeFormatter this] + (.getZone this))) + +(defn of-localized-date-time + {:arglists (quote (["java.time.format.FormatStyle"] + ["java.time.format.FormatStyle" + "java.time.format.FormatStyle"]))} + (^java.time.format.DateTimeFormatter + [^java.time.format.FormatStyle date-time-style] + (java.time.format.DateTimeFormatter/ofLocalizedDateTime date-time-style)) + (^java.time.format.DateTimeFormatter + [^java.time.format.FormatStyle date-style + ^java.time.format.FormatStyle time-style] + (java.time.format.DateTimeFormatter/ofLocalizedDateTime date-style + time-style))) + +(defn get-resolver-fields + "Gets the resolver fields to use during parsing. + + This returns the resolver fields, used during the second phase of parsing + when fields are resolved into dates and times. + By default, a formatter has no resolver fields, and thus returns null. + See {@link #withResolverFields(Set)} for more details. + + @return the immutable set of resolver fields of this formatter, null if no fields" + {:arglists (quote (["java.time.format.DateTimeFormatter"]))} + (^java.util.Set [^java.time.format.DateTimeFormatter this] + (.getResolverFields this))) + +(defn get-chronology + "Gets the overriding chronology to be used during formatting. + + This returns the override chronology, used to convert dates. + By default, a formatter has no override chronology, returning null. + See {@link #withChronology(Chronology)} for more details on overriding. + + @return the override chronology of this formatter, null if no override" + {:arglists (quote (["java.time.format.DateTimeFormatter"]))} + (^java.time.chrono.Chronology [^java.time.format.DateTimeFormatter this] + (.getChronology this))) + +(defn parse + {:arglists (quote + (["java.time.format.DateTimeFormatter" "java.lang.CharSequence"] + ["java.time.format.DateTimeFormatter" "java.lang.CharSequence" + "java.text.ParsePosition"] + ["java.time.format.DateTimeFormatter" "java.lang.CharSequence" + "java.time.temporal.TemporalQuery"]))} + (^java.time.temporal.TemporalAccessor + [^java.time.format.DateTimeFormatter this ^java.lang.CharSequence text] + (.parse this text)) + (^java.lang.Object [^java.time.format.DateTimeFormatter this arg0 arg1] + (cond (and (instance? java.lang.CharSequence arg0) + (instance? java.text.ParsePosition arg1)) + (let [^java.lang.CharSequence text arg0 + ^java.text.ParsePosition position arg1] + (.parse this text position)) + (and (instance? java.lang.CharSequence arg0) + (instance? java.time.temporal.TemporalQuery arg1)) + (let [^java.lang.CharSequence text arg0 + ^java.time.temporal.TemporalQuery query arg1] + (.parse this text query)) + :else (throw (java.lang.IllegalArgumentException. + "no corresponding java.time method with these args"))))) + +(defn with-locale + "Returns a copy of this formatter with a new locale. + + This is used to lookup any part of the formatter needing specific + localization, such as the text or localized pattern. + + This instance is immutable and unaffected by this method call. + + @param locale the new locale, not null + @return a formatter based on this formatter with the requested locale, not null" + {:arglists (quote (["java.time.format.DateTimeFormatter" + "java.util.Locale"]))} + (^java.time.format.DateTimeFormatter + [^java.time.format.DateTimeFormatter this ^java.util.Locale locale] + (.withLocale this locale))) + +(defn with-resolver-fields + {:arglists (quote (["java.time.format.DateTimeFormatter" + "[Ljava.time.temporal.TemporalField;"] + ["java.time.format.DateTimeFormatter" "java.util.Set"]))} + (^java.time.format.DateTimeFormatter + [^java.time.format.DateTimeFormatter this arg0] + (cond (= java.time.temporal.TemporalField (.getComponentType (class arg0))) + (let [^java.time.temporal.TemporalField/1 resolver-fields arg0] + (.withResolverFields this resolver-fields)) + (instance? java.util.Set arg0) + (let [^java.util.Set resolver-fields arg0] + (.withResolverFields this resolver-fields)) + :else (throw (java.lang.IllegalArgumentException. + "no corresponding java.time method with these args"))))) + +(defn parse-unresolved + "Parses the text using this formatter, without resolving the result, intended + for advanced use cases. + + Parsing is implemented as a two-phase operation. + First, the text is parsed using the layout defined by the formatter, producing + a {@code Map} of field to value, a {@code ZoneId} and a {@code Chronology}. + Second, the parsed data is resolved, by validating, combining and + simplifying the various fields into more useful ones. + This method performs the parsing stage but not the resolving stage. + + The result of this method is {@code TemporalAccessor} which represents the + data as seen in the input. Values are not validated, thus parsing a date string + of '2012-00-65' would result in a temporal with three fields - year of '2012', + month of '0' and day-of-month of '65'. + + The text will be parsed from the specified start {@code ParsePosition}. + The entire length of the text does not have to be parsed, the {@code ParsePosition} + will be updated with the index at the end of parsing. + + Errors are returned using the error index field of the {@code ParsePosition} + instead of {@code DateTimeParseException}. + The returned error index will be set to an index indicative of the error. + Callers must check for errors before using the result. + + If the formatter parses the same field more than once with different values, + the result will be an error. + + This method is intended for advanced use cases that need access to the + internal state during parsing. Typical application code should use + {@link #parse(CharSequence, TemporalQuery)} or the parse method on the target type. + + @param text the text to parse, not null + @param position the position to parse from, updated with length parsed + and the index of any error, not null + @return the parsed text, null if the parse results in an error + @throws DateTimeException if some problem occurs during parsing + @throws IndexOutOfBoundsException if the position is invalid" + {:arglists (quote (["java.time.format.DateTimeFormatter" + "java.lang.CharSequence" "java.text.ParsePosition"]))} + (^java.time.temporal.TemporalAccessor + [^java.time.format.DateTimeFormatter this ^java.lang.CharSequence text + ^java.text.ParsePosition position] + (.parseUnresolved this text position))) + +(defn of-localized-time + "Returns a locale specific time format for the ISO chronology. + + This returns a formatter that will format or parse a time. + The exact format pattern used varies by locale. + + The locale is determined from the formatter. The formatter returned directly by + this method will use the {@link Locale#getDefault(Locale.Category) default FORMAT locale}. + The locale can be controlled using {@link DateTimeFormatter#withLocale(Locale) withLocale(Locale)} + on the result of this method. + + Note that the localized pattern is looked up lazily. + This {@code DateTimeFormatter} holds the style required and the locale, + looking up the pattern required on demand. + + The returned formatter has a chronology of ISO set to ensure dates in + other calendar systems are correctly converted. + It has no override zone and uses the {@link ResolverStyle#SMART SMART} resolver style. + + @param timeStyle the formatter style to obtain, not null + @return the time formatter, not null" + {:arglists (quote (["java.time.format.FormatStyle"]))} + (^java.time.format.DateTimeFormatter + [^java.time.format.FormatStyle time-style] + (java.time.format.DateTimeFormatter/ofLocalizedTime time-style))) + +(defn of-localized-date + "Returns a locale specific date format for the ISO chronology. + + This returns a formatter that will format or parse a date. + The exact format pattern used varies by locale. + + The locale is determined from the formatter. The formatter returned directly by + this method will use the {@link Locale#getDefault(Locale.Category) default FORMAT locale}. + The locale can be controlled using {@link DateTimeFormatter#withLocale(Locale) withLocale(Locale)} + on the result of this method. + + Note that the localized pattern is looked up lazily. + This {@code DateTimeFormatter} holds the style required and the locale, + looking up the pattern required on demand. + + The returned formatter has a chronology of ISO set to ensure dates in + other calendar systems are correctly converted. + It has no override zone and uses the {@link ResolverStyle#SMART SMART} resolver style. + + @param dateStyle the formatter style to obtain, not null + @return the date formatter, not null" + {:arglists (quote (["java.time.format.FormatStyle"]))} + (^java.time.format.DateTimeFormatter + [^java.time.format.FormatStyle date-style] + (java.time.format.DateTimeFormatter/ofLocalizedDate date-style))) + +(defn format + "Formats a date-time object using this formatter. + + This formats the date-time to a String using the rules of the formatter. + + @param temporal the temporal object to format, not null + @return the formatted string, not null + @throws DateTimeException if an error occurs during formatting" + {:arglists (quote (["java.time.format.DateTimeFormatter" + "java.time.temporal.TemporalAccessor"]))} + (^java.lang.String + [^java.time.format.DateTimeFormatter this + ^java.time.temporal.TemporalAccessor temporal] + (cljc.java-time.extn.calendar-awareness/calendar-aware-clj + (.format this temporal)))) + +(defn to-format + {:arglists (quote (["java.time.format.DateTimeFormatter"] + ["java.time.format.DateTimeFormatter" + "java.time.temporal.TemporalQuery"]))} + (^java.text.Format [^java.time.format.DateTimeFormatter this] + (.toFormat this)) + (^java.text.Format + [^java.time.format.DateTimeFormatter this + ^java.time.temporal.TemporalQuery parse-query] + (.toFormat this parse-query))) + +(defn with-resolver-style + "Returns a copy of this formatter with a new resolver style. + + This returns a formatter with similar state to this formatter but + with the resolver style set. By default, a formatter has the + {@link ResolverStyle#SMART SMART} resolver style. + + Changing the resolver style only has an effect during parsing. + Parsing a text string occurs in two phases. + Phase 1 is a basic text parse according to the fields added to the builder. + Phase 2 resolves the parsed field-value pairs into date and/or time objects. + The resolver style is used to control how phase 2, resolving, happens. + See {@code ResolverStyle} for more information on the options available. + + This instance is immutable and unaffected by this method call. + + @param resolverStyle the new resolver style, not null + @return a formatter based on this formatter with the requested resolver style, not null" + {:arglists (quote (["java.time.format.DateTimeFormatter" + "java.time.format.ResolverStyle"]))} + (^java.time.format.DateTimeFormatter + [^java.time.format.DateTimeFormatter this + ^java.time.format.ResolverStyle resolver-style] + (.withResolverStyle this resolver-style))) diff --git a/src/cljc/java_time/format/date_time_formatter.cljs b/src/cljc/java_time/format/date_time_formatter.cljs index 6adc086..51df8ba 100644 --- a/src/cljc/java_time/format/date_time_formatter.cljs +++ b/src/cljc/java_time/format/date_time_formatter.cljs @@ -1,41 +1,895 @@ -(ns cljc.java-time.format.date-time-formatter (:refer-clojure :exclude [abs get range format min max next name resolve short]) (:require [cljc.java-time.extn.calendar-awareness] [goog.object] [java.time.format :refer [DateTimeFormatter]])) -(def iso-local-time (goog.object/get java.time.format.DateTimeFormatter "ISO_LOCAL_TIME")) -(def iso-ordinal-date (goog.object/get java.time.format.DateTimeFormatter "ISO_ORDINAL_DATE")) -(def iso-offset-date (goog.object/get java.time.format.DateTimeFormatter "ISO_OFFSET_DATE")) -(def iso-time (goog.object/get java.time.format.DateTimeFormatter "ISO_TIME")) -(def iso-local-date-time (goog.object/get java.time.format.DateTimeFormatter "ISO_LOCAL_DATE_TIME")) -(def iso-instant (goog.object/get java.time.format.DateTimeFormatter "ISO_INSTANT")) -(def rfc-1123-date-time (goog.object/get java.time.format.DateTimeFormatter "RFC_1123_DATE_TIME")) -(def iso-date (goog.object/get java.time.format.DateTimeFormatter "ISO_DATE")) -(def iso-week-date (goog.object/get java.time.format.DateTimeFormatter "ISO_WEEK_DATE")) -(def iso-offset-time (goog.object/get java.time.format.DateTimeFormatter "ISO_OFFSET_TIME")) -(def iso-local-date (goog.object/get java.time.format.DateTimeFormatter "ISO_LOCAL_DATE")) -(def iso-zoned-date-time (goog.object/get java.time.format.DateTimeFormatter "ISO_ZONED_DATE_TIME")) -(def iso-offset-date-time (goog.object/get java.time.format.DateTimeFormatter "ISO_OFFSET_DATE_TIME")) -(def iso-date-time (goog.object/get java.time.format.DateTimeFormatter "ISO_DATE_TIME")) -(def basic-iso-date (goog.object/get java.time.format.DateTimeFormatter "BASIC_ISO_DATE")) -(clojure.core/defn of-pattern {:arglists (quote (["java.lang.String"] ["java.lang.String" "java.util.Locale"]))} (^js/JSJoda.DateTimeFormatter [^java.lang.String java-lang-String15920] (js-invoke java.time.format.DateTimeFormatter "ofPattern" java-lang-String15920)) (^js/JSJoda.DateTimeFormatter [^java.lang.String java-lang-String15921 ^java.util.Locale java-util-Locale15922] (js-invoke java.time.format.DateTimeFormatter "ofPattern" java-lang-String15921 java-util-Locale15922))) -(clojure.core/defn parse-best {:arglists (quote (["java.time.format.DateTimeFormatter" "java.lang.CharSequence" "[Ljava.time.temporal.TemporalQuery;"]))} (^js/JSJoda.TemporalAccessor [^js/JSJoda.DateTimeFormatter this15923 ^java.lang.CharSequence java-lang-CharSequence15924 ^"java.lang.Class" java-time-temporal-TemporalQuery-array15925] (.parseBest this15923 java-lang-CharSequence15924 java-time-temporal-TemporalQuery-array15925))) -(clojure.core/defn format-to {:arglists (quote (["java.time.format.DateTimeFormatter" "java.time.temporal.TemporalAccessor" "java.lang.Appendable"]))} (^void [^js/JSJoda.DateTimeFormatter this15926 ^js/JSJoda.TemporalAccessor java-time-temporal-TemporalAccessor15927 ^java.lang.Appendable java-lang-Appendable15928] (.formatTo this15926 java-time-temporal-TemporalAccessor15927 java-lang-Appendable15928))) -(clojure.core/defn get-decimal-style {:arglists (quote (["java.time.format.DateTimeFormatter"]))} (^js/JSJoda.DecimalStyle [^js/JSJoda.DateTimeFormatter this15929] (.decimalStyle this15929))) -(clojure.core/defn with-chronology {:arglists (quote (["java.time.format.DateTimeFormatter" "java.time.chrono.Chronology"]))} (^js/JSJoda.DateTimeFormatter [^js/JSJoda.DateTimeFormatter this15930 ^js/JSJoda.Chronology java-time-chrono-Chronology15931] (.withChronology this15930 java-time-chrono-Chronology15931))) -(clojure.core/defn get-resolver-style {:arglists (quote (["java.time.format.DateTimeFormatter"]))} (^js/JSJoda.ResolverStyle [^js/JSJoda.DateTimeFormatter this15932] (.resolverStyle this15932))) -(clojure.core/defn with-decimal-style {:arglists (quote (["java.time.format.DateTimeFormatter" "java.time.format.DecimalStyle"]))} (^js/JSJoda.DateTimeFormatter [^js/JSJoda.DateTimeFormatter this15933 ^js/JSJoda.DecimalStyle java-time-format-DecimalStyle15934] (.withDecimalStyle this15933 java-time-format-DecimalStyle15934))) -(clojure.core/defn get-locale {:arglists (quote (["java.time.format.DateTimeFormatter"]))} (^java.util.Locale [^js/JSJoda.DateTimeFormatter this15935] (.locale this15935))) -(clojure.core/defn to-string {:arglists (quote (["java.time.format.DateTimeFormatter"]))} (^java.lang.String [^js/JSJoda.DateTimeFormatter this15936] (.toString this15936))) -(clojure.core/defn parsed-leap-second {:arglists (quote ([]))} (^js/JSJoda.TemporalQuery [] (js-invoke java.time.format.DateTimeFormatter "parsedLeapSecond"))) -(clojure.core/defn with-zone {:arglists (quote (["java.time.format.DateTimeFormatter" "java.time.ZoneId"]))} (^js/JSJoda.DateTimeFormatter [^js/JSJoda.DateTimeFormatter this15937 ^js/JSJoda.ZoneId java-time-ZoneId15938] (.withZone this15937 java-time-ZoneId15938))) -(clojure.core/defn parsed-excess-days {:arglists (quote ([]))} (^js/JSJoda.TemporalQuery [] (js-invoke java.time.format.DateTimeFormatter "parsedExcessDays"))) -(clojure.core/defn get-zone {:arglists (quote (["java.time.format.DateTimeFormatter"]))} (^js/JSJoda.ZoneId [^js/JSJoda.DateTimeFormatter this15939] (.zone this15939))) -(clojure.core/defn of-localized-date-time {:arglists (quote (["java.time.format.FormatStyle"] ["java.time.format.FormatStyle" "java.time.format.FormatStyle"]))} (^js/JSJoda.DateTimeFormatter [^js/JSJoda.FormatStyle java-time-format-FormatStyle15940] (js-invoke java.time.format.DateTimeFormatter "ofLocalizedDateTime" java-time-format-FormatStyle15940)) (^js/JSJoda.DateTimeFormatter [^js/JSJoda.FormatStyle java-time-format-FormatStyle15941 ^js/JSJoda.FormatStyle java-time-format-FormatStyle15942] (js-invoke java.time.format.DateTimeFormatter "ofLocalizedDateTime" java-time-format-FormatStyle15941 java-time-format-FormatStyle15942))) -(clojure.core/defn get-resolver-fields {:arglists (quote (["java.time.format.DateTimeFormatter"]))} (^java.util.Set [^js/JSJoda.DateTimeFormatter this15943] (.resolverFields this15943))) -(clojure.core/defn get-chronology {:arglists (quote (["java.time.format.DateTimeFormatter"]))} (^js/JSJoda.Chronology [^js/JSJoda.DateTimeFormatter this15944] (.chronology this15944))) -(clojure.core/defn parse {:arglists (quote (["java.time.format.DateTimeFormatter" "java.lang.CharSequence" "java.time.temporal.TemporalQuery"] ["java.time.format.DateTimeFormatter" "java.lang.CharSequence"] ["java.time.format.DateTimeFormatter" "java.lang.CharSequence" "java.text.ParsePosition"]))} (^java.lang.Object [this15945 G__15946 G__15947] (.parse ^js/JSJoda.DateTimeFormatter this15945 G__15946 G__15947)) (^js/JSJoda.TemporalAccessor [^js/JSJoda.DateTimeFormatter this15948 ^java.lang.CharSequence java-lang-CharSequence15949] (.parse this15948 java-lang-CharSequence15949))) -(clojure.core/defn with-locale {:arglists (quote (["java.time.format.DateTimeFormatter" "java.util.Locale"]))} (^js/JSJoda.DateTimeFormatter [^js/JSJoda.DateTimeFormatter this15950 ^java.util.Locale java-util-Locale15951] (.withLocale this15950 java-util-Locale15951))) -(clojure.core/defn with-resolver-fields {:arglists (quote (["java.time.format.DateTimeFormatter" "java.util.Set"] ["java.time.format.DateTimeFormatter" "[Ljava.time.temporal.TemporalField;"]))} (^js/JSJoda.DateTimeFormatter [this15952 G__15953] (.withResolverFields ^js/JSJoda.DateTimeFormatter this15952 G__15953))) -(clojure.core/defn parse-unresolved {:arglists (quote (["java.time.format.DateTimeFormatter" "java.lang.CharSequence" "java.text.ParsePosition"]))} (^js/JSJoda.TemporalAccessor [^js/JSJoda.DateTimeFormatter this15954 ^java.lang.CharSequence java-lang-CharSequence15955 ^java.text.ParsePosition java-text-ParsePosition15956] (.parseUnresolved this15954 java-lang-CharSequence15955 java-text-ParsePosition15956))) -(clojure.core/defn of-localized-time {:arglists (quote (["java.time.format.FormatStyle"]))} (^js/JSJoda.DateTimeFormatter [^js/JSJoda.FormatStyle java-time-format-FormatStyle15957] (js-invoke java.time.format.DateTimeFormatter "ofLocalizedTime" java-time-format-FormatStyle15957))) -(clojure.core/defn of-localized-date {:arglists (quote (["java.time.format.FormatStyle"]))} (^js/JSJoda.DateTimeFormatter [^js/JSJoda.FormatStyle java-time-format-FormatStyle15958] (js-invoke java.time.format.DateTimeFormatter "ofLocalizedDate" java-time-format-FormatStyle15958))) -(clojure.core/defn format {:arglists (quote (["java.time.format.DateTimeFormatter" "java.time.temporal.TemporalAccessor"]))} (^java.lang.String [^js/JSJoda.DateTimeFormatter this15959 ^js/JSJoda.TemporalAccessor java-time-temporal-TemporalAccessor15960] (cljc.java-time.extn.calendar-awareness/calendar-aware-cljs (.format this15959 java-time-temporal-TemporalAccessor15960)))) -(clojure.core/defn to-format {:arglists (quote (["java.time.format.DateTimeFormatter"] ["java.time.format.DateTimeFormatter" "java.time.temporal.TemporalQuery"]))} (^java.text.Format [^js/JSJoda.DateTimeFormatter this15961] (.toFormat this15961)) (^java.text.Format [^js/JSJoda.DateTimeFormatter this15962 ^js/JSJoda.TemporalQuery java-time-temporal-TemporalQuery15963] (.toFormat this15962 java-time-temporal-TemporalQuery15963))) -(clojure.core/defn with-resolver-style {:arglists (quote (["java.time.format.DateTimeFormatter" "java.time.format.ResolverStyle"]))} (^js/JSJoda.DateTimeFormatter [^js/JSJoda.DateTimeFormatter this15964 ^js/JSJoda.ResolverStyle java-time-format-ResolverStyle15965] (.withResolverStyle this15964 java-time-format-ResolverStyle15965))) +(ns cljc.java-time.format.date-time-formatter + (:refer-clojure :exclude + [abs get range format min max next name resolve short]) + (:require [cljc.java-time.extn.calendar-awareness] + [goog.object] + [java.time.format :refer [DateTimeFormatter]])) + +(def iso-local-time + "The ISO time formatter that formats or parses a time without an + offset, such as '10:15' or '10:15:30'. + + This returns an immutable formatter capable of formatting and parsing + the ISO-8601 extended local time format. + The format consists of: + + + The returned formatter has no override chronology or zone. + It uses the {@link ResolverStyle#STRICT STRICT} resolver style." + (goog.object/get java.time.format.DateTimeFormatter "ISO_LOCAL_TIME")) + +(def iso-ordinal-date + "The ISO date formatter that formats or parses the ordinal date + without an offset, such as '2012-337'. + + This returns an immutable formatter capable of formatting and parsing + the ISO-8601 extended ordinal date format. + The format consists of: + + + As this formatter has an optional element, it may be necessary to parse using + {@link DateTimeFormatter#parseBest}. + + The returned formatter has a chronology of ISO set to ensure dates in + other calendar systems are correctly converted. + It has no override zone and uses the {@link ResolverStyle#STRICT STRICT} resolver style." + (goog.object/get java.time.format.DateTimeFormatter "ISO_ORDINAL_DATE")) + +(def iso-offset-date + "The ISO date formatter that formats or parses a date with an + offset, such as '2011-12-03+01:00'. + + This returns an immutable formatter capable of formatting and parsing + the ISO-8601 extended offset date format. + The format consists of: + + + The returned formatter has a chronology of ISO set to ensure dates in + other calendar systems are correctly converted. + It has no override zone and uses the {@link ResolverStyle#STRICT STRICT} resolver style." + (goog.object/get java.time.format.DateTimeFormatter "ISO_OFFSET_DATE")) + +(def iso-time + "The ISO time formatter that formats or parses a time, with the + offset if available, such as '10:15', '10:15:30' or '10:15:30+01:00'. + + This returns an immutable formatter capable of formatting and parsing + the ISO-8601 extended offset time format. + The format consists of: + + + As this formatter has an optional element, it may be necessary to parse using + {@link DateTimeFormatter#parseBest}. + + The returned formatter has no override chronology or zone. + It uses the {@link ResolverStyle#STRICT STRICT} resolver style." + (goog.object/get java.time.format.DateTimeFormatter "ISO_TIME")) + +(def iso-local-date-time + "The ISO date-time formatter that formats or parses a date-time without + an offset, such as '2011-12-03T10:15:30'. + + This returns an immutable formatter capable of formatting and parsing + the ISO-8601 extended offset date-time format. + The format consists of: + + + The returned formatter has a chronology of ISO set to ensure dates in + other calendar systems are correctly converted. + It has no override zone and uses the {@link ResolverStyle#STRICT STRICT} resolver style." + (goog.object/get java.time.format.DateTimeFormatter "ISO_LOCAL_DATE_TIME")) + +(def iso-instant + "The ISO instant formatter that formats or parses an instant in UTC, + such as '2011-12-03T10:15:30Z'. + + This returns an immutable formatter capable of formatting and parsing + the ISO-8601 instant format. + When formatting, the second-of-minute is always output. + The nano-of-second outputs zero, three, six or nine digits digits as necessary. + When parsing, time to at least the seconds field is required. + Fractional seconds from zero to nine are parsed. + The localized decimal style is not used. + + This is a special case formatter intended to allow a human readable form + of an {@link java.time.Instant}. The {@code Instant} class is designed to + only represent a point in time and internally stores a value in nanoseconds + from a fixed epoch of 1970-01-01Z. As such, an {@code Instant} cannot be + formatted as a date or time without providing some form of time-zone. + This formatter allows the {@code Instant} to be formatted, by providing + a suitable conversion using {@code ZoneOffset.UTC}. + + The format consists of: + + + The returned formatter has no override chronology or zone. + It uses the {@link ResolverStyle#STRICT STRICT} resolver style." + (goog.object/get java.time.format.DateTimeFormatter "ISO_INSTANT")) + +(def rfc-1123-date-time + "The RFC-1123 date-time formatter, such as 'Tue, 3 Jun 2008 11:05:30 GMT'. + + This returns an immutable formatter capable of formatting and parsing + most of the RFC-1123 format. + RFC-1123 updates RFC-822 changing the year from two digits to four. + This implementation requires a four digit year. + This implementation also does not handle North American or military zone + names, only 'GMT' and offset amounts. + + The format consists of: + + + Parsing is case insensitive. + + The returned formatter has a chronology of ISO set to ensure dates in + other calendar systems are correctly converted. + It has no override zone and uses the {@link ResolverStyle#SMART SMART} resolver style." + (goog.object/get java.time.format.DateTimeFormatter "RFC_1123_DATE_TIME")) + +(def iso-date + "The ISO date formatter that formats or parses a date with the + offset if available, such as '2011-12-03' or '2011-12-03+01:00'. + + This returns an immutable formatter capable of formatting and parsing + the ISO-8601 extended date format. + The format consists of: + + + As this formatter has an optional element, it may be necessary to parse using + {@link DateTimeFormatter#parseBest}. + + The returned formatter has a chronology of ISO set to ensure dates in + other calendar systems are correctly converted. + It has no override zone and uses the {@link ResolverStyle#STRICT STRICT} resolver style." + (goog.object/get java.time.format.DateTimeFormatter "ISO_DATE")) + +(def iso-week-date + "The ISO date formatter that formats or parses the week-based date + without an offset, such as '2012-W48-6'. + + This returns an immutable formatter capable of formatting and parsing + the ISO-8601 extended week-based date format. + The format consists of: + + + As this formatter has an optional element, it may be necessary to parse using + {@link DateTimeFormatter#parseBest}. + + The returned formatter has a chronology of ISO set to ensure dates in + other calendar systems are correctly converted. + It has no override zone and uses the {@link ResolverStyle#STRICT STRICT} resolver style." + (goog.object/get java.time.format.DateTimeFormatter "ISO_WEEK_DATE")) + +(def iso-offset-time + "The ISO time formatter that formats or parses a time with an + offset, such as '10:15+01:00' or '10:15:30+01:00'. + + This returns an immutable formatter capable of formatting and parsing + the ISO-8601 extended offset time format. + The format consists of: + + + The returned formatter has no override chronology or zone. + It uses the {@link ResolverStyle#STRICT STRICT} resolver style." + (goog.object/get java.time.format.DateTimeFormatter "ISO_OFFSET_TIME")) + +(def iso-local-date + "The ISO date formatter that formats or parses a date without an + offset, such as '2011-12-03'. + + This returns an immutable formatter capable of formatting and parsing + the ISO-8601 extended local date format. + The format consists of: + + + The returned formatter has a chronology of ISO set to ensure dates in + other calendar systems are correctly converted. + It has no override zone and uses the {@link ResolverStyle#STRICT STRICT} resolver style." + (goog.object/get java.time.format.DateTimeFormatter "ISO_LOCAL_DATE")) + +(def iso-zoned-date-time + "The ISO-like date-time formatter that formats or parses a date-time with + offset and zone, such as '2011-12-03T10:15:30+01:00[Europe/Paris]'. + + This returns an immutable formatter capable of formatting and parsing + a format that extends the ISO-8601 extended offset date-time format + to add the time-zone. + The section in square brackets is not part of the ISO-8601 standard. + The format consists of: + + + The returned formatter has a chronology of ISO set to ensure dates in + other calendar systems are correctly converted. + It has no override zone and uses the {@link ResolverStyle#STRICT STRICT} resolver style." + (goog.object/get java.time.format.DateTimeFormatter "ISO_ZONED_DATE_TIME")) + +(def iso-offset-date-time + "The ISO date-time formatter that formats or parses a date-time with an + offset, such as '2011-12-03T10:15:30+01:00'. + + This returns an immutable formatter capable of formatting and parsing + the ISO-8601 extended offset date-time format. + The format consists of: + + + The returned formatter has a chronology of ISO set to ensure dates in + other calendar systems are correctly converted. + It has no override zone and uses the {@link ResolverStyle#STRICT STRICT} resolver style." + (goog.object/get java.time.format.DateTimeFormatter "ISO_OFFSET_DATE_TIME")) + +(def iso-date-time + "The ISO-like date-time formatter that formats or parses a date-time with + the offset and zone if available, such as '2011-12-03T10:15:30', + '2011-12-03T10:15:30+01:00' or '2011-12-03T10:15:30+01:00[Europe/Paris]'. + + This returns an immutable formatter capable of formatting and parsing + the ISO-8601 extended local or offset date-time format, as well as the + extended non-ISO form specifying the time-zone. + The format consists of: + + + As this formatter has an optional element, it may be necessary to parse using + {@link DateTimeFormatter#parseBest}. + + The returned formatter has a chronology of ISO set to ensure dates in + other calendar systems are correctly converted. + It has no override zone and uses the {@link ResolverStyle#STRICT STRICT} resolver style." + (goog.object/get java.time.format.DateTimeFormatter "ISO_DATE_TIME")) + +(def basic-iso-date + "The ISO date formatter that formats or parses a date without an + offset, such as '20111203'. + + This returns an immutable formatter capable of formatting and parsing + the ISO-8601 basic local date format. + The format consists of: + + + As this formatter has an optional element, it may be necessary to parse using + {@link DateTimeFormatter#parseBest}. + + The returned formatter has a chronology of ISO set to ensure dates in + other calendar systems are correctly converted. + It has no override zone and uses the {@link ResolverStyle#STRICT STRICT} resolver style." + (goog.object/get java.time.format.DateTimeFormatter "BASIC_ISO_DATE")) + +(defn of-pattern + {:arglists (quote (["java.lang.String"] + ["java.lang.String" "java.util.Locale"]))} + (^js/JSJoda.DateTimeFormatter [^java.lang.String pattern] + (js-invoke java.time.format.DateTimeFormatter "ofPattern" pattern)) + (^js/JSJoda.DateTimeFormatter + [^java.lang.String pattern ^java.util.Locale locale] + (js-invoke java.time.format.DateTimeFormatter "ofPattern" pattern locale))) + +(defn parse-best + "Fully parses the text producing an object of one of the specified types. + + This parse method is convenient for use when the parser can handle optional elements. + For example, a pattern of 'uuuu-MM-dd HH.mm[ VV]' can be fully parsed to a {@code ZonedDateTime}, + or partially parsed to a {@code LocalDateTime}. + The queries must be specified in order, starting from the best matching full-parse option + and ending with the worst matching minimal parse option. + The query is typically a method reference to a {@code from(TemporalAccessor)} method. + + The result is associated with the first type that successfully parses. + Normally, applications will use {@code instanceof} to check the result. + For example: +
+  TemporalAccessor dt = parser.parseBest(str, ZonedDateTime::from, LocalDateTime::from);
+  if (dt instanceof ZonedDateTime) {
+   ...
+  } else {
+   ...
+  }
+ 
+ If the parse completes without reading the entire length of the text, + or a problem occurs during parsing or merging, then an exception is thrown. + + @param text the text to parse, not null + @param queries the queries defining the types to attempt to parse to, + must implement {@code TemporalAccessor}, not null + @return the parsed date-time, not null + @throws IllegalArgumentException if less than 2 types are specified + @throws DateTimeParseException if unable to parse the requested result" + {:arglists (quote (["java.time.format.DateTimeFormatter" + "java.lang.CharSequence" + "[Ljava.time.temporal.TemporalQuery;"]))} + (^js/JSJoda.TemporalAccessor + [^js/JSJoda.DateTimeFormatter this ^java.lang.CharSequence text + ^"java.lang.Class" queries] + (.parseBest this text queries))) + +(defn format-to + "Formats a date-time object to an {@code Appendable} using this formatter. + + This outputs the formatted date-time to the specified destination. + {@link Appendable} is a general purpose interface that is implemented by all + key character output classes including {@code StringBuffer}, {@code StringBuilder}, + {@code PrintStream} and {@code Writer}. + + Although {@code Appendable} methods throw an {@code IOException}, this method does not. + Instead, any {@code IOException} is wrapped in a runtime exception. + + @param temporal the temporal object to format, not null + @param appendable the appendable to format to, not null + @throws DateTimeException if an error occurs during formatting" + {:arglists (quote (["java.time.format.DateTimeFormatter" + "java.time.temporal.TemporalAccessor" + "java.lang.Appendable"]))} + (^void + [^js/JSJoda.DateTimeFormatter this ^js/JSJoda.TemporalAccessor temporal + ^java.lang.Appendable appendable] + (.formatTo this temporal appendable))) + +(defn get-decimal-style + "Gets the DecimalStyle to be used during formatting. + + @return the locale of this formatter, not null" + {:arglists (quote (["java.time.format.DateTimeFormatter"]))} + (^js/JSJoda.DecimalStyle [^js/JSJoda.DateTimeFormatter this] + (.decimalStyle this))) + +(defn with-chronology + "Returns a copy of this formatter with a new override chronology. + + This returns a formatter with similar state to this formatter but + with the override chronology set. + By default, a formatter has no override chronology, returning null. + + If an override is added, then any date that is formatted or parsed will be affected. + + When formatting, if the temporal object contains a date, then it will + be converted to a date in the override chronology. + Whether the temporal contains a date is determined by querying the + {@link ChronoField#EPOCH_DAY EPOCH_DAY} field. + Any time or zone will be retained unaltered unless overridden. + + If the temporal object does not contain a date, but does contain one + or more {@code ChronoField} date fields, then a {@code DateTimeException} + is thrown. In all other cases, the override chronology is added to the temporal, + replacing any previous chronology, but without changing the date/time. + + When parsing, there are two distinct cases to consider. + If a chronology has been parsed directly from the text, perhaps because + {@link DateTimeFormatterBuilder#appendChronologyId()} was used, then + this override chronology has no effect. + If no zone has been parsed, then this override chronology will be used + to interpret the {@code ChronoField} values into a date according to the + date resolving rules of the chronology. + + This instance is immutable and unaffected by this method call. + + @param chrono the new chronology, null if no override + @return a formatter based on this formatter with the requested override chronology, not null" + {:arglists (quote (["java.time.format.DateTimeFormatter" + "java.time.chrono.Chronology"]))} + (^js/JSJoda.DateTimeFormatter + [^js/JSJoda.DateTimeFormatter this ^js/JSJoda.Chronology chrono] + (.withChronology this chrono))) + +(defn get-resolver-style + "Gets the resolver style to use during parsing. + + This returns the resolver style, used during the second phase of parsing + when fields are resolved into dates and times. + By default, a formatter has the {@link ResolverStyle#SMART SMART} resolver style. + See {@link #withResolverStyle(ResolverStyle)} for more details. + + @return the resolver style of this formatter, not null" + {:arglists (quote (["java.time.format.DateTimeFormatter"]))} + (^js/JSJoda.ResolverStyle [^js/JSJoda.DateTimeFormatter this] + (.resolverStyle this))) + +(defn with-decimal-style + "Returns a copy of this formatter with a new DecimalStyle. + + This instance is immutable and unaffected by this method call. + + @param decimalStyle the new DecimalStyle, not null + @return a formatter based on this formatter with the requested DecimalStyle, not null" + {:arglists (quote (["java.time.format.DateTimeFormatter" + "java.time.format.DecimalStyle"]))} + (^js/JSJoda.DateTimeFormatter + [^js/JSJoda.DateTimeFormatter this ^js/JSJoda.DecimalStyle decimal-style] + (.withDecimalStyle this decimal-style))) + +(defn get-locale + "Gets the locale to be used during formatting. + + This is used to lookup any part of the formatter needing specific + localization, such as the text or localized pattern. + + @return the locale of this formatter, not null" + {:arglists (quote (["java.time.format.DateTimeFormatter"]))} + (^java.util.Locale [^js/JSJoda.DateTimeFormatter this] (.locale this))) + +(defn to-string + "Returns a description of the underlying formatters. + + @return a description of this formatter, not null" + {:arglists (quote (["java.time.format.DateTimeFormatter"]))} + (^java.lang.String [^js/JSJoda.DateTimeFormatter this] (.toString this))) + +(defn parsed-leap-second + "A query that provides access to whether a leap-second was parsed. + + This returns a singleton {@linkplain TemporalQuery query} that provides + access to additional information from the parse. The query always returns + a non-null boolean, true if parsing saw a leap-second, false if not. + + Instant parsing handles the special \"leap second\" time of '23:59:60'. + Leap seconds occur at '23:59:60' in the UTC time-zone, but at other + local times in different time-zones. To avoid this potential ambiguity, + the handling of leap-seconds is limited to + {@link DateTimeFormatterBuilder#appendInstant()}, as that method + always parses the instant with the UTC zone offset. + + If the time '23:59:60' is received, then a simple conversion is applied, + replacing the second-of-minute of 60 with 59. This query can be used + on the parse result to determine if the leap-second adjustment was made. + The query will return {@code true} if it did adjust to remove the + leap-second, and {@code false} if not. Note that applying a leap-second + smoothing mechanism, such as UTC-SLS, is the responsibility of the + application, as follows: +
+  TemporalAccessor parsed = formatter.parse(str);
+  Instant instant = parsed.query(Instant::from);
+  if (parsed.query(DateTimeFormatter.parsedLeapSecond())) {
+    // validate leap-second is correct and apply correct smoothing
+  }
+ 
+ @return a query that provides access to whether a leap-second was parsed" + {:arglists (quote ([]))} + (^js/JSJoda.TemporalQuery [] + (js-invoke java.time.format.DateTimeFormatter "parsedLeapSecond"))) + +(defn with-zone + "Returns a copy of this formatter with a new override zone. + + This returns a formatter with similar state to this formatter but + with the override zone set. + By default, a formatter has no override zone, returning null. + + If an override is added, then any instant that is formatted or parsed will be affected. + + When formatting, if the temporal object contains an instant, then it will + be converted to a zoned date-time using the override zone. + Whether the temporal is an instant is determined by querying the + {@link ChronoField#INSTANT_SECONDS INSTANT_SECONDS} field. + If the input has a chronology then it will be retained unless overridden. + If the input does not have a chronology, such as {@code Instant}, then + the ISO chronology will be used. + + If the temporal object does not contain an instant, but does contain + an offset then an additional check is made. If the normalized override + zone is an offset that differs from the offset of the temporal, then + a {@code DateTimeException} is thrown. In all other cases, the override + zone is added to the temporal, replacing any previous zone, but without + changing the date/time. + + When parsing, there are two distinct cases to consider. + If a zone has been parsed directly from the text, perhaps because + {@link DateTimeFormatterBuilder#appendZoneId()} was used, then + this override zone has no effect. + If no zone has been parsed, then this override zone will be included in + the result of the parse where it can be used to build instants and date-times. + + This instance is immutable and unaffected by this method call. + + @param zone the new override zone, null if no override + @return a formatter based on this formatter with the requested override zone, not null" + {:arglists (quote (["java.time.format.DateTimeFormatter" + "java.time.ZoneId"]))} + (^js/JSJoda.DateTimeFormatter + [^js/JSJoda.DateTimeFormatter this ^js/JSJoda.ZoneId zone] + (.withZone this zone))) + +(defn parsed-excess-days + "A query that provides access to the excess days that were parsed. + + This returns a singleton {@linkplain TemporalQuery query} that provides + access to additional information from the parse. The query always returns + a non-null period, with a zero period returned instead of null. + + There are two situations where this query may return a non-zero period. + + + In both cases, if a complete {@code ChronoLocalDateTime} or {@code Instant} + is parsed, then the excess days are added to the date part. + As a result, this query will return a zero period. + + The {@code SMART} behaviour handles the common \"end of day\" 24:00 value. + Processing in {@code LENIENT} mode also produces the same result: +
+  Text to parse        Parsed object                         Excess days
+  \"2012-12-03T00:00\"   LocalDateTime.of(2012, 12, 3, 0, 0)   ZERO
+  \"2012-12-03T24:00\"   LocalDateTime.of(2012, 12, 4, 0, 0)   ZERO
+  \"00:00\"              LocalTime.of(0, 0)                    ZERO
+  \"24:00\"              LocalTime.of(0, 0)                    Period.ofDays(1)
+ 
+ The query can be used as follows: +
+  TemporalAccessor parsed = formatter.parse(str);
+  LocalTime time = parsed.query(LocalTime::from);
+  Period extraDays = parsed.query(DateTimeFormatter.parsedExcessDays());
+ 
+ @return a query that provides access to the excess days that were parsed" + {:arglists (quote ([]))} + (^js/JSJoda.TemporalQuery [] + (js-invoke java.time.format.DateTimeFormatter "parsedExcessDays"))) + +(defn get-zone + "Gets the overriding zone to be used during formatting. + + This returns the override zone, used to convert instants. + By default, a formatter has no override zone, returning null. + See {@link #withZone(ZoneId)} for more details on overriding. + + @return the override zone of this formatter, null if no override" + {:arglists (quote (["java.time.format.DateTimeFormatter"]))} + (^js/JSJoda.ZoneId [^js/JSJoda.DateTimeFormatter this] (.zone this))) + +(defn of-localized-date-time + {:arglists (quote (["java.time.format.FormatStyle"] + ["java.time.format.FormatStyle" + "java.time.format.FormatStyle"]))} + (^js/JSJoda.DateTimeFormatter [^js/JSJoda.FormatStyle date-time-style] + (js-invoke java.time.format.DateTimeFormatter + "ofLocalizedDateTime" + date-time-style)) + (^js/JSJoda.DateTimeFormatter + [^js/JSJoda.FormatStyle date-style ^js/JSJoda.FormatStyle time-style] + (js-invoke java.time.format.DateTimeFormatter + "ofLocalizedDateTime" + date-style + time-style))) + +(defn get-resolver-fields + "Gets the resolver fields to use during parsing. + + This returns the resolver fields, used during the second phase of parsing + when fields are resolved into dates and times. + By default, a formatter has no resolver fields, and thus returns null. + See {@link #withResolverFields(Set)} for more details. + + @return the immutable set of resolver fields of this formatter, null if no fields" + {:arglists (quote (["java.time.format.DateTimeFormatter"]))} + (^java.util.Set [^js/JSJoda.DateTimeFormatter this] (.resolverFields this))) + +(defn get-chronology + "Gets the overriding chronology to be used during formatting. + + This returns the override chronology, used to convert dates. + By default, a formatter has no override chronology, returning null. + See {@link #withChronology(Chronology)} for more details on overriding. + + @return the override chronology of this formatter, null if no override" + {:arglists (quote (["java.time.format.DateTimeFormatter"]))} + (^js/JSJoda.Chronology [^js/JSJoda.DateTimeFormatter this] + (.chronology this))) + +(defn parse + {:arglists (quote + (["java.time.format.DateTimeFormatter" "java.lang.CharSequence"] + ["java.time.format.DateTimeFormatter" "java.lang.CharSequence" + "java.text.ParsePosition"] + ["java.time.format.DateTimeFormatter" "java.lang.CharSequence" + "java.time.temporal.TemporalQuery"]))} + (^js/JSJoda.TemporalAccessor + [^js/JSJoda.DateTimeFormatter this ^java.lang.CharSequence text] + (.parse this text)) + (^java.lang.Object [^js/JSJoda.DateTimeFormatter this arg0 arg1] + (.parse ^js/JSJoda.DateTimeFormatter this arg0 arg1))) + +(defn with-locale + "Returns a copy of this formatter with a new locale. + + This is used to lookup any part of the formatter needing specific + localization, such as the text or localized pattern. + + This instance is immutable and unaffected by this method call. + + @param locale the new locale, not null + @return a formatter based on this formatter with the requested locale, not null" + {:arglists (quote (["java.time.format.DateTimeFormatter" + "java.util.Locale"]))} + (^js/JSJoda.DateTimeFormatter + [^js/JSJoda.DateTimeFormatter this ^java.util.Locale locale] + (.withLocale this locale))) + +(defn with-resolver-fields + {:arglists (quote (["java.time.format.DateTimeFormatter" + "[Ljava.time.temporal.TemporalField;"] + ["java.time.format.DateTimeFormatter" "java.util.Set"]))} + (^js/JSJoda.DateTimeFormatter [^js/JSJoda.DateTimeFormatter this arg0] + (.withResolverFields ^js/JSJoda.DateTimeFormatter this arg0))) + +(defn parse-unresolved + "Parses the text using this formatter, without resolving the result, intended + for advanced use cases. + + Parsing is implemented as a two-phase operation. + First, the text is parsed using the layout defined by the formatter, producing + a {@code Map} of field to value, a {@code ZoneId} and a {@code Chronology}. + Second, the parsed data is resolved, by validating, combining and + simplifying the various fields into more useful ones. + This method performs the parsing stage but not the resolving stage. + + The result of this method is {@code TemporalAccessor} which represents the + data as seen in the input. Values are not validated, thus parsing a date string + of '2012-00-65' would result in a temporal with three fields - year of '2012', + month of '0' and day-of-month of '65'. + + The text will be parsed from the specified start {@code ParsePosition}. + The entire length of the text does not have to be parsed, the {@code ParsePosition} + will be updated with the index at the end of parsing. + + Errors are returned using the error index field of the {@code ParsePosition} + instead of {@code DateTimeParseException}. + The returned error index will be set to an index indicative of the error. + Callers must check for errors before using the result. + + If the formatter parses the same field more than once with different values, + the result will be an error. + + This method is intended for advanced use cases that need access to the + internal state during parsing. Typical application code should use + {@link #parse(CharSequence, TemporalQuery)} or the parse method on the target type. + + @param text the text to parse, not null + @param position the position to parse from, updated with length parsed + and the index of any error, not null + @return the parsed text, null if the parse results in an error + @throws DateTimeException if some problem occurs during parsing + @throws IndexOutOfBoundsException if the position is invalid" + {:arglists (quote (["java.time.format.DateTimeFormatter" + "java.lang.CharSequence" "java.text.ParsePosition"]))} + (^js/JSJoda.TemporalAccessor + [^js/JSJoda.DateTimeFormatter this ^java.lang.CharSequence text + ^java.text.ParsePosition position] + (.parseUnresolved this text position))) + +(defn of-localized-time + "Returns a locale specific time format for the ISO chronology. + + This returns a formatter that will format or parse a time. + The exact format pattern used varies by locale. + + The locale is determined from the formatter. The formatter returned directly by + this method will use the {@link Locale#getDefault(Locale.Category) default FORMAT locale}. + The locale can be controlled using {@link DateTimeFormatter#withLocale(Locale) withLocale(Locale)} + on the result of this method. + + Note that the localized pattern is looked up lazily. + This {@code DateTimeFormatter} holds the style required and the locale, + looking up the pattern required on demand. + + The returned formatter has a chronology of ISO set to ensure dates in + other calendar systems are correctly converted. + It has no override zone and uses the {@link ResolverStyle#SMART SMART} resolver style. + + @param timeStyle the formatter style to obtain, not null + @return the time formatter, not null" + {:arglists (quote (["java.time.format.FormatStyle"]))} + (^js/JSJoda.DateTimeFormatter [^js/JSJoda.FormatStyle time-style] + (js-invoke java.time.format.DateTimeFormatter "ofLocalizedTime" time-style))) + +(defn of-localized-date + "Returns a locale specific date format for the ISO chronology. + + This returns a formatter that will format or parse a date. + The exact format pattern used varies by locale. + + The locale is determined from the formatter. The formatter returned directly by + this method will use the {@link Locale#getDefault(Locale.Category) default FORMAT locale}. + The locale can be controlled using {@link DateTimeFormatter#withLocale(Locale) withLocale(Locale)} + on the result of this method. + + Note that the localized pattern is looked up lazily. + This {@code DateTimeFormatter} holds the style required and the locale, + looking up the pattern required on demand. + + The returned formatter has a chronology of ISO set to ensure dates in + other calendar systems are correctly converted. + It has no override zone and uses the {@link ResolverStyle#SMART SMART} resolver style. + + @param dateStyle the formatter style to obtain, not null + @return the date formatter, not null" + {:arglists (quote (["java.time.format.FormatStyle"]))} + (^js/JSJoda.DateTimeFormatter [^js/JSJoda.FormatStyle date-style] + (js-invoke java.time.format.DateTimeFormatter "ofLocalizedDate" date-style))) + +(defn format + "Formats a date-time object using this formatter. + + This formats the date-time to a String using the rules of the formatter. + + @param temporal the temporal object to format, not null + @return the formatted string, not null + @throws DateTimeException if an error occurs during formatting" + {:arglists (quote (["java.time.format.DateTimeFormatter" + "java.time.temporal.TemporalAccessor"]))} + (^java.lang.String + [^js/JSJoda.DateTimeFormatter this ^js/JSJoda.TemporalAccessor temporal] + (cljc.java-time.extn.calendar-awareness/calendar-aware-cljs + (.format this temporal)))) + +(defn to-format + {:arglists (quote (["java.time.format.DateTimeFormatter"] + ["java.time.format.DateTimeFormatter" + "java.time.temporal.TemporalQuery"]))} + (^java.text.Format [^js/JSJoda.DateTimeFormatter this] (.toFormat this)) + (^java.text.Format + [^js/JSJoda.DateTimeFormatter this ^js/JSJoda.TemporalQuery parse-query] + (.toFormat this parse-query))) + +(defn with-resolver-style + "Returns a copy of this formatter with a new resolver style. + + This returns a formatter with similar state to this formatter but + with the resolver style set. By default, a formatter has the + {@link ResolverStyle#SMART SMART} resolver style. + + Changing the resolver style only has an effect during parsing. + Parsing a text string occurs in two phases. + Phase 1 is a basic text parse according to the fields added to the builder. + Phase 2 resolves the parsed field-value pairs into date and/or time objects. + The resolver style is used to control how phase 2, resolving, happens. + See {@code ResolverStyle} for more information on the options available. + + This instance is immutable and unaffected by this method call. + + @param resolverStyle the new resolver style, not null + @return a formatter based on this formatter with the requested resolver style, not null" + {:arglists (quote (["java.time.format.DateTimeFormatter" + "java.time.format.ResolverStyle"]))} + (^js/JSJoda.DateTimeFormatter + [^js/JSJoda.DateTimeFormatter this ^js/JSJoda.ResolverStyle resolver-style] + (.withResolverStyle this resolver-style))) diff --git a/src/cljc/java_time/format/date_time_formatter_builder.clj b/src/cljc/java_time/format/date_time_formatter_builder.clj index 5b24ec7..0a3971c 100644 --- a/src/cljc/java_time/format/date_time_formatter_builder.clj +++ b/src/cljc/java_time/format/date_time_formatter_builder.clj @@ -1,31 +1,960 @@ -(ns cljc.java-time.format.date-time-formatter-builder (:refer-clojure :exclude [abs get range format min max next name resolve short]) (:require [cljc.java-time.extn.calendar-awareness]) (:import [java.time.format DateTimeFormatterBuilder])) -^{:line 83, :column 11} (clojure.core/defn new {:arglists ^{:line 83, :column 45} (quote ^{:line 83, :column 52} ([]))} ^{:line 84, :column 13} (^java.time.format.DateTimeFormatterBuilder [] ^{:line 84, :column 60} (java.time.format.DateTimeFormatterBuilder.))) -(clojure.core/defn to-formatter {:arglists (quote (["java.time.format.DateTimeFormatterBuilder"] ["java.time.format.DateTimeFormatterBuilder" "java.util.Locale"]))} (^java.time.format.DateTimeFormatter [^java.time.format.DateTimeFormatterBuilder this15966] (.toFormatter this15966)) (^java.time.format.DateTimeFormatter [^java.time.format.DateTimeFormatterBuilder this15967 ^java.util.Locale java-util-Locale15968] (.toFormatter this15967 java-util-Locale15968))) -(clojure.core/defn append-pattern {:arglists (quote (["java.time.format.DateTimeFormatterBuilder" "java.lang.String"]))} (^java.time.format.DateTimeFormatterBuilder [^java.time.format.DateTimeFormatterBuilder this15969 ^java.lang.String java-lang-String15970] (.appendPattern this15969 java-lang-String15970))) -(clojure.core/defn append-value {:arglists (quote (["java.time.format.DateTimeFormatterBuilder" "java.time.temporal.TemporalField" "int"] ["java.time.format.DateTimeFormatterBuilder" "java.time.temporal.TemporalField" "int" "int" "java.time.format.SignStyle"] ["java.time.format.DateTimeFormatterBuilder" "java.time.temporal.TemporalField"]))} (^java.time.format.DateTimeFormatterBuilder [^java.time.format.DateTimeFormatterBuilder this15971 ^java.time.temporal.TemporalField java-time-temporal-TemporalField15972 ^java.lang.Integer int15973] (.appendValue this15971 java-time-temporal-TemporalField15972 int15973)) (^java.time.format.DateTimeFormatterBuilder [^java.time.format.DateTimeFormatterBuilder this15974 ^java.time.temporal.TemporalField java-time-temporal-TemporalField15975 ^java.lang.Integer int15976 ^java.lang.Integer int15977 ^java.time.format.SignStyle java-time-format-SignStyle15978] (.appendValue this15974 java-time-temporal-TemporalField15975 int15976 int15977 java-time-format-SignStyle15978)) (^java.time.format.DateTimeFormatterBuilder [^java.time.format.DateTimeFormatterBuilder this15979 ^java.time.temporal.TemporalField java-time-temporal-TemporalField15980] (.appendValue this15979 java-time-temporal-TemporalField15980))) -(clojure.core/defn append-instant {:arglists (quote (["java.time.format.DateTimeFormatterBuilder"] ["java.time.format.DateTimeFormatterBuilder" "int"]))} (^java.time.format.DateTimeFormatterBuilder [^java.time.format.DateTimeFormatterBuilder this15981] (.appendInstant this15981)) (^java.time.format.DateTimeFormatterBuilder [^java.time.format.DateTimeFormatterBuilder this15982 ^java.lang.Integer int15983] (.appendInstant this15982 int15983))) -(clojure.core/defn append-literal {:arglists (quote (["java.time.format.DateTimeFormatterBuilder" "char"] ["java.time.format.DateTimeFormatterBuilder" "java.lang.String"]))} (^java.time.format.DateTimeFormatterBuilder [this15984 G__15985] (clojure.core/cond (clojure.core/and (clojure.core/instance? java.lang.Character G__15985)) (clojure.core/let [G__15985 ^"java.lang.Character" G__15985] (.appendLiteral ^java.time.format.DateTimeFormatterBuilder this15984 G__15985)) (clojure.core/and (clojure.core/instance? java.lang.String G__15985)) (clojure.core/let [G__15985 ^"java.lang.String" G__15985] (.appendLiteral ^java.time.format.DateTimeFormatterBuilder this15984 G__15985)) :else (throw (java.lang.IllegalArgumentException. "no corresponding java.time method with these args"))))) -(clojure.core/defn optional-start {:arglists (quote (["java.time.format.DateTimeFormatterBuilder"]))} (^java.time.format.DateTimeFormatterBuilder [^java.time.format.DateTimeFormatterBuilder this15986] (.optionalStart this15986))) -(clojure.core/defn append-fraction {:arglists (quote (["java.time.format.DateTimeFormatterBuilder" "java.time.temporal.TemporalField" "int" "int" "boolean"]))} (^java.time.format.DateTimeFormatterBuilder [^java.time.format.DateTimeFormatterBuilder this15987 ^java.time.temporal.TemporalField java-time-temporal-TemporalField15988 ^java.lang.Integer int15989 ^java.lang.Integer int15990 ^java.lang.Boolean boolean15991] (.appendFraction this15987 java-time-temporal-TemporalField15988 int15989 int15990 boolean15991))) -(clojure.core/defn append-optional {:arglists (quote (["java.time.format.DateTimeFormatterBuilder" "java.time.format.DateTimeFormatter"]))} (^java.time.format.DateTimeFormatterBuilder [^java.time.format.DateTimeFormatterBuilder this15992 ^java.time.format.DateTimeFormatter java-time-format-DateTimeFormatter15993] (.appendOptional this15992 java-time-format-DateTimeFormatter15993))) -(clojure.core/defn optional-end {:arglists (quote (["java.time.format.DateTimeFormatterBuilder"]))} (^java.time.format.DateTimeFormatterBuilder [^java.time.format.DateTimeFormatterBuilder this15994] (.optionalEnd this15994))) -(clojure.core/defn parse-lenient {:arglists (quote (["java.time.format.DateTimeFormatterBuilder"]))} (^java.time.format.DateTimeFormatterBuilder [^java.time.format.DateTimeFormatterBuilder this15995] (.parseLenient this15995))) -(clojure.core/defn pad-next {:arglists (quote (["java.time.format.DateTimeFormatterBuilder" "int"] ["java.time.format.DateTimeFormatterBuilder" "int" "char"]))} (^java.time.format.DateTimeFormatterBuilder [^java.time.format.DateTimeFormatterBuilder this15996 ^java.lang.Integer int15997] (.padNext this15996 int15997)) (^java.time.format.DateTimeFormatterBuilder [^java.time.format.DateTimeFormatterBuilder this15998 ^java.lang.Integer int15999 ^java.lang.Character char16000] (.padNext this15998 int15999 char16000))) -(clojure.core/defn append-chronology-id {:arglists (quote (["java.time.format.DateTimeFormatterBuilder"]))} (^java.time.format.DateTimeFormatterBuilder [^java.time.format.DateTimeFormatterBuilder this16001] (.appendChronologyId this16001))) -(clojure.core/defn append-zone-or-offset-id {:arglists (quote (["java.time.format.DateTimeFormatterBuilder"]))} (^java.time.format.DateTimeFormatterBuilder [^java.time.format.DateTimeFormatterBuilder this16002] (.appendZoneOrOffsetId this16002))) -(clojure.core/defn parse-case-sensitive {:arglists (quote (["java.time.format.DateTimeFormatterBuilder"]))} (^java.time.format.DateTimeFormatterBuilder [^java.time.format.DateTimeFormatterBuilder this16003] (.parseCaseSensitive this16003))) -(clojure.core/defn parse-strict {:arglists (quote (["java.time.format.DateTimeFormatterBuilder"]))} (^java.time.format.DateTimeFormatterBuilder [^java.time.format.DateTimeFormatterBuilder this16004] (.parseStrict this16004))) -(clojure.core/defn append-chronology-text {:arglists (quote (["java.time.format.DateTimeFormatterBuilder" "java.time.format.TextStyle"]))} (^java.time.format.DateTimeFormatterBuilder [^java.time.format.DateTimeFormatterBuilder this16005 ^java.time.format.TextStyle java-time-format-TextStyle16006] (.appendChronologyText this16005 java-time-format-TextStyle16006))) -(clojure.core/defn append-offset-id {:arglists (quote (["java.time.format.DateTimeFormatterBuilder"]))} (^java.time.format.DateTimeFormatterBuilder [^java.time.format.DateTimeFormatterBuilder this16007] (.appendOffsetId this16007))) -(clojure.core/defn append-zone-region-id {:arglists (quote (["java.time.format.DateTimeFormatterBuilder"]))} (^java.time.format.DateTimeFormatterBuilder [^java.time.format.DateTimeFormatterBuilder this16008] (.appendZoneRegionId this16008))) -(clojure.core/defn parse-defaulting {:arglists (quote (["java.time.format.DateTimeFormatterBuilder" "java.time.temporal.TemporalField" "long"]))} (^java.time.format.DateTimeFormatterBuilder [^java.time.format.DateTimeFormatterBuilder this16009 ^java.time.temporal.TemporalField java-time-temporal-TemporalField16010 ^long long16011] (.parseDefaulting this16009 java-time-temporal-TemporalField16010 long16011))) -(clojure.core/defn append-zone-id {:arglists (quote (["java.time.format.DateTimeFormatterBuilder"]))} (^java.time.format.DateTimeFormatterBuilder [^java.time.format.DateTimeFormatterBuilder this16012] (.appendZoneId this16012))) -(clojure.core/defn get-localized-date-time-pattern {:arglists (quote (["java.time.format.FormatStyle" "java.time.format.FormatStyle" "java.time.chrono.Chronology" "java.util.Locale"]))} (^java.lang.String [^java.time.format.FormatStyle java-time-format-FormatStyle16013 ^java.time.format.FormatStyle java-time-format-FormatStyle16014 ^java.time.chrono.Chronology java-time-chrono-Chronology16015 ^java.util.Locale java-util-Locale16016] (java.time.format.DateTimeFormatterBuilder/getLocalizedDateTimePattern java-time-format-FormatStyle16013 java-time-format-FormatStyle16014 java-time-chrono-Chronology16015 java-util-Locale16016))) -(clojure.core/defn parse-case-insensitive {:arglists (quote (["java.time.format.DateTimeFormatterBuilder"]))} (^java.time.format.DateTimeFormatterBuilder [^java.time.format.DateTimeFormatterBuilder this16017] (.parseCaseInsensitive this16017))) -(clojure.core/defn append-localized-offset {:arglists (quote (["java.time.format.DateTimeFormatterBuilder" "java.time.format.TextStyle"]))} (^java.time.format.DateTimeFormatterBuilder [^java.time.format.DateTimeFormatterBuilder this16018 ^java.time.format.TextStyle java-time-format-TextStyle16019] (.appendLocalizedOffset this16018 java-time-format-TextStyle16019))) -(clojure.core/defn append {:arglists (quote (["java.time.format.DateTimeFormatterBuilder" "java.time.format.DateTimeFormatter"]))} (^java.time.format.DateTimeFormatterBuilder [^java.time.format.DateTimeFormatterBuilder this16020 ^java.time.format.DateTimeFormatter java-time-format-DateTimeFormatter16021] (.append this16020 java-time-format-DateTimeFormatter16021))) -(clojure.core/defn append-text {:arglists (quote (["java.time.format.DateTimeFormatterBuilder" "java.time.temporal.TemporalField" "java.time.format.TextStyle"] ["java.time.format.DateTimeFormatterBuilder" "java.time.temporal.TemporalField"] ["java.time.format.DateTimeFormatterBuilder" "java.time.temporal.TemporalField" "java.util.Map"]))} (^java.time.format.DateTimeFormatterBuilder [this16022 G__16023 G__16024] (clojure.core/cond (clojure.core/and (clojure.core/instance? java.time.temporal.TemporalField G__16023) (clojure.core/instance? java.time.format.TextStyle G__16024)) (clojure.core/let [G__16023 ^"java.time.temporal.TemporalField" G__16023 G__16024 ^"java.time.format.TextStyle" G__16024] (.appendText ^java.time.format.DateTimeFormatterBuilder this16022 G__16023 G__16024)) (clojure.core/and (clojure.core/instance? java.time.temporal.TemporalField G__16023) (clojure.core/instance? java.util.Map G__16024)) (clojure.core/let [G__16023 ^"java.time.temporal.TemporalField" G__16023 G__16024 ^"java.util.Map" G__16024] (.appendText ^java.time.format.DateTimeFormatterBuilder this16022 G__16023 G__16024)) :else (throw (java.lang.IllegalArgumentException. "no corresponding java.time method with these args")))) (^java.time.format.DateTimeFormatterBuilder [^java.time.format.DateTimeFormatterBuilder this16025 ^java.time.temporal.TemporalField java-time-temporal-TemporalField16026] (.appendText this16025 java-time-temporal-TemporalField16026))) -(clojure.core/defn append-localized {:arglists (quote (["java.time.format.DateTimeFormatterBuilder" "java.time.format.FormatStyle" "java.time.format.FormatStyle"]))} (^java.time.format.DateTimeFormatterBuilder [^java.time.format.DateTimeFormatterBuilder this16027 ^java.time.format.FormatStyle java-time-format-FormatStyle16028 ^java.time.format.FormatStyle java-time-format-FormatStyle16029] (.appendLocalized this16027 java-time-format-FormatStyle16028 java-time-format-FormatStyle16029))) -(clojure.core/defn append-offset {:arglists (quote (["java.time.format.DateTimeFormatterBuilder" "java.lang.String" "java.lang.String"]))} (^java.time.format.DateTimeFormatterBuilder [^java.time.format.DateTimeFormatterBuilder this16030 ^java.lang.String java-lang-String16031 ^java.lang.String java-lang-String16032] (.appendOffset this16030 java-lang-String16031 java-lang-String16032))) -(clojure.core/defn append-value-reduced {:arglists (quote (["java.time.format.DateTimeFormatterBuilder" "java.time.temporal.TemporalField" "int" "int" "int"] ["java.time.format.DateTimeFormatterBuilder" "java.time.temporal.TemporalField" "int" "int" "java.time.chrono.ChronoLocalDate"]))} (^java.time.format.DateTimeFormatterBuilder [this16033 G__16034 G__16035 G__16036 G__16037] (clojure.core/cond (clojure.core/and (clojure.core/instance? java.time.temporal.TemporalField G__16034) (clojure.core/instance? java.lang.Number G__16035) (clojure.core/instance? java.lang.Number G__16036) (clojure.core/instance? java.lang.Number G__16037)) (clojure.core/let [G__16034 ^"java.time.temporal.TemporalField" G__16034 G__16035 (clojure.core/int G__16035) G__16036 (clojure.core/int G__16036) G__16037 (clojure.core/int G__16037)] (.appendValueReduced ^java.time.format.DateTimeFormatterBuilder this16033 G__16034 G__16035 G__16036 G__16037)) (clojure.core/and (clojure.core/instance? java.time.temporal.TemporalField G__16034) (clojure.core/instance? java.lang.Number G__16035) (clojure.core/instance? java.lang.Number G__16036) (clojure.core/instance? java.time.chrono.ChronoLocalDate G__16037)) (clojure.core/let [G__16034 ^"java.time.temporal.TemporalField" G__16034 G__16035 (clojure.core/int G__16035) G__16036 (clojure.core/int G__16036) G__16037 ^"java.time.chrono.ChronoLocalDate" G__16037] (.appendValueReduced ^java.time.format.DateTimeFormatterBuilder this16033 G__16034 G__16035 G__16036 G__16037)) :else (throw (java.lang.IllegalArgumentException. "no corresponding java.time method with these args"))))) -(clojure.core/defn append-zone-text {:arglists (quote (["java.time.format.DateTimeFormatterBuilder" "java.time.format.TextStyle"] ["java.time.format.DateTimeFormatterBuilder" "java.time.format.TextStyle" "java.util.Set"]))} (^java.time.format.DateTimeFormatterBuilder [^java.time.format.DateTimeFormatterBuilder this16038 ^java.time.format.TextStyle java-time-format-TextStyle16039] (.appendZoneText this16038 java-time-format-TextStyle16039)) (^java.time.format.DateTimeFormatterBuilder [^java.time.format.DateTimeFormatterBuilder this16040 ^java.time.format.TextStyle java-time-format-TextStyle16041 ^java.util.Set java-util-Set16042] (.appendZoneText this16040 java-time-format-TextStyle16041 java-util-Set16042))) +(ns cljc.java-time.format.date-time-formatter-builder + (:refer-clojure :exclude + [abs get range format min max next name resolve short]) + (:require [cljc.java-time.extn.calendar-awareness]) + (:import [java.time.format DateTimeFormatterBuilder])) + +(defn new + {:arglists (quote ([]))} + (^java.time.format.DateTimeFormatterBuilder [] + (java.time.format.DateTimeFormatterBuilder.))) + +(defn to-formatter + {:arglists (quote (["java.time.format.DateTimeFormatterBuilder"] + ["java.time.format.DateTimeFormatterBuilder" + "java.util.Locale"]))} + (^java.time.format.DateTimeFormatter + [^java.time.format.DateTimeFormatterBuilder this] + (.toFormatter this)) + (^java.time.format.DateTimeFormatter + [^java.time.format.DateTimeFormatterBuilder this ^java.util.Locale locale] + (.toFormatter this locale))) + +(defn append-pattern + "Appends the elements defined by the specified pattern to the builder. + + All letters 'A' to 'Z' and 'a' to 'z' are reserved as pattern letters. + The characters '#', '{' and '}' are reserved for future use. + The characters '[' and ']' indicate optional patterns. + The following pattern letters are defined: +
+  Symbol  Meaning                     Presentation      Examples
+  ------  -------                     ------------      -------
+   G       era                         text              AD; Anno Domini; A
+   u       year                        year              2004; 04
+   y       year-of-era                 year              2004; 04
+   D       day-of-year                 number            189
+   M/L     month-of-year               number/text       7; 07; Jul; July; J
+   d       day-of-month                number            10
+
+   Q/q     quarter-of-year             number/text       3; 03; Q3; 3rd quarter
+   Y       week-based-year             year              1996; 96
+   w       week-of-week-based-year     number            27
+   W       week-of-month               number            4
+   E       day-of-week                 text              Tue; Tuesday; T
+   e/c     localized day-of-week       number/text       2; 02; Tue; Tuesday; T
+   F       week-of-month               number            3
+
+   a       am-pm-of-day                text              PM
+   h       clock-hour-of-am-pm (1-12)  number            12
+   K       hour-of-am-pm (0-11)        number            0
+   k       clock-hour-of-am-pm (1-24)  number            0
+
+   H       hour-of-day (0-23)          number            0
+   m       minute-of-hour              number            30
+   s       second-of-minute            number            55
+   S       fraction-of-second          fraction          978
+   A       milli-of-day                number            1234
+   n       nano-of-second              number            987654321
+   N       nano-of-day                 number            1234000000
+
+   V       time-zone ID                zone-id           America/Los_Angeles; Z; -08:30
+   z       time-zone name              zone-name         Pacific Standard Time; PST
+   O       localized zone-offset       offset-O          GMT+8; GMT+08:00; UTC-08:00;
+   X       zone-offset 'Z' for zero    offset-X          Z; -08; -0830; -08:30; -083015; -08:30:15;
+   x       zone-offset                 offset-x          +0000; -08; -0830; -08:30; -083015; -08:30:15;
+   Z       zone-offset                 offset-Z          +0000; -0800; -08:00;
+
+   p       pad next                    pad modifier      1
+
+   '       escape for text             delimiter
+   ''      single quote                literal           '
+   [       optional section start
+   ]       optional section end
+   #       reserved for future use
+   {       reserved for future use
+   }       reserved for future use
+ 
+ + The count of pattern letters determine the format. + See DateTimeFormatter for a user-focused description of the patterns. + The following tables define how the pattern letters map to the builder. + + Date fields: Pattern letters to output a date. +
+  Pattern  Count  Equivalent builder methods
+  -------  -----  --------------------------
+    G       1      appendText(ChronoField.ERA, TextStyle.SHORT)
+    GG      2      appendText(ChronoField.ERA, TextStyle.SHORT)
+    GGG     3      appendText(ChronoField.ERA, TextStyle.SHORT)
+    GGGG    4      appendText(ChronoField.ERA, TextStyle.FULL)
+    GGGGG   5      appendText(ChronoField.ERA, TextStyle.NARROW)
+
+    u       1      appendValue(ChronoField.YEAR, 1, 19, SignStyle.NORMAL);
+    uu      2      appendValueReduced(ChronoField.YEAR, 2, 2000);
+    uuu     3      appendValue(ChronoField.YEAR, 3, 19, SignStyle.NORMAL);
+    u..u    4..n   appendValue(ChronoField.YEAR, n, 19, SignStyle.EXCEEDS_PAD);
+    y       1      appendValue(ChronoField.YEAR_OF_ERA, 1, 19, SignStyle.NORMAL);
+    yy      2      appendValueReduced(ChronoField.YEAR_OF_ERA, 2, 2000);
+    yyy     3      appendValue(ChronoField.YEAR_OF_ERA, 3, 19, SignStyle.NORMAL);
+    y..y    4..n   appendValue(ChronoField.YEAR_OF_ERA, n, 19, SignStyle.EXCEEDS_PAD);
+    Y       1      append special localized WeekFields element for numeric week-based-year
+    YY      2      append special localized WeekFields element for reduced numeric week-based-year 2 digits;
+    YYY     3      append special localized WeekFields element for numeric week-based-year (3, 19, SignStyle.NORMAL);
+    Y..Y    4..n   append special localized WeekFields element for numeric week-based-year (n, 19, SignStyle.EXCEEDS_PAD);
+
+    Q       1      appendValue(IsoFields.QUARTER_OF_YEAR);
+    QQ      2      appendValue(IsoFields.QUARTER_OF_YEAR, 2);
+    QQQ     3      appendText(IsoFields.QUARTER_OF_YEAR, TextStyle.SHORT)
+    QQQQ    4      appendText(IsoFields.QUARTER_OF_YEAR, TextStyle.FULL)
+    QQQQQ   5      appendText(IsoFields.QUARTER_OF_YEAR, TextStyle.NARROW)
+    q       1      appendValue(IsoFields.QUARTER_OF_YEAR);
+    qq      2      appendValue(IsoFields.QUARTER_OF_YEAR, 2);
+    qqq     3      appendText(IsoFields.QUARTER_OF_YEAR, TextStyle.SHORT_STANDALONE)
+    qqqq    4      appendText(IsoFields.QUARTER_OF_YEAR, TextStyle.FULL_STANDALONE)
+    qqqqq   5      appendText(IsoFields.QUARTER_OF_YEAR, TextStyle.NARROW_STANDALONE)
+
+    M       1      appendValue(ChronoField.MONTH_OF_YEAR);
+    MM      2      appendValue(ChronoField.MONTH_OF_YEAR, 2);
+    MMM     3      appendText(ChronoField.MONTH_OF_YEAR, TextStyle.SHORT)
+    MMMM    4      appendText(ChronoField.MONTH_OF_YEAR, TextStyle.FULL)
+    MMMMM   5      appendText(ChronoField.MONTH_OF_YEAR, TextStyle.NARROW)
+    L       1      appendValue(ChronoField.MONTH_OF_YEAR);
+    LL      2      appendValue(ChronoField.MONTH_OF_YEAR, 2);
+    LLL     3      appendText(ChronoField.MONTH_OF_YEAR, TextStyle.SHORT_STANDALONE)
+    LLLL    4      appendText(ChronoField.MONTH_OF_YEAR, TextStyle.FULL_STANDALONE)
+    LLLLL   5      appendText(ChronoField.MONTH_OF_YEAR, TextStyle.NARROW_STANDALONE)
+
+    w       1      append special localized WeekFields element for numeric week-of-year
+    ww      2      append special localized WeekFields element for numeric week-of-year, zero-padded
+    W       1      append special localized WeekFields element for numeric week-of-month
+    d       1      appendValue(ChronoField.DAY_OF_MONTH)
+    dd      2      appendValue(ChronoField.DAY_OF_MONTH, 2)
+    D       1      appendValue(ChronoField.DAY_OF_YEAR)
+    DD      2      appendValue(ChronoField.DAY_OF_YEAR, 2)
+    DDD     3      appendValue(ChronoField.DAY_OF_YEAR, 3)
+    F       1      appendValue(ChronoField.ALIGNED_DAY_OF_WEEK_IN_MONTH)
+    E       1      appendText(ChronoField.DAY_OF_WEEK, TextStyle.SHORT)
+    EE      2      appendText(ChronoField.DAY_OF_WEEK, TextStyle.SHORT)
+    EEE     3      appendText(ChronoField.DAY_OF_WEEK, TextStyle.SHORT)
+    EEEE    4      appendText(ChronoField.DAY_OF_WEEK, TextStyle.FULL)
+    EEEEE   5      appendText(ChronoField.DAY_OF_WEEK, TextStyle.NARROW)
+    e       1      append special localized WeekFields element for numeric day-of-week
+    ee      2      append special localized WeekFields element for numeric day-of-week, zero-padded
+    eee     3      appendText(ChronoField.DAY_OF_WEEK, TextStyle.SHORT)
+    eeee    4      appendText(ChronoField.DAY_OF_WEEK, TextStyle.FULL)
+    eeeee   5      appendText(ChronoField.DAY_OF_WEEK, TextStyle.NARROW)
+    c       1      append special localized WeekFields element for numeric day-of-week
+    ccc     3      appendText(ChronoField.DAY_OF_WEEK, TextStyle.SHORT_STANDALONE)
+    cccc    4      appendText(ChronoField.DAY_OF_WEEK, TextStyle.FULL_STANDALONE)
+    ccccc   5      appendText(ChronoField.DAY_OF_WEEK, TextStyle.NARROW_STANDALONE)
+ 
+ + Time fields: Pattern letters to output a time. +
+  Pattern  Count  Equivalent builder methods
+  -------  -----  --------------------------
+    a       1      appendText(ChronoField.AMPM_OF_DAY, TextStyle.SHORT)
+    h       1      appendValue(ChronoField.CLOCK_HOUR_OF_AMPM)
+    hh      2      appendValue(ChronoField.CLOCK_HOUR_OF_AMPM, 2)
+    H       1      appendValue(ChronoField.HOUR_OF_DAY)
+    HH      2      appendValue(ChronoField.HOUR_OF_DAY, 2)
+    k       1      appendValue(ChronoField.CLOCK_HOUR_OF_DAY)
+    kk      2      appendValue(ChronoField.CLOCK_HOUR_OF_DAY, 2)
+    K       1      appendValue(ChronoField.HOUR_OF_AMPM)
+    KK      2      appendValue(ChronoField.HOUR_OF_AMPM, 2)
+    m       1      appendValue(ChronoField.MINUTE_OF_HOUR)
+    mm      2      appendValue(ChronoField.MINUTE_OF_HOUR, 2)
+    s       1      appendValue(ChronoField.SECOND_OF_MINUTE)
+    ss      2      appendValue(ChronoField.SECOND_OF_MINUTE, 2)
+
+    S..S    1..n   appendFraction(ChronoField.NANO_OF_SECOND, n, n, false)
+    A       1      appendValue(ChronoField.MILLI_OF_DAY)
+    A..A    2..n   appendValue(ChronoField.MILLI_OF_DAY, n)
+    n       1      appendValue(ChronoField.NANO_OF_SECOND)
+    n..n    2..n   appendValue(ChronoField.NANO_OF_SECOND, n)
+    N       1      appendValue(ChronoField.NANO_OF_DAY)
+    N..N    2..n   appendValue(ChronoField.NANO_OF_DAY, n)
+ 
+ + Zone ID: Pattern letters to output {@code ZoneId}. +
+  Pattern  Count  Equivalent builder methods
+  -------  -----  --------------------------
+    VV      2      appendZoneId()
+    z       1      appendZoneText(TextStyle.SHORT)
+    zz      2      appendZoneText(TextStyle.SHORT)
+    zzz     3      appendZoneText(TextStyle.SHORT)
+    zzzz    4      appendZoneText(TextStyle.FULL)
+ 
+ + Zone offset: Pattern letters to output {@code ZoneOffset}. +
+  Pattern  Count  Equivalent builder methods
+  -------  -----  --------------------------
+    O       1      appendLocalizedOffsetPrefixed(TextStyle.SHORT);
+    OOOO    4      appendLocalizedOffsetPrefixed(TextStyle.FULL);
+    X       1      appendOffset(\"+HHmm\",\"Z\")
+    XX      2      appendOffset(\"+HHMM\",\"Z\")
+    XXX     3      appendOffset(\"+HH:MM\",\"Z\")
+    XXXX    4      appendOffset(\"+HHMMss\",\"Z\")
+    XXXXX   5      appendOffset(\"+HH:MM:ss\",\"Z\")
+    x       1      appendOffset(\"+HHmm\",\"+00\")
+    xx      2      appendOffset(\"+HHMM\",\"+0000\")
+    xxx     3      appendOffset(\"+HH:MM\",\"+00:00\")
+    xxxx    4      appendOffset(\"+HHMMss\",\"+0000\")
+    xxxxx   5      appendOffset(\"+HH:MM:ss\",\"+00:00\")
+    Z       1      appendOffset(\"+HHMM\",\"+0000\")
+    ZZ      2      appendOffset(\"+HHMM\",\"+0000\")
+    ZZZ     3      appendOffset(\"+HHMM\",\"+0000\")
+    ZZZZ    4      appendLocalizedOffset(TextStyle.FULL);
+    ZZZZZ   5      appendOffset(\"+HH:MM:ss\",\"Z\")
+ 
+ + Modifiers: Pattern letters that modify the rest of the pattern: +
+  Pattern  Count  Equivalent builder methods
+  -------  -----  --------------------------
+    [       1      optionalStart()
+    ]       1      optionalEnd()
+    p..p    1..n   padNext(n)
+ 
+ + Any sequence of letters not specified above, unrecognized letter or + reserved character will throw an exception. + Future versions may add to the set of patterns. + It is recommended to use single quotes around all characters that you want + to output directly to ensure that future changes do not break your application. + + Note that the pattern string is similar, but not identical, to + {@link java.text.SimpleDateFormat SimpleDateFormat}. + The pattern string is also similar, but not identical, to that defined by the + Unicode Common Locale Data Repository (CLDR/LDML). + Pattern letters 'X' and 'u' are aligned with Unicode CLDR/LDML. + By contrast, {@code SimpleDateFormat} uses 'u' for the numeric day of week. + Pattern letters 'y' and 'Y' parse years of two digits and more than 4 digits differently. + Pattern letters 'n', 'A', 'N', and 'p' are added. + Number types will reject large numbers. + + @param pattern the pattern to add, not null + @return this, for chaining, not null + @throws IllegalArgumentException if the pattern is invalid" + {:arglists (quote (["java.time.format.DateTimeFormatterBuilder" + "java.lang.String"]))} + (^java.time.format.DateTimeFormatterBuilder + [^java.time.format.DateTimeFormatterBuilder this ^java.lang.String pattern] + (.appendPattern this pattern))) + +(defn append-value + {:arglists (quote (["java.time.format.DateTimeFormatterBuilder" + "java.time.temporal.TemporalField"] + ["java.time.format.DateTimeFormatterBuilder" + "java.time.temporal.TemporalField" "int"] + ["java.time.format.DateTimeFormatterBuilder" + "java.time.temporal.TemporalField" "int" "int" + "java.time.format.SignStyle"]))} + (^java.time.format.DateTimeFormatterBuilder + [^java.time.format.DateTimeFormatterBuilder this + ^java.time.temporal.TemporalField field] + (.appendValue this field)) + (^java.time.format.DateTimeFormatterBuilder + [^java.time.format.DateTimeFormatterBuilder this + ^java.time.temporal.TemporalField field ^java.lang.Integer width] + (.appendValue this field width)) + (^java.time.format.DateTimeFormatterBuilder + [^java.time.format.DateTimeFormatterBuilder this + ^java.time.temporal.TemporalField field ^java.lang.Integer min-width + ^java.lang.Integer max-width ^java.time.format.SignStyle sign-style] + (.appendValue this field min-width max-width sign-style))) + +(defn append-instant + {:arglists (quote (["java.time.format.DateTimeFormatterBuilder"] + ["java.time.format.DateTimeFormatterBuilder" "int"]))} + (^java.time.format.DateTimeFormatterBuilder + [^java.time.format.DateTimeFormatterBuilder this] + (.appendInstant this)) + (^java.time.format.DateTimeFormatterBuilder + [^java.time.format.DateTimeFormatterBuilder this + ^java.lang.Integer fractional-digits] + (.appendInstant this fractional-digits))) + +(defn append-literal + {:arglists (quote (["java.time.format.DateTimeFormatterBuilder" "char"] + ["java.time.format.DateTimeFormatterBuilder" + "java.lang.String"]))} + (^java.time.format.DateTimeFormatterBuilder + [^java.time.format.DateTimeFormatterBuilder this arg0] + (cond (instance? java.lang.Character arg0) (let [literal (char arg0)] + (.appendLiteral this literal)) + (instance? java.lang.String arg0) (let [^java.lang.String literal arg0] + (.appendLiteral this literal)) + :else (throw (java.lang.IllegalArgumentException. + "no corresponding java.time method with these args"))))) + +(defn optional-start + "Mark the start of an optional section. + + The output of formatting can include optional sections, which may be nested. + An optional section is started by calling this method and ended by calling + {@link #optionalEnd()} or by ending the build process. + + All elements in the optional section are treated as optional. + During formatting, the section is only output if data is available in the + {@code TemporalAccessor} for all the elements in the section. + During parsing, the whole section may be missing from the parsed string. + + For example, consider a builder setup as + {@code builder.appendValue(HOUR_OF_DAY,2).optionalStart().appendValue(MINUTE_OF_HOUR,2)}. + The optional section ends automatically at the end of the builder. + During formatting, the minute will only be output if its value can be obtained from the date-time. + During parsing, the input will be successfully parsed whether the minute is present or not. + + @return this, for chaining, not null" + {:arglists (quote (["java.time.format.DateTimeFormatterBuilder"]))} + (^java.time.format.DateTimeFormatterBuilder + [^java.time.format.DateTimeFormatterBuilder this] + (.optionalStart this))) + +(defn append-fraction + "Appends the fractional value of a date-time field to the formatter. + + The fractional value of the field will be output including the + preceding decimal point. The preceding value is not output. + For example, the second-of-minute value of 15 would be output as {@code .25}. + + The width of the printed fraction can be controlled. Setting the + minimum width to zero will cause no output to be generated. + The printed fraction will have the minimum width necessary between + the minimum and maximum widths - trailing zeroes are omitted. + No rounding occurs due to the maximum width - digits are simply dropped. + + When parsing in strict mode, the number of parsed digits must be between + the minimum and maximum width. When parsing in lenient mode, the minimum + width is considered to be zero and the maximum is nine. + + If the value cannot be obtained then an exception will be thrown. + If the value is negative an exception will be thrown. + If the field does not have a fixed set of valid values then an + exception will be thrown. + If the field value in the date-time to be printed is invalid it + cannot be printed and an exception will be thrown. + + @param field the field to append, not null + @param minWidth the minimum width of the field excluding the decimal point, from 0 to 9 + @param maxWidth the maximum width of the field excluding the decimal point, from 1 to 9 + @param decimalPoint whether to output the localized decimal point symbol + @return this, for chaining, not null + @throws IllegalArgumentException if the field has a variable set of valid values or + either width is invalid" + {:arglists (quote (["java.time.format.DateTimeFormatterBuilder" + "java.time.temporal.TemporalField" "int" "int" + "boolean"]))} + (^java.time.format.DateTimeFormatterBuilder + [^java.time.format.DateTimeFormatterBuilder this + ^java.time.temporal.TemporalField field ^java.lang.Integer min-width + ^java.lang.Integer max-width ^java.lang.Boolean decimal-point] + (.appendFraction this field min-width max-width decimal-point))) + +(defn append-optional + "Appends a formatter to the builder which will optionally format/parse. + + This method has the same effect as appending each of the constituent + parts directly to this builder surrounded by an {@link #optionalStart()} and + {@link #optionalEnd()}. + + The formatter will format if data is available for all the fields contained within it. + The formatter will parse if the string matches, otherwise no error is returned. + + @param formatter the formatter to add, not null + @return this, for chaining, not null" + {:arglists (quote (["java.time.format.DateTimeFormatterBuilder" + "java.time.format.DateTimeFormatter"]))} + (^java.time.format.DateTimeFormatterBuilder + [^java.time.format.DateTimeFormatterBuilder this + ^java.time.format.DateTimeFormatter formatter] + (.appendOptional this formatter))) + +(defn optional-end + "Ends an optional section. + + The output of formatting can include optional sections, which may be nested. + An optional section is started by calling {@link #optionalStart()} and ended + using this method (or at the end of the builder). + + Calling this method without having previously called {@code optionalStart} + will throw an exception. + Calling this method immediately after calling {@code optionalStart} has no effect + on the formatter other than ending the (empty) optional section. + + All elements in the optional section are treated as optional. + During formatting, the section is only output if data is available in the + {@code TemporalAccessor} for all the elements in the section. + During parsing, the whole section may be missing from the parsed string. + + For example, consider a builder setup as + {@code builder.appendValue(HOUR_OF_DAY,2).optionalStart().appendValue(MINUTE_OF_HOUR,2).optionalEnd()}. + During formatting, the minute will only be output if its value can be obtained from the date-time. + During parsing, the input will be successfully parsed whether the minute is present or not. + + @return this, for chaining, not null + @throws IllegalStateException if there was no previous call to {@code optionalStart}" + {:arglists (quote (["java.time.format.DateTimeFormatterBuilder"]))} + (^java.time.format.DateTimeFormatterBuilder + [^java.time.format.DateTimeFormatterBuilder this] + (.optionalEnd this))) + +(defn parse-lenient + "Changes the parse style to be lenient for the remainder of the formatter. + Note that case sensitivity is set separately to this method. + + Parsing can be strict or lenient - by default its strict. + This controls the degree of flexibility in matching the text and sign styles. + Applications calling this method should typically also call {@link #parseCaseInsensitive()}. + + When used, this method changes the parsing to be lenient from this point onwards. + The change will remain in force until the end of the formatter that is eventually + constructed or until {@code parseStrict} is called. + + @return this, for chaining, not null" + {:arglists (quote (["java.time.format.DateTimeFormatterBuilder"]))} + (^java.time.format.DateTimeFormatterBuilder + [^java.time.format.DateTimeFormatterBuilder this] + (.parseLenient this))) + +(defn pad-next + {:arglists (quote (["java.time.format.DateTimeFormatterBuilder" "int"] + ["java.time.format.DateTimeFormatterBuilder" "int" + "char"]))} + (^java.time.format.DateTimeFormatterBuilder + [^java.time.format.DateTimeFormatterBuilder this + ^java.lang.Integer pad-width] + (.padNext this pad-width)) + (^java.time.format.DateTimeFormatterBuilder + [^java.time.format.DateTimeFormatterBuilder this ^java.lang.Integer pad-width + ^java.lang.Character pad-char] + (.padNext this pad-width pad-char))) + +(defn append-chronology-id + "Appends the chronology ID, such as 'ISO' or 'ThaiBuddhist', to the formatter. + + This appends an instruction to format/parse the chronology ID to the builder. + + During formatting, the chronology is obtained using a mechanism equivalent + to querying the temporal with {@link TemporalQueries#chronology()}. + It will be printed using the result of {@link Chronology#getId()}. + If the chronology cannot be obtained then an exception is thrown unless the + section of the formatter is optional. + + During parsing, the chronology is parsed and must match one of the chronologies + in {@link Chronology#getAvailableChronologies()}. + If the chronology cannot be parsed then an exception is thrown unless the + section of the formatter is optional. + The parser uses the {@linkplain #parseCaseInsensitive() case sensitive} setting. + + @return this, for chaining, not null" + {:arglists (quote (["java.time.format.DateTimeFormatterBuilder"]))} + (^java.time.format.DateTimeFormatterBuilder + [^java.time.format.DateTimeFormatterBuilder this] + (.appendChronologyId this))) + +(defn append-zone-or-offset-id + "Appends the time-zone ID, such as 'Europe/Paris' or '+02:00', to + the formatter, using the best available zone ID. + + This appends an instruction to format/parse the best available + zone or offset ID to the builder. + The zone ID is obtained in a lenient manner that first attempts to + find a true zone ID, such as that on {@code ZonedDateTime}, and + then attempts to find an offset, such as that on {@code OffsetDateTime}. + + During formatting, the zone is obtained using a mechanism equivalent + to querying the temporal with {@link TemporalQueries#zone()}. + It will be printed using the result of {@link ZoneId#getId()}. + If the zone cannot be obtained then an exception is thrown unless the + section of the formatter is optional. + + During parsing, the text must match a known zone or offset. + There are two types of zone ID, offset-based, such as '+01:30' and + region-based, such as 'Europe/London'. These are parsed differently. + If the parse starts with '+', '-', 'UT', 'UTC' or 'GMT', then the parser + expects an offset-based zone and will not match region-based zones. + The offset ID, such as '+02:30', may be at the start of the parse, + or prefixed by 'UT', 'UTC' or 'GMT'. The offset ID parsing is + equivalent to using {@link #appendOffset(String, String)} using the + arguments 'HH:MM:ss' and the no offset string '0'. + If the parse starts with 'UT', 'UTC' or 'GMT', and the parser cannot + match a following offset ID, then {@link ZoneOffset#UTC} is selected. + In all other cases, the list of known region-based zones is used to + find the longest available match. If no match is found, and the parse + starts with 'Z', then {@code ZoneOffset.UTC} is selected. + The parser uses the {@linkplain #parseCaseInsensitive() case sensitive} setting. + + For example, the following will parse: +
+   \"Europe/London\"           -- ZoneId.of(\"Europe/London\")
+   \"Z\"                       -- ZoneOffset.UTC
+   \"UT\"                      -- ZoneId.of(\"UT\")
+   \"UTC\"                     -- ZoneId.of(\"UTC\")
+   \"GMT\"                     -- ZoneId.of(\"GMT\")
+   \"+01:30\"                  -- ZoneOffset.of(\"+01:30\")
+   \"UT+01:30\"                -- ZoneOffset.of(\"UT+01:30\")
+   \"UTC+01:30\"               -- ZoneOffset.of(\"UTC+01:30\")
+   \"GMT+01:30\"               -- ZoneOffset.of(\"GMT+01:30\")
+ 
+ + Note that this method is identical to {@code appendZoneId()} except + in the mechanism used to obtain the zone. + + @return this, for chaining, not null + @see #appendZoneId()" + {:arglists (quote (["java.time.format.DateTimeFormatterBuilder"]))} + (^java.time.format.DateTimeFormatterBuilder + [^java.time.format.DateTimeFormatterBuilder this] + (.appendZoneOrOffsetId this))) + +(defn parse-case-sensitive + "Changes the parse style to be case sensitive for the remainder of the formatter. + + Parsing can be case sensitive or insensitive - by default it is case sensitive. + This method allows the case sensitivity setting of parsing to be changed. + + Calling this method changes the state of the builder such that all + subsequent builder method calls will parse text in case sensitive mode. + See {@link #parseCaseInsensitive} for the opposite setting. + The parse case sensitive/insensitive methods may be called at any point + in the builder, thus the parser can swap between case parsing modes + multiple times during the parse. + + Since the default is case sensitive, this method should only be used after + a previous call to {@code #parseCaseInsensitive}. + + @return this, for chaining, not null" + {:arglists (quote (["java.time.format.DateTimeFormatterBuilder"]))} + (^java.time.format.DateTimeFormatterBuilder + [^java.time.format.DateTimeFormatterBuilder this] + (.parseCaseSensitive this))) + +(defn parse-strict + "Changes the parse style to be strict for the remainder of the formatter. + + Parsing can be strict or lenient - by default its strict. + This controls the degree of flexibility in matching the text and sign styles. + + When used, this method changes the parsing to be strict from this point onwards. + As strict is the default, this is normally only needed after calling {@link #parseLenient()}. + The change will remain in force until the end of the formatter that is eventually + constructed or until {@code parseLenient} is called. + + @return this, for chaining, not null" + {:arglists (quote (["java.time.format.DateTimeFormatterBuilder"]))} + (^java.time.format.DateTimeFormatterBuilder + [^java.time.format.DateTimeFormatterBuilder this] + (.parseStrict this))) + +(defn append-chronology-text + "Appends the chronology name to the formatter. + + The calendar system name will be output during a format. + If the chronology cannot be obtained then an exception will be thrown. + + @param textStyle the text style to use, not null + @return this, for chaining, not null" + {:arglists (quote (["java.time.format.DateTimeFormatterBuilder" + "java.time.format.TextStyle"]))} + (^java.time.format.DateTimeFormatterBuilder + [^java.time.format.DateTimeFormatterBuilder this + ^java.time.format.TextStyle text-style] + (.appendChronologyText this text-style))) + +(defn append-offset-id + "Appends the zone offset, such as '+01:00', to the formatter. + + This appends an instruction to format/parse the offset ID to the builder. + This is equivalent to calling {@code appendOffset(\"+HH:MM:ss\", \"Z\")}. + + @return this, for chaining, not null" + {:arglists (quote (["java.time.format.DateTimeFormatterBuilder"]))} + (^java.time.format.DateTimeFormatterBuilder + [^java.time.format.DateTimeFormatterBuilder this] + (.appendOffsetId this))) + +(defn append-zone-region-id + "Appends the time-zone region ID, such as 'Europe/Paris', to the formatter, + rejecting the zone ID if it is a {@code ZoneOffset}. + + This appends an instruction to format/parse the zone ID to the builder + only if it is a region-based ID. + + During formatting, the zone is obtained using a mechanism equivalent + to querying the temporal with {@link TemporalQueries#zoneId()}. + If the zone is a {@code ZoneOffset} or it cannot be obtained then + an exception is thrown unless the section of the formatter is optional. + If the zone is not an offset, then the zone will be printed using + the zone ID from {@link ZoneId#getId()}. + + During parsing, the text must match a known zone or offset. + There are two types of zone ID, offset-based, such as '+01:30' and + region-based, such as 'Europe/London'. These are parsed differently. + If the parse starts with '+', '-', 'UT', 'UTC' or 'GMT', then the parser + expects an offset-based zone and will not match region-based zones. + The offset ID, such as '+02:30', may be at the start of the parse, + or prefixed by 'UT', 'UTC' or 'GMT'. The offset ID parsing is + equivalent to using {@link #appendOffset(String, String)} using the + arguments 'HH:MM:ss' and the no offset string '0'. + If the parse starts with 'UT', 'UTC' or 'GMT', and the parser cannot + match a following offset ID, then {@link ZoneOffset#UTC} is selected. + In all other cases, the list of known region-based zones is used to + find the longest available match. If no match is found, and the parse + starts with 'Z', then {@code ZoneOffset.UTC} is selected. + The parser uses the {@linkplain #parseCaseInsensitive() case sensitive} setting. + + For example, the following will parse: +
+   \"Europe/London\"           -- ZoneId.of(\"Europe/London\")
+   \"Z\"                       -- ZoneOffset.UTC
+   \"UT\"                      -- ZoneId.of(\"UT\")
+   \"UTC\"                     -- ZoneId.of(\"UTC\")
+   \"GMT\"                     -- ZoneId.of(\"GMT\")
+   \"+01:30\"                  -- ZoneOffset.of(\"+01:30\")
+   \"UT+01:30\"                -- ZoneOffset.of(\"+01:30\")
+   \"UTC+01:30\"               -- ZoneOffset.of(\"+01:30\")
+   \"GMT+01:30\"               -- ZoneOffset.of(\"+01:30\")
+ 
+ + Note that this method is identical to {@code appendZoneId()} except + in the mechanism used to obtain the zone. + Note also that parsing accepts offsets, whereas formatting will never + produce one. + + @return this, for chaining, not null + @see #appendZoneId()" + {:arglists (quote (["java.time.format.DateTimeFormatterBuilder"]))} + (^java.time.format.DateTimeFormatterBuilder + [^java.time.format.DateTimeFormatterBuilder this] + (.appendZoneRegionId this))) + +(defn parse-defaulting + "Appends a default value for a field to the formatter for use in parsing. + + This appends an instruction to the builder to inject a default value + into the parsed result. This is especially useful in conjunction with + optional parts of the formatter. + + For example, consider a formatter that parses the year, followed by + an optional month, with a further optional day-of-month. Using such a + formatter would require the calling code to check whether a full date, + year-month or just a year had been parsed. This method can be used to + default the month and day-of-month to a sensible value, such as the + first of the month, allowing the calling code to always get a date. + + During formatting, this method has no effect. + + During parsing, the current state of the parse is inspected. + If the specified field has no associated value, because it has not been + parsed successfully at that point, then the specified value is injected + into the parse result. Injection is immediate, thus the field-value pair + will be visible to any subsequent elements in the formatter. + As such, this method is normally called at the end of the builder. + + @param field the field to default the value of, not null + @param value the value to default the field to + @return this, for chaining, not null" + {:arglists (quote (["java.time.format.DateTimeFormatterBuilder" + "java.time.temporal.TemporalField" "long"]))} + (^java.time.format.DateTimeFormatterBuilder + [^java.time.format.DateTimeFormatterBuilder this + ^java.time.temporal.TemporalField field ^long value] + (.parseDefaulting this field value))) + +(defn append-zone-id + "Appends the time-zone ID, such as 'Europe/Paris' or '+02:00', to the formatter. + + This appends an instruction to format/parse the zone ID to the builder. + The zone ID is obtained in a strict manner suitable for {@code ZonedDateTime}. + By contrast, {@code OffsetDateTime} does not have a zone ID suitable + for use with this method, see {@link #appendZoneOrOffsetId()}. + + During formatting, the zone is obtained using a mechanism equivalent + to querying the temporal with {@link TemporalQueries#zoneId()}. + It will be printed using the result of {@link ZoneId#getId()}. + If the zone cannot be obtained then an exception is thrown unless the + section of the formatter is optional. + + During parsing, the text must match a known zone or offset. + There are two types of zone ID, offset-based, such as '+01:30' and + region-based, such as 'Europe/London'. These are parsed differently. + If the parse starts with '+', '-', 'UT', 'UTC' or 'GMT', then the parser + expects an offset-based zone and will not match region-based zones. + The offset ID, such as '+02:30', may be at the start of the parse, + or prefixed by 'UT', 'UTC' or 'GMT'. The offset ID parsing is + equivalent to using {@link #appendOffset(String, String)} using the + arguments 'HH:MM:ss' and the no offset string '0'. + If the parse starts with 'UT', 'UTC' or 'GMT', and the parser cannot + match a following offset ID, then {@link ZoneOffset#UTC} is selected. + In all other cases, the list of known region-based zones is used to + find the longest available match. If no match is found, and the parse + starts with 'Z', then {@code ZoneOffset.UTC} is selected. + The parser uses the {@linkplain #parseCaseInsensitive() case sensitive} setting. + + For example, the following will parse: +
+   \"Europe/London\"           -- ZoneId.of(\"Europe/London\")
+   \"Z\"                       -- ZoneOffset.UTC
+   \"UT\"                      -- ZoneId.of(\"UT\")
+   \"UTC\"                     -- ZoneId.of(\"UTC\")
+   \"GMT\"                     -- ZoneId.of(\"GMT\")
+   \"+01:30\"                  -- ZoneOffset.of(\"+01:30\")
+   \"UT+01:30\"                -- ZoneOffset.of(\"+01:30\")
+   \"UTC+01:30\"               -- ZoneOffset.of(\"+01:30\")
+   \"GMT+01:30\"               -- ZoneOffset.of(\"+01:30\")
+ 
+ + @return this, for chaining, not null + @see #appendZoneRegionId()" + {:arglists (quote (["java.time.format.DateTimeFormatterBuilder"]))} + (^java.time.format.DateTimeFormatterBuilder + [^java.time.format.DateTimeFormatterBuilder this] + (.appendZoneId this))) + +(defn get-localized-date-time-pattern + "Gets the formatting pattern for date and time styles for a locale and chronology. + The locale and chronology are used to lookup the locale specific format + for the requested dateStyle and/or timeStyle. + + @param dateStyle the FormatStyle for the date, null for time-only pattern + @param timeStyle the FormatStyle for the time, null for date-only pattern + @param chrono the Chronology, non-null + @param locale the locale, non-null + @return the locale and Chronology specific formatting pattern + @throws IllegalArgumentException if both dateStyle and timeStyle are null" + {:arglists (quote (["java.time.format.FormatStyle" + "java.time.format.FormatStyle" + "java.time.chrono.Chronology" "java.util.Locale"]))} + (^java.lang.String + [^java.time.format.FormatStyle date-style + ^java.time.format.FormatStyle time-style ^java.time.chrono.Chronology chrono + ^java.util.Locale locale] + (java.time.format.DateTimeFormatterBuilder/getLocalizedDateTimePattern + date-style + time-style + chrono + locale))) + +(defn parse-case-insensitive + "Changes the parse style to be case insensitive for the remainder of the formatter. + + Parsing can be case sensitive or insensitive - by default it is case sensitive. + This method allows the case sensitivity setting of parsing to be changed. + + Calling this method changes the state of the builder such that all + subsequent builder method calls will parse text in case insensitive mode. + See {@link #parseCaseSensitive()} for the opposite setting. + The parse case sensitive/insensitive methods may be called at any point + in the builder, thus the parser can swap between case parsing modes + multiple times during the parse. + + @return this, for chaining, not null" + {:arglists (quote (["java.time.format.DateTimeFormatterBuilder"]))} + (^java.time.format.DateTimeFormatterBuilder + [^java.time.format.DateTimeFormatterBuilder this] + (.parseCaseInsensitive this))) + +(defn append-localized-offset + "Appends the localized zone offset, such as 'GMT+01:00', to the formatter. + + This appends a localized zone offset to the builder, the format of the + localized offset is controlled by the specified {@link FormatStyle style} + to this method: + + + During formatting, the offset is obtained using a mechanism equivalent + to querying the temporal with {@link TemporalQueries#offset()}. + If the offset cannot be obtained then an exception is thrown unless the + section of the formatter is optional. + + During parsing, the offset is parsed using the format defined above. + If the offset cannot be parsed then an exception is thrown unless the + section of the formatter is optional. + + @param style the format style to use, not null + @return this, for chaining, not null + @throws IllegalArgumentException if style is neither {@link TextStyle#FULL + full} nor {@link TextStyle#SHORT short}" + {:arglists (quote (["java.time.format.DateTimeFormatterBuilder" + "java.time.format.TextStyle"]))} + (^java.time.format.DateTimeFormatterBuilder + [^java.time.format.DateTimeFormatterBuilder this + ^java.time.format.TextStyle style] + (.appendLocalizedOffset this style))) + +(defn append + "Appends all the elements of a formatter to the builder. + + This method has the same effect as appending each of the constituent + parts of the formatter directly to this builder. + + @param formatter the formatter to add, not null + @return this, for chaining, not null" + {:arglists (quote (["java.time.format.DateTimeFormatterBuilder" + "java.time.format.DateTimeFormatter"]))} + (^java.time.format.DateTimeFormatterBuilder + [^java.time.format.DateTimeFormatterBuilder this + ^java.time.format.DateTimeFormatter formatter] + (.append this formatter))) + +(defn append-text + {:arglists (quote (["java.time.format.DateTimeFormatterBuilder" + "java.time.temporal.TemporalField"] + ["java.time.format.DateTimeFormatterBuilder" + "java.time.temporal.TemporalField" + "java.time.format.TextStyle"] + ["java.time.format.DateTimeFormatterBuilder" + "java.time.temporal.TemporalField" "java.util.Map"]))} + (^java.time.format.DateTimeFormatterBuilder + [^java.time.format.DateTimeFormatterBuilder this + ^java.time.temporal.TemporalField field] + (.appendText this field)) + (^java.time.format.DateTimeFormatterBuilder + [^java.time.format.DateTimeFormatterBuilder this arg0 arg1] + (cond (and (instance? java.time.temporal.TemporalField arg0) + (instance? java.time.format.TextStyle arg1)) + (let [^java.time.temporal.TemporalField field arg0 + ^java.time.format.TextStyle text-style arg1] + (.appendText this field text-style)) + (and (instance? java.time.temporal.TemporalField arg0) + (instance? java.util.Map arg1)) + (let [^java.time.temporal.TemporalField field arg0 + ^java.util.Map text-lookup arg1] + (.appendText this field text-lookup)) + :else (throw (java.lang.IllegalArgumentException. + "no corresponding java.time method with these args"))))) + +(defn append-localized + "Appends a localized date-time pattern to the formatter. + + This appends a localized section to the builder, suitable for outputting + a date, time or date-time combination. The format of the localized + section is lazily looked up based on four items: + + During formatting, the chronology is obtained from the temporal object + being formatted, which may have been overridden by + {@link DateTimeFormatter#withChronology(Chronology)}. + + During parsing, if a chronology has already been parsed, then it is used. + Otherwise the default from {@code DateTimeFormatter.withChronology(Chronology)} + is used, with {@code IsoChronology} as the fallback. + + Note that this method provides similar functionality to methods on + {@code DateFormat} such as {@link java.text.DateFormat#getDateTimeInstance(int, int)}. + + @param dateStyle the date style to use, null means no date required + @param timeStyle the time style to use, null means no time required + @return this, for chaining, not null + @throws IllegalArgumentException if both the date and time styles are null" + {:arglists (quote (["java.time.format.DateTimeFormatterBuilder" + "java.time.format.FormatStyle" + "java.time.format.FormatStyle"]))} + (^java.time.format.DateTimeFormatterBuilder + [^java.time.format.DateTimeFormatterBuilder this + ^java.time.format.FormatStyle date-style + ^java.time.format.FormatStyle time-style] + (.appendLocalized this date-style time-style))) + +(defn append-offset + "Appends the zone offset, such as '+01:00', to the formatter. + + This appends an instruction to format/parse the offset ID to the builder. + + During formatting, the offset is obtained using a mechanism equivalent + to querying the temporal with {@link TemporalQueries#offset()}. + It will be printed using the format defined below. + If the offset cannot be obtained then an exception is thrown unless the + section of the formatter is optional. + + During parsing, the offset is parsed using the format defined below. + If the offset cannot be parsed then an exception is thrown unless the + section of the formatter is optional. + + The format of the offset is controlled by a pattern which must be one + of the following: + + The \"no offset\" text controls what text is printed when the total amount of + the offset fields to be output is zero. + Example values would be 'Z', '+00:00', 'UTC' or 'GMT'. + Three formats are accepted for parsing UTC - the \"no offset\" text, and the + plus and minus versions of zero defined by the pattern. + + @param pattern the pattern to use, not null + @param noOffsetText the text to use when the offset is zero, not null + @return this, for chaining, not null" + {:arglists (quote (["java.time.format.DateTimeFormatterBuilder" + "java.lang.String" "java.lang.String"]))} + (^java.time.format.DateTimeFormatterBuilder + [^java.time.format.DateTimeFormatterBuilder this ^java.lang.String pattern + ^java.lang.String no-offset-text] + (.appendOffset this pattern no-offset-text))) + +(defn append-value-reduced + {:arglists (quote (["java.time.format.DateTimeFormatterBuilder" + "java.time.temporal.TemporalField" "int" "int" "int"] + ["java.time.format.DateTimeFormatterBuilder" + "java.time.temporal.TemporalField" "int" "int" + "java.time.chrono.ChronoLocalDate"]))} + (^java.time.format.DateTimeFormatterBuilder + [^java.time.format.DateTimeFormatterBuilder this arg0 arg1 arg2 arg3] + (cond (and (instance? java.time.temporal.TemporalField arg0) + (instance? java.lang.Number arg1) + (instance? java.lang.Number arg2) + (instance? java.lang.Number arg3)) + (let [^java.time.temporal.TemporalField field arg0 + width (int arg1) + max-width (int arg2) + base-value (int arg3)] + (.appendValueReduced this field width max-width base-value)) + (and (instance? java.time.temporal.TemporalField arg0) + (instance? java.lang.Number arg1) + (instance? java.lang.Number arg2) + (instance? java.time.chrono.ChronoLocalDate arg3)) + (let [^java.time.temporal.TemporalField field arg0 + width (int arg1) + max-width (int arg2) + ^java.time.chrono.ChronoLocalDate base-date arg3] + (.appendValueReduced this field width max-width base-date)) + :else (throw (java.lang.IllegalArgumentException. + "no corresponding java.time method with these args"))))) + +(defn append-zone-text + {:arglists (quote (["java.time.format.DateTimeFormatterBuilder" + "java.time.format.TextStyle"] + ["java.time.format.DateTimeFormatterBuilder" + "java.time.format.TextStyle" "java.util.Set"]))} + (^java.time.format.DateTimeFormatterBuilder + [^java.time.format.DateTimeFormatterBuilder this + ^java.time.format.TextStyle text-style] + (.appendZoneText this text-style)) + (^java.time.format.DateTimeFormatterBuilder + [^java.time.format.DateTimeFormatterBuilder this + ^java.time.format.TextStyle text-style ^java.util.Set preferred-zones] + (.appendZoneText this text-style preferred-zones))) diff --git a/src/cljc/java_time/format/date_time_formatter_builder.cljs b/src/cljc/java_time/format/date_time_formatter_builder.cljs index 5a3bce4..7765b6b 100644 --- a/src/cljc/java_time/format/date_time_formatter_builder.cljs +++ b/src/cljc/java_time/format/date_time_formatter_builder.cljs @@ -1,31 +1,918 @@ -(ns cljc.java-time.format.date-time-formatter-builder (:refer-clojure :exclude [abs get range format min max next name resolve short]) (:require [cljc.java-time.extn.calendar-awareness] [goog.object] [java.time.format :refer [DateTimeFormatterBuilder]])) -^{:line 83, :column 11} (clojure.core/defn new {:arglists ^{:line 83, :column 45} (quote ^{:line 83, :column 52} ([]))} ^{:line 84, :column 13} (^java.time.format.DateTimeFormatterBuilder [] ^{:line 84, :column 60} (java.time.format.DateTimeFormatterBuilder.))) -(clojure.core/defn to-formatter {:arglists (quote (["java.time.format.DateTimeFormatterBuilder"] ["java.time.format.DateTimeFormatterBuilder" "java.util.Locale"]))} (^js/JSJoda.DateTimeFormatter [^js/JSJoda.DateTimeFormatterBuilder this16043] (.toFormatter this16043)) (^js/JSJoda.DateTimeFormatter [^js/JSJoda.DateTimeFormatterBuilder this16044 ^java.util.Locale java-util-Locale16045] (.toFormatter this16044 java-util-Locale16045))) -(clojure.core/defn append-pattern {:arglists (quote (["java.time.format.DateTimeFormatterBuilder" "java.lang.String"]))} (^js/JSJoda.DateTimeFormatterBuilder [^js/JSJoda.DateTimeFormatterBuilder this16046 ^java.lang.String java-lang-String16047] (.appendPattern this16046 java-lang-String16047))) -(clojure.core/defn append-value {:arglists (quote (["java.time.format.DateTimeFormatterBuilder" "java.time.temporal.TemporalField" "int"] ["java.time.format.DateTimeFormatterBuilder" "java.time.temporal.TemporalField" "int" "int" "java.time.format.SignStyle"] ["java.time.format.DateTimeFormatterBuilder" "java.time.temporal.TemporalField"]))} (^js/JSJoda.DateTimeFormatterBuilder [^js/JSJoda.DateTimeFormatterBuilder this16048 ^js/JSJoda.TemporalField java-time-temporal-TemporalField16049 ^int int16050] (.appendValue this16048 java-time-temporal-TemporalField16049 int16050)) (^js/JSJoda.DateTimeFormatterBuilder [^js/JSJoda.DateTimeFormatterBuilder this16051 ^js/JSJoda.TemporalField java-time-temporal-TemporalField16052 ^int int16053 ^int int16054 ^js/JSJoda.SignStyle java-time-format-SignStyle16055] (.appendValue this16051 java-time-temporal-TemporalField16052 int16053 int16054 java-time-format-SignStyle16055)) (^js/JSJoda.DateTimeFormatterBuilder [^js/JSJoda.DateTimeFormatterBuilder this16056 ^js/JSJoda.TemporalField java-time-temporal-TemporalField16057] (.appendValue this16056 java-time-temporal-TemporalField16057))) -(clojure.core/defn append-instant {:arglists (quote (["java.time.format.DateTimeFormatterBuilder"] ["java.time.format.DateTimeFormatterBuilder" "int"]))} (^js/JSJoda.DateTimeFormatterBuilder [^js/JSJoda.DateTimeFormatterBuilder this16058] (.appendInstant this16058)) (^js/JSJoda.DateTimeFormatterBuilder [^js/JSJoda.DateTimeFormatterBuilder this16059 ^int int16060] (.appendInstant this16059 int16060))) -(clojure.core/defn append-literal {:arglists (quote (["java.time.format.DateTimeFormatterBuilder" "char"] ["java.time.format.DateTimeFormatterBuilder" "java.lang.String"]))} (^js/JSJoda.DateTimeFormatterBuilder [this16061 G__16062] (.appendLiteral ^js/JSJoda.DateTimeFormatterBuilder this16061 G__16062))) -(clojure.core/defn optional-start {:arglists (quote (["java.time.format.DateTimeFormatterBuilder"]))} (^js/JSJoda.DateTimeFormatterBuilder [^js/JSJoda.DateTimeFormatterBuilder this16063] (.optionalStart this16063))) -(clojure.core/defn append-fraction {:arglists (quote (["java.time.format.DateTimeFormatterBuilder" "java.time.temporal.TemporalField" "int" "int" "boolean"]))} (^js/JSJoda.DateTimeFormatterBuilder [^js/JSJoda.DateTimeFormatterBuilder this16064 ^js/JSJoda.TemporalField java-time-temporal-TemporalField16065 ^int int16066 ^int int16067 ^boolean boolean16068] (.appendFraction this16064 java-time-temporal-TemporalField16065 int16066 int16067 boolean16068))) -(clojure.core/defn append-optional {:arglists (quote (["java.time.format.DateTimeFormatterBuilder" "java.time.format.DateTimeFormatter"]))} (^js/JSJoda.DateTimeFormatterBuilder [^js/JSJoda.DateTimeFormatterBuilder this16069 ^js/JSJoda.DateTimeFormatter java-time-format-DateTimeFormatter16070] (.appendOptional this16069 java-time-format-DateTimeFormatter16070))) -(clojure.core/defn optional-end {:arglists (quote (["java.time.format.DateTimeFormatterBuilder"]))} (^js/JSJoda.DateTimeFormatterBuilder [^js/JSJoda.DateTimeFormatterBuilder this16071] (.optionalEnd this16071))) -(clojure.core/defn parse-lenient {:arglists (quote (["java.time.format.DateTimeFormatterBuilder"]))} (^js/JSJoda.DateTimeFormatterBuilder [^js/JSJoda.DateTimeFormatterBuilder this16072] (.parseLenient this16072))) -(clojure.core/defn pad-next {:arglists (quote (["java.time.format.DateTimeFormatterBuilder" "int"] ["java.time.format.DateTimeFormatterBuilder" "int" "char"]))} (^js/JSJoda.DateTimeFormatterBuilder [^js/JSJoda.DateTimeFormatterBuilder this16073 ^int int16074] (.padNext this16073 int16074)) (^js/JSJoda.DateTimeFormatterBuilder [^js/JSJoda.DateTimeFormatterBuilder this16075 ^int int16076 ^char char16077] (.padNext this16075 int16076 char16077))) -(clojure.core/defn append-chronology-id {:arglists (quote (["java.time.format.DateTimeFormatterBuilder"]))} (^js/JSJoda.DateTimeFormatterBuilder [^js/JSJoda.DateTimeFormatterBuilder this16078] (.appendChronologyId this16078))) -(clojure.core/defn append-zone-or-offset-id {:arglists (quote (["java.time.format.DateTimeFormatterBuilder"]))} (^js/JSJoda.DateTimeFormatterBuilder [^js/JSJoda.DateTimeFormatterBuilder this16079] (.appendZoneOrOffsetId this16079))) -(clojure.core/defn parse-case-sensitive {:arglists (quote (["java.time.format.DateTimeFormatterBuilder"]))} (^js/JSJoda.DateTimeFormatterBuilder [^js/JSJoda.DateTimeFormatterBuilder this16080] (.parseCaseSensitive this16080))) -(clojure.core/defn parse-strict {:arglists (quote (["java.time.format.DateTimeFormatterBuilder"]))} (^js/JSJoda.DateTimeFormatterBuilder [^js/JSJoda.DateTimeFormatterBuilder this16081] (.parseStrict this16081))) -(clojure.core/defn append-chronology-text {:arglists (quote (["java.time.format.DateTimeFormatterBuilder" "java.time.format.TextStyle"]))} (^js/JSJoda.DateTimeFormatterBuilder [^js/JSJoda.DateTimeFormatterBuilder this16082 ^js/JSJoda.TextStyle java-time-format-TextStyle16083] (.appendChronologyText this16082 java-time-format-TextStyle16083))) -(clojure.core/defn append-offset-id {:arglists (quote (["java.time.format.DateTimeFormatterBuilder"]))} (^js/JSJoda.DateTimeFormatterBuilder [^js/JSJoda.DateTimeFormatterBuilder this16084] (.appendOffsetId this16084))) -(clojure.core/defn append-zone-region-id {:arglists (quote (["java.time.format.DateTimeFormatterBuilder"]))} (^js/JSJoda.DateTimeFormatterBuilder [^js/JSJoda.DateTimeFormatterBuilder this16085] (.appendZoneRegionId this16085))) -(clojure.core/defn parse-defaulting {:arglists (quote (["java.time.format.DateTimeFormatterBuilder" "java.time.temporal.TemporalField" "long"]))} (^js/JSJoda.DateTimeFormatterBuilder [^js/JSJoda.DateTimeFormatterBuilder this16086 ^js/JSJoda.TemporalField java-time-temporal-TemporalField16087 ^long long16088] (.parseDefaulting this16086 java-time-temporal-TemporalField16087 long16088))) -(clojure.core/defn append-zone-id {:arglists (quote (["java.time.format.DateTimeFormatterBuilder"]))} (^js/JSJoda.DateTimeFormatterBuilder [^js/JSJoda.DateTimeFormatterBuilder this16089] (.appendZoneId this16089))) -(clojure.core/defn get-localized-date-time-pattern {:arglists (quote (["java.time.format.FormatStyle" "java.time.format.FormatStyle" "java.time.chrono.Chronology" "java.util.Locale"]))} (^java.lang.String [^js/JSJoda.FormatStyle java-time-format-FormatStyle16090 ^js/JSJoda.FormatStyle java-time-format-FormatStyle16091 ^js/JSJoda.Chronology java-time-chrono-Chronology16092 ^java.util.Locale java-util-Locale16093] (js-invoke java.time.format.DateTimeFormatterBuilder "getLocalizedDateTimePattern" java-time-format-FormatStyle16090 java-time-format-FormatStyle16091 java-time-chrono-Chronology16092 java-util-Locale16093))) -(clojure.core/defn parse-case-insensitive {:arglists (quote (["java.time.format.DateTimeFormatterBuilder"]))} (^js/JSJoda.DateTimeFormatterBuilder [^js/JSJoda.DateTimeFormatterBuilder this16094] (.parseCaseInsensitive this16094))) -(clojure.core/defn append-localized-offset {:arglists (quote (["java.time.format.DateTimeFormatterBuilder" "java.time.format.TextStyle"]))} (^js/JSJoda.DateTimeFormatterBuilder [^js/JSJoda.DateTimeFormatterBuilder this16095 ^js/JSJoda.TextStyle java-time-format-TextStyle16096] (.appendLocalizedOffset this16095 java-time-format-TextStyle16096))) -(clojure.core/defn append {:arglists (quote (["java.time.format.DateTimeFormatterBuilder" "java.time.format.DateTimeFormatter"]))} (^js/JSJoda.DateTimeFormatterBuilder [^js/JSJoda.DateTimeFormatterBuilder this16097 ^js/JSJoda.DateTimeFormatter java-time-format-DateTimeFormatter16098] (.append this16097 java-time-format-DateTimeFormatter16098))) -(clojure.core/defn append-text {:arglists (quote (["java.time.format.DateTimeFormatterBuilder" "java.time.temporal.TemporalField" "java.time.format.TextStyle"] ["java.time.format.DateTimeFormatterBuilder" "java.time.temporal.TemporalField"] ["java.time.format.DateTimeFormatterBuilder" "java.time.temporal.TemporalField" "java.util.Map"]))} (^js/JSJoda.DateTimeFormatterBuilder [this16099 G__16100 G__16101] (.appendText ^js/JSJoda.DateTimeFormatterBuilder this16099 G__16100 G__16101)) (^js/JSJoda.DateTimeFormatterBuilder [^js/JSJoda.DateTimeFormatterBuilder this16102 ^js/JSJoda.TemporalField java-time-temporal-TemporalField16103] (.appendText this16102 java-time-temporal-TemporalField16103))) -(clojure.core/defn append-localized {:arglists (quote (["java.time.format.DateTimeFormatterBuilder" "java.time.format.FormatStyle" "java.time.format.FormatStyle"]))} (^js/JSJoda.DateTimeFormatterBuilder [^js/JSJoda.DateTimeFormatterBuilder this16104 ^js/JSJoda.FormatStyle java-time-format-FormatStyle16105 ^js/JSJoda.FormatStyle java-time-format-FormatStyle16106] (.appendLocalized this16104 java-time-format-FormatStyle16105 java-time-format-FormatStyle16106))) -(clojure.core/defn append-offset {:arglists (quote (["java.time.format.DateTimeFormatterBuilder" "java.lang.String" "java.lang.String"]))} (^js/JSJoda.DateTimeFormatterBuilder [^js/JSJoda.DateTimeFormatterBuilder this16107 ^java.lang.String java-lang-String16108 ^java.lang.String java-lang-String16109] (.appendOffset this16107 java-lang-String16108 java-lang-String16109))) -(clojure.core/defn append-value-reduced {:arglists (quote (["java.time.format.DateTimeFormatterBuilder" "java.time.temporal.TemporalField" "int" "int" "int"] ["java.time.format.DateTimeFormatterBuilder" "java.time.temporal.TemporalField" "int" "int" "java.time.chrono.ChronoLocalDate"]))} (^js/JSJoda.DateTimeFormatterBuilder [this16110 G__16111 G__16112 G__16113 G__16114] (.appendValueReduced ^js/JSJoda.DateTimeFormatterBuilder this16110 G__16111 G__16112 G__16113 G__16114))) -(clojure.core/defn append-zone-text {:arglists (quote (["java.time.format.DateTimeFormatterBuilder" "java.time.format.TextStyle"] ["java.time.format.DateTimeFormatterBuilder" "java.time.format.TextStyle" "java.util.Set"]))} (^js/JSJoda.DateTimeFormatterBuilder [^js/JSJoda.DateTimeFormatterBuilder this16115 ^js/JSJoda.TextStyle java-time-format-TextStyle16116] (.appendZoneText this16115 java-time-format-TextStyle16116)) (^js/JSJoda.DateTimeFormatterBuilder [^js/JSJoda.DateTimeFormatterBuilder this16117 ^js/JSJoda.TextStyle java-time-format-TextStyle16118 ^java.util.Set java-util-Set16119] (.appendZoneText this16117 java-time-format-TextStyle16118 java-util-Set16119))) +(ns cljc.java-time.format.date-time-formatter-builder + (:refer-clojure :exclude + [abs get range format min max next name resolve short]) + (:require [cljc.java-time.extn.calendar-awareness] + [goog.object] + [java.time.format :refer [DateTimeFormatterBuilder]])) + +(defn new + {:arglists (quote ([]))} + (^java.time.format.DateTimeFormatterBuilder [] + (java.time.format.DateTimeFormatterBuilder.))) + +(defn to-formatter + {:arglists (quote (["java.time.format.DateTimeFormatterBuilder"] + ["java.time.format.DateTimeFormatterBuilder" + "java.util.Locale"]))} + (^js/JSJoda.DateTimeFormatter [^js/JSJoda.DateTimeFormatterBuilder this] + (.toFormatter this)) + (^js/JSJoda.DateTimeFormatter + [^js/JSJoda.DateTimeFormatterBuilder this ^java.util.Locale locale] + (.toFormatter this locale))) + +(defn append-pattern + "Appends the elements defined by the specified pattern to the builder. + + All letters 'A' to 'Z' and 'a' to 'z' are reserved as pattern letters. + The characters '#', '{' and '}' are reserved for future use. + The characters '[' and ']' indicate optional patterns. + The following pattern letters are defined: +
+  Symbol  Meaning                     Presentation      Examples
+  ------  -------                     ------------      -------
+   G       era                         text              AD; Anno Domini; A
+   u       year                        year              2004; 04
+   y       year-of-era                 year              2004; 04
+   D       day-of-year                 number            189
+   M/L     month-of-year               number/text       7; 07; Jul; July; J
+   d       day-of-month                number            10
+
+   Q/q     quarter-of-year             number/text       3; 03; Q3; 3rd quarter
+   Y       week-based-year             year              1996; 96
+   w       week-of-week-based-year     number            27
+   W       week-of-month               number            4
+   E       day-of-week                 text              Tue; Tuesday; T
+   e/c     localized day-of-week       number/text       2; 02; Tue; Tuesday; T
+   F       week-of-month               number            3
+
+   a       am-pm-of-day                text              PM
+   h       clock-hour-of-am-pm (1-12)  number            12
+   K       hour-of-am-pm (0-11)        number            0
+   k       clock-hour-of-am-pm (1-24)  number            0
+
+   H       hour-of-day (0-23)          number            0
+   m       minute-of-hour              number            30
+   s       second-of-minute            number            55
+   S       fraction-of-second          fraction          978
+   A       milli-of-day                number            1234
+   n       nano-of-second              number            987654321
+   N       nano-of-day                 number            1234000000
+
+   V       time-zone ID                zone-id           America/Los_Angeles; Z; -08:30
+   z       time-zone name              zone-name         Pacific Standard Time; PST
+   O       localized zone-offset       offset-O          GMT+8; GMT+08:00; UTC-08:00;
+   X       zone-offset 'Z' for zero    offset-X          Z; -08; -0830; -08:30; -083015; -08:30:15;
+   x       zone-offset                 offset-x          +0000; -08; -0830; -08:30; -083015; -08:30:15;
+   Z       zone-offset                 offset-Z          +0000; -0800; -08:00;
+
+   p       pad next                    pad modifier      1
+
+   '       escape for text             delimiter
+   ''      single quote                literal           '
+   [       optional section start
+   ]       optional section end
+   #       reserved for future use
+   {       reserved for future use
+   }       reserved for future use
+ 
+ + The count of pattern letters determine the format. + See DateTimeFormatter for a user-focused description of the patterns. + The following tables define how the pattern letters map to the builder. + + Date fields: Pattern letters to output a date. +
+  Pattern  Count  Equivalent builder methods
+  -------  -----  --------------------------
+    G       1      appendText(ChronoField.ERA, TextStyle.SHORT)
+    GG      2      appendText(ChronoField.ERA, TextStyle.SHORT)
+    GGG     3      appendText(ChronoField.ERA, TextStyle.SHORT)
+    GGGG    4      appendText(ChronoField.ERA, TextStyle.FULL)
+    GGGGG   5      appendText(ChronoField.ERA, TextStyle.NARROW)
+
+    u       1      appendValue(ChronoField.YEAR, 1, 19, SignStyle.NORMAL);
+    uu      2      appendValueReduced(ChronoField.YEAR, 2, 2000);
+    uuu     3      appendValue(ChronoField.YEAR, 3, 19, SignStyle.NORMAL);
+    u..u    4..n   appendValue(ChronoField.YEAR, n, 19, SignStyle.EXCEEDS_PAD);
+    y       1      appendValue(ChronoField.YEAR_OF_ERA, 1, 19, SignStyle.NORMAL);
+    yy      2      appendValueReduced(ChronoField.YEAR_OF_ERA, 2, 2000);
+    yyy     3      appendValue(ChronoField.YEAR_OF_ERA, 3, 19, SignStyle.NORMAL);
+    y..y    4..n   appendValue(ChronoField.YEAR_OF_ERA, n, 19, SignStyle.EXCEEDS_PAD);
+    Y       1      append special localized WeekFields element for numeric week-based-year
+    YY      2      append special localized WeekFields element for reduced numeric week-based-year 2 digits;
+    YYY     3      append special localized WeekFields element for numeric week-based-year (3, 19, SignStyle.NORMAL);
+    Y..Y    4..n   append special localized WeekFields element for numeric week-based-year (n, 19, SignStyle.EXCEEDS_PAD);
+
+    Q       1      appendValue(IsoFields.QUARTER_OF_YEAR);
+    QQ      2      appendValue(IsoFields.QUARTER_OF_YEAR, 2);
+    QQQ     3      appendText(IsoFields.QUARTER_OF_YEAR, TextStyle.SHORT)
+    QQQQ    4      appendText(IsoFields.QUARTER_OF_YEAR, TextStyle.FULL)
+    QQQQQ   5      appendText(IsoFields.QUARTER_OF_YEAR, TextStyle.NARROW)
+    q       1      appendValue(IsoFields.QUARTER_OF_YEAR);
+    qq      2      appendValue(IsoFields.QUARTER_OF_YEAR, 2);
+    qqq     3      appendText(IsoFields.QUARTER_OF_YEAR, TextStyle.SHORT_STANDALONE)
+    qqqq    4      appendText(IsoFields.QUARTER_OF_YEAR, TextStyle.FULL_STANDALONE)
+    qqqqq   5      appendText(IsoFields.QUARTER_OF_YEAR, TextStyle.NARROW_STANDALONE)
+
+    M       1      appendValue(ChronoField.MONTH_OF_YEAR);
+    MM      2      appendValue(ChronoField.MONTH_OF_YEAR, 2);
+    MMM     3      appendText(ChronoField.MONTH_OF_YEAR, TextStyle.SHORT)
+    MMMM    4      appendText(ChronoField.MONTH_OF_YEAR, TextStyle.FULL)
+    MMMMM   5      appendText(ChronoField.MONTH_OF_YEAR, TextStyle.NARROW)
+    L       1      appendValue(ChronoField.MONTH_OF_YEAR);
+    LL      2      appendValue(ChronoField.MONTH_OF_YEAR, 2);
+    LLL     3      appendText(ChronoField.MONTH_OF_YEAR, TextStyle.SHORT_STANDALONE)
+    LLLL    4      appendText(ChronoField.MONTH_OF_YEAR, TextStyle.FULL_STANDALONE)
+    LLLLL   5      appendText(ChronoField.MONTH_OF_YEAR, TextStyle.NARROW_STANDALONE)
+
+    w       1      append special localized WeekFields element for numeric week-of-year
+    ww      2      append special localized WeekFields element for numeric week-of-year, zero-padded
+    W       1      append special localized WeekFields element for numeric week-of-month
+    d       1      appendValue(ChronoField.DAY_OF_MONTH)
+    dd      2      appendValue(ChronoField.DAY_OF_MONTH, 2)
+    D       1      appendValue(ChronoField.DAY_OF_YEAR)
+    DD      2      appendValue(ChronoField.DAY_OF_YEAR, 2)
+    DDD     3      appendValue(ChronoField.DAY_OF_YEAR, 3)
+    F       1      appendValue(ChronoField.ALIGNED_DAY_OF_WEEK_IN_MONTH)
+    E       1      appendText(ChronoField.DAY_OF_WEEK, TextStyle.SHORT)
+    EE      2      appendText(ChronoField.DAY_OF_WEEK, TextStyle.SHORT)
+    EEE     3      appendText(ChronoField.DAY_OF_WEEK, TextStyle.SHORT)
+    EEEE    4      appendText(ChronoField.DAY_OF_WEEK, TextStyle.FULL)
+    EEEEE   5      appendText(ChronoField.DAY_OF_WEEK, TextStyle.NARROW)
+    e       1      append special localized WeekFields element for numeric day-of-week
+    ee      2      append special localized WeekFields element for numeric day-of-week, zero-padded
+    eee     3      appendText(ChronoField.DAY_OF_WEEK, TextStyle.SHORT)
+    eeee    4      appendText(ChronoField.DAY_OF_WEEK, TextStyle.FULL)
+    eeeee   5      appendText(ChronoField.DAY_OF_WEEK, TextStyle.NARROW)
+    c       1      append special localized WeekFields element for numeric day-of-week
+    ccc     3      appendText(ChronoField.DAY_OF_WEEK, TextStyle.SHORT_STANDALONE)
+    cccc    4      appendText(ChronoField.DAY_OF_WEEK, TextStyle.FULL_STANDALONE)
+    ccccc   5      appendText(ChronoField.DAY_OF_WEEK, TextStyle.NARROW_STANDALONE)
+ 
+ + Time fields: Pattern letters to output a time. +
+  Pattern  Count  Equivalent builder methods
+  -------  -----  --------------------------
+    a       1      appendText(ChronoField.AMPM_OF_DAY, TextStyle.SHORT)
+    h       1      appendValue(ChronoField.CLOCK_HOUR_OF_AMPM)
+    hh      2      appendValue(ChronoField.CLOCK_HOUR_OF_AMPM, 2)
+    H       1      appendValue(ChronoField.HOUR_OF_DAY)
+    HH      2      appendValue(ChronoField.HOUR_OF_DAY, 2)
+    k       1      appendValue(ChronoField.CLOCK_HOUR_OF_DAY)
+    kk      2      appendValue(ChronoField.CLOCK_HOUR_OF_DAY, 2)
+    K       1      appendValue(ChronoField.HOUR_OF_AMPM)
+    KK      2      appendValue(ChronoField.HOUR_OF_AMPM, 2)
+    m       1      appendValue(ChronoField.MINUTE_OF_HOUR)
+    mm      2      appendValue(ChronoField.MINUTE_OF_HOUR, 2)
+    s       1      appendValue(ChronoField.SECOND_OF_MINUTE)
+    ss      2      appendValue(ChronoField.SECOND_OF_MINUTE, 2)
+
+    S..S    1..n   appendFraction(ChronoField.NANO_OF_SECOND, n, n, false)
+    A       1      appendValue(ChronoField.MILLI_OF_DAY)
+    A..A    2..n   appendValue(ChronoField.MILLI_OF_DAY, n)
+    n       1      appendValue(ChronoField.NANO_OF_SECOND)
+    n..n    2..n   appendValue(ChronoField.NANO_OF_SECOND, n)
+    N       1      appendValue(ChronoField.NANO_OF_DAY)
+    N..N    2..n   appendValue(ChronoField.NANO_OF_DAY, n)
+ 
+ + Zone ID: Pattern letters to output {@code ZoneId}. +
+  Pattern  Count  Equivalent builder methods
+  -------  -----  --------------------------
+    VV      2      appendZoneId()
+    z       1      appendZoneText(TextStyle.SHORT)
+    zz      2      appendZoneText(TextStyle.SHORT)
+    zzz     3      appendZoneText(TextStyle.SHORT)
+    zzzz    4      appendZoneText(TextStyle.FULL)
+ 
+ + Zone offset: Pattern letters to output {@code ZoneOffset}. +
+  Pattern  Count  Equivalent builder methods
+  -------  -----  --------------------------
+    O       1      appendLocalizedOffsetPrefixed(TextStyle.SHORT);
+    OOOO    4      appendLocalizedOffsetPrefixed(TextStyle.FULL);
+    X       1      appendOffset(\"+HHmm\",\"Z\")
+    XX      2      appendOffset(\"+HHMM\",\"Z\")
+    XXX     3      appendOffset(\"+HH:MM\",\"Z\")
+    XXXX    4      appendOffset(\"+HHMMss\",\"Z\")
+    XXXXX   5      appendOffset(\"+HH:MM:ss\",\"Z\")
+    x       1      appendOffset(\"+HHmm\",\"+00\")
+    xx      2      appendOffset(\"+HHMM\",\"+0000\")
+    xxx     3      appendOffset(\"+HH:MM\",\"+00:00\")
+    xxxx    4      appendOffset(\"+HHMMss\",\"+0000\")
+    xxxxx   5      appendOffset(\"+HH:MM:ss\",\"+00:00\")
+    Z       1      appendOffset(\"+HHMM\",\"+0000\")
+    ZZ      2      appendOffset(\"+HHMM\",\"+0000\")
+    ZZZ     3      appendOffset(\"+HHMM\",\"+0000\")
+    ZZZZ    4      appendLocalizedOffset(TextStyle.FULL);
+    ZZZZZ   5      appendOffset(\"+HH:MM:ss\",\"Z\")
+ 
+ + Modifiers: Pattern letters that modify the rest of the pattern: +
+  Pattern  Count  Equivalent builder methods
+  -------  -----  --------------------------
+    [       1      optionalStart()
+    ]       1      optionalEnd()
+    p..p    1..n   padNext(n)
+ 
+ + Any sequence of letters not specified above, unrecognized letter or + reserved character will throw an exception. + Future versions may add to the set of patterns. + It is recommended to use single quotes around all characters that you want + to output directly to ensure that future changes do not break your application. + + Note that the pattern string is similar, but not identical, to + {@link java.text.SimpleDateFormat SimpleDateFormat}. + The pattern string is also similar, but not identical, to that defined by the + Unicode Common Locale Data Repository (CLDR/LDML). + Pattern letters 'X' and 'u' are aligned with Unicode CLDR/LDML. + By contrast, {@code SimpleDateFormat} uses 'u' for the numeric day of week. + Pattern letters 'y' and 'Y' parse years of two digits and more than 4 digits differently. + Pattern letters 'n', 'A', 'N', and 'p' are added. + Number types will reject large numbers. + + @param pattern the pattern to add, not null + @return this, for chaining, not null + @throws IllegalArgumentException if the pattern is invalid" + {:arglists (quote (["java.time.format.DateTimeFormatterBuilder" + "java.lang.String"]))} + (^js/JSJoda.DateTimeFormatterBuilder + [^js/JSJoda.DateTimeFormatterBuilder this ^java.lang.String pattern] + (.appendPattern this pattern))) + +(defn append-value + {:arglists (quote (["java.time.format.DateTimeFormatterBuilder" + "java.time.temporal.TemporalField"] + ["java.time.format.DateTimeFormatterBuilder" + "java.time.temporal.TemporalField" "int"] + ["java.time.format.DateTimeFormatterBuilder" + "java.time.temporal.TemporalField" "int" "int" + "java.time.format.SignStyle"]))} + (^js/JSJoda.DateTimeFormatterBuilder + [^js/JSJoda.DateTimeFormatterBuilder this ^js/JSJoda.TemporalField field] + (.appendValue this field)) + (^js/JSJoda.DateTimeFormatterBuilder + [^js/JSJoda.DateTimeFormatterBuilder this ^js/JSJoda.TemporalField field + ^int width] + (.appendValue this field width)) + (^js/JSJoda.DateTimeFormatterBuilder + [^js/JSJoda.DateTimeFormatterBuilder this ^js/JSJoda.TemporalField field + ^int min-width ^int max-width ^js/JSJoda.SignStyle sign-style] + (.appendValue this field min-width max-width sign-style))) + +(defn append-instant + {:arglists (quote (["java.time.format.DateTimeFormatterBuilder"] + ["java.time.format.DateTimeFormatterBuilder" "int"]))} + (^js/JSJoda.DateTimeFormatterBuilder + [^js/JSJoda.DateTimeFormatterBuilder this] + (.appendInstant this)) + (^js/JSJoda.DateTimeFormatterBuilder + [^js/JSJoda.DateTimeFormatterBuilder this ^int fractional-digits] + (.appendInstant this fractional-digits))) + +(defn append-literal + {:arglists (quote (["java.time.format.DateTimeFormatterBuilder" "char"] + ["java.time.format.DateTimeFormatterBuilder" + "java.lang.String"]))} + (^js/JSJoda.DateTimeFormatterBuilder + [^js/JSJoda.DateTimeFormatterBuilder this arg0] + (.appendLiteral ^js/JSJoda.DateTimeFormatterBuilder this arg0))) + +(defn optional-start + "Mark the start of an optional section. + + The output of formatting can include optional sections, which may be nested. + An optional section is started by calling this method and ended by calling + {@link #optionalEnd()} or by ending the build process. + + All elements in the optional section are treated as optional. + During formatting, the section is only output if data is available in the + {@code TemporalAccessor} for all the elements in the section. + During parsing, the whole section may be missing from the parsed string. + + For example, consider a builder setup as + {@code builder.appendValue(HOUR_OF_DAY,2).optionalStart().appendValue(MINUTE_OF_HOUR,2)}. + The optional section ends automatically at the end of the builder. + During formatting, the minute will only be output if its value can be obtained from the date-time. + During parsing, the input will be successfully parsed whether the minute is present or not. + + @return this, for chaining, not null" + {:arglists (quote (["java.time.format.DateTimeFormatterBuilder"]))} + (^js/JSJoda.DateTimeFormatterBuilder + [^js/JSJoda.DateTimeFormatterBuilder this] + (.optionalStart this))) + +(defn append-fraction + "Appends the fractional value of a date-time field to the formatter. + + The fractional value of the field will be output including the + preceding decimal point. The preceding value is not output. + For example, the second-of-minute value of 15 would be output as {@code .25}. + + The width of the printed fraction can be controlled. Setting the + minimum width to zero will cause no output to be generated. + The printed fraction will have the minimum width necessary between + the minimum and maximum widths - trailing zeroes are omitted. + No rounding occurs due to the maximum width - digits are simply dropped. + + When parsing in strict mode, the number of parsed digits must be between + the minimum and maximum width. When parsing in lenient mode, the minimum + width is considered to be zero and the maximum is nine. + + If the value cannot be obtained then an exception will be thrown. + If the value is negative an exception will be thrown. + If the field does not have a fixed set of valid values then an + exception will be thrown. + If the field value in the date-time to be printed is invalid it + cannot be printed and an exception will be thrown. + + @param field the field to append, not null + @param minWidth the minimum width of the field excluding the decimal point, from 0 to 9 + @param maxWidth the maximum width of the field excluding the decimal point, from 1 to 9 + @param decimalPoint whether to output the localized decimal point symbol + @return this, for chaining, not null + @throws IllegalArgumentException if the field has a variable set of valid values or + either width is invalid" + {:arglists (quote (["java.time.format.DateTimeFormatterBuilder" + "java.time.temporal.TemporalField" "int" "int" + "boolean"]))} + (^js/JSJoda.DateTimeFormatterBuilder + [^js/JSJoda.DateTimeFormatterBuilder this ^js/JSJoda.TemporalField field + ^int min-width ^int max-width ^boolean decimal-point] + (.appendFraction this field min-width max-width decimal-point))) + +(defn append-optional + "Appends a formatter to the builder which will optionally format/parse. + + This method has the same effect as appending each of the constituent + parts directly to this builder surrounded by an {@link #optionalStart()} and + {@link #optionalEnd()}. + + The formatter will format if data is available for all the fields contained within it. + The formatter will parse if the string matches, otherwise no error is returned. + + @param formatter the formatter to add, not null + @return this, for chaining, not null" + {:arglists (quote (["java.time.format.DateTimeFormatterBuilder" + "java.time.format.DateTimeFormatter"]))} + (^js/JSJoda.DateTimeFormatterBuilder + [^js/JSJoda.DateTimeFormatterBuilder this + ^js/JSJoda.DateTimeFormatter formatter] + (.appendOptional this formatter))) + +(defn optional-end + "Ends an optional section. + + The output of formatting can include optional sections, which may be nested. + An optional section is started by calling {@link #optionalStart()} and ended + using this method (or at the end of the builder). + + Calling this method without having previously called {@code optionalStart} + will throw an exception. + Calling this method immediately after calling {@code optionalStart} has no effect + on the formatter other than ending the (empty) optional section. + + All elements in the optional section are treated as optional. + During formatting, the section is only output if data is available in the + {@code TemporalAccessor} for all the elements in the section. + During parsing, the whole section may be missing from the parsed string. + + For example, consider a builder setup as + {@code builder.appendValue(HOUR_OF_DAY,2).optionalStart().appendValue(MINUTE_OF_HOUR,2).optionalEnd()}. + During formatting, the minute will only be output if its value can be obtained from the date-time. + During parsing, the input will be successfully parsed whether the minute is present or not. + + @return this, for chaining, not null + @throws IllegalStateException if there was no previous call to {@code optionalStart}" + {:arglists (quote (["java.time.format.DateTimeFormatterBuilder"]))} + (^js/JSJoda.DateTimeFormatterBuilder + [^js/JSJoda.DateTimeFormatterBuilder this] + (.optionalEnd this))) + +(defn parse-lenient + "Changes the parse style to be lenient for the remainder of the formatter. + Note that case sensitivity is set separately to this method. + + Parsing can be strict or lenient - by default its strict. + This controls the degree of flexibility in matching the text and sign styles. + Applications calling this method should typically also call {@link #parseCaseInsensitive()}. + + When used, this method changes the parsing to be lenient from this point onwards. + The change will remain in force until the end of the formatter that is eventually + constructed or until {@code parseStrict} is called. + + @return this, for chaining, not null" + {:arglists (quote (["java.time.format.DateTimeFormatterBuilder"]))} + (^js/JSJoda.DateTimeFormatterBuilder + [^js/JSJoda.DateTimeFormatterBuilder this] + (.parseLenient this))) + +(defn pad-next + {:arglists (quote (["java.time.format.DateTimeFormatterBuilder" "int"] + ["java.time.format.DateTimeFormatterBuilder" "int" + "char"]))} + (^js/JSJoda.DateTimeFormatterBuilder + [^js/JSJoda.DateTimeFormatterBuilder this ^int pad-width] + (.padNext this pad-width)) + (^js/JSJoda.DateTimeFormatterBuilder + [^js/JSJoda.DateTimeFormatterBuilder this ^int pad-width ^char pad-char] + (.padNext this pad-width pad-char))) + +(defn append-chronology-id + "Appends the chronology ID, such as 'ISO' or 'ThaiBuddhist', to the formatter. + + This appends an instruction to format/parse the chronology ID to the builder. + + During formatting, the chronology is obtained using a mechanism equivalent + to querying the temporal with {@link TemporalQueries#chronology()}. + It will be printed using the result of {@link Chronology#getId()}. + If the chronology cannot be obtained then an exception is thrown unless the + section of the formatter is optional. + + During parsing, the chronology is parsed and must match one of the chronologies + in {@link Chronology#getAvailableChronologies()}. + If the chronology cannot be parsed then an exception is thrown unless the + section of the formatter is optional. + The parser uses the {@linkplain #parseCaseInsensitive() case sensitive} setting. + + @return this, for chaining, not null" + {:arglists (quote (["java.time.format.DateTimeFormatterBuilder"]))} + (^js/JSJoda.DateTimeFormatterBuilder + [^js/JSJoda.DateTimeFormatterBuilder this] + (.appendChronologyId this))) + +(defn append-zone-or-offset-id + "Appends the time-zone ID, such as 'Europe/Paris' or '+02:00', to + the formatter, using the best available zone ID. + + This appends an instruction to format/parse the best available + zone or offset ID to the builder. + The zone ID is obtained in a lenient manner that first attempts to + find a true zone ID, such as that on {@code ZonedDateTime}, and + then attempts to find an offset, such as that on {@code OffsetDateTime}. + + During formatting, the zone is obtained using a mechanism equivalent + to querying the temporal with {@link TemporalQueries#zone()}. + It will be printed using the result of {@link ZoneId#getId()}. + If the zone cannot be obtained then an exception is thrown unless the + section of the formatter is optional. + + During parsing, the text must match a known zone or offset. + There are two types of zone ID, offset-based, such as '+01:30' and + region-based, such as 'Europe/London'. These are parsed differently. + If the parse starts with '+', '-', 'UT', 'UTC' or 'GMT', then the parser + expects an offset-based zone and will not match region-based zones. + The offset ID, such as '+02:30', may be at the start of the parse, + or prefixed by 'UT', 'UTC' or 'GMT'. The offset ID parsing is + equivalent to using {@link #appendOffset(String, String)} using the + arguments 'HH:MM:ss' and the no offset string '0'. + If the parse starts with 'UT', 'UTC' or 'GMT', and the parser cannot + match a following offset ID, then {@link ZoneOffset#UTC} is selected. + In all other cases, the list of known region-based zones is used to + find the longest available match. If no match is found, and the parse + starts with 'Z', then {@code ZoneOffset.UTC} is selected. + The parser uses the {@linkplain #parseCaseInsensitive() case sensitive} setting. + + For example, the following will parse: +
+   \"Europe/London\"           -- ZoneId.of(\"Europe/London\")
+   \"Z\"                       -- ZoneOffset.UTC
+   \"UT\"                      -- ZoneId.of(\"UT\")
+   \"UTC\"                     -- ZoneId.of(\"UTC\")
+   \"GMT\"                     -- ZoneId.of(\"GMT\")
+   \"+01:30\"                  -- ZoneOffset.of(\"+01:30\")
+   \"UT+01:30\"                -- ZoneOffset.of(\"UT+01:30\")
+   \"UTC+01:30\"               -- ZoneOffset.of(\"UTC+01:30\")
+   \"GMT+01:30\"               -- ZoneOffset.of(\"GMT+01:30\")
+ 
+ + Note that this method is identical to {@code appendZoneId()} except + in the mechanism used to obtain the zone. + + @return this, for chaining, not null + @see #appendZoneId()" + {:arglists (quote (["java.time.format.DateTimeFormatterBuilder"]))} + (^js/JSJoda.DateTimeFormatterBuilder + [^js/JSJoda.DateTimeFormatterBuilder this] + (.appendZoneOrOffsetId this))) + +(defn parse-case-sensitive + "Changes the parse style to be case sensitive for the remainder of the formatter. + + Parsing can be case sensitive or insensitive - by default it is case sensitive. + This method allows the case sensitivity setting of parsing to be changed. + + Calling this method changes the state of the builder such that all + subsequent builder method calls will parse text in case sensitive mode. + See {@link #parseCaseInsensitive} for the opposite setting. + The parse case sensitive/insensitive methods may be called at any point + in the builder, thus the parser can swap between case parsing modes + multiple times during the parse. + + Since the default is case sensitive, this method should only be used after + a previous call to {@code #parseCaseInsensitive}. + + @return this, for chaining, not null" + {:arglists (quote (["java.time.format.DateTimeFormatterBuilder"]))} + (^js/JSJoda.DateTimeFormatterBuilder + [^js/JSJoda.DateTimeFormatterBuilder this] + (.parseCaseSensitive this))) + +(defn parse-strict + "Changes the parse style to be strict for the remainder of the formatter. + + Parsing can be strict or lenient - by default its strict. + This controls the degree of flexibility in matching the text and sign styles. + + When used, this method changes the parsing to be strict from this point onwards. + As strict is the default, this is normally only needed after calling {@link #parseLenient()}. + The change will remain in force until the end of the formatter that is eventually + constructed or until {@code parseLenient} is called. + + @return this, for chaining, not null" + {:arglists (quote (["java.time.format.DateTimeFormatterBuilder"]))} + (^js/JSJoda.DateTimeFormatterBuilder + [^js/JSJoda.DateTimeFormatterBuilder this] + (.parseStrict this))) + +(defn append-chronology-text + "Appends the chronology name to the formatter. + + The calendar system name will be output during a format. + If the chronology cannot be obtained then an exception will be thrown. + + @param textStyle the text style to use, not null + @return this, for chaining, not null" + {:arglists (quote (["java.time.format.DateTimeFormatterBuilder" + "java.time.format.TextStyle"]))} + (^js/JSJoda.DateTimeFormatterBuilder + [^js/JSJoda.DateTimeFormatterBuilder this ^js/JSJoda.TextStyle text-style] + (.appendChronologyText this text-style))) + +(defn append-offset-id + "Appends the zone offset, such as '+01:00', to the formatter. + + This appends an instruction to format/parse the offset ID to the builder. + This is equivalent to calling {@code appendOffset(\"+HH:MM:ss\", \"Z\")}. + + @return this, for chaining, not null" + {:arglists (quote (["java.time.format.DateTimeFormatterBuilder"]))} + (^js/JSJoda.DateTimeFormatterBuilder + [^js/JSJoda.DateTimeFormatterBuilder this] + (.appendOffsetId this))) + +(defn append-zone-region-id + "Appends the time-zone region ID, such as 'Europe/Paris', to the formatter, + rejecting the zone ID if it is a {@code ZoneOffset}. + + This appends an instruction to format/parse the zone ID to the builder + only if it is a region-based ID. + + During formatting, the zone is obtained using a mechanism equivalent + to querying the temporal with {@link TemporalQueries#zoneId()}. + If the zone is a {@code ZoneOffset} or it cannot be obtained then + an exception is thrown unless the section of the formatter is optional. + If the zone is not an offset, then the zone will be printed using + the zone ID from {@link ZoneId#getId()}. + + During parsing, the text must match a known zone or offset. + There are two types of zone ID, offset-based, such as '+01:30' and + region-based, such as 'Europe/London'. These are parsed differently. + If the parse starts with '+', '-', 'UT', 'UTC' or 'GMT', then the parser + expects an offset-based zone and will not match region-based zones. + The offset ID, such as '+02:30', may be at the start of the parse, + or prefixed by 'UT', 'UTC' or 'GMT'. The offset ID parsing is + equivalent to using {@link #appendOffset(String, String)} using the + arguments 'HH:MM:ss' and the no offset string '0'. + If the parse starts with 'UT', 'UTC' or 'GMT', and the parser cannot + match a following offset ID, then {@link ZoneOffset#UTC} is selected. + In all other cases, the list of known region-based zones is used to + find the longest available match. If no match is found, and the parse + starts with 'Z', then {@code ZoneOffset.UTC} is selected. + The parser uses the {@linkplain #parseCaseInsensitive() case sensitive} setting. + + For example, the following will parse: +
+   \"Europe/London\"           -- ZoneId.of(\"Europe/London\")
+   \"Z\"                       -- ZoneOffset.UTC
+   \"UT\"                      -- ZoneId.of(\"UT\")
+   \"UTC\"                     -- ZoneId.of(\"UTC\")
+   \"GMT\"                     -- ZoneId.of(\"GMT\")
+   \"+01:30\"                  -- ZoneOffset.of(\"+01:30\")
+   \"UT+01:30\"                -- ZoneOffset.of(\"+01:30\")
+   \"UTC+01:30\"               -- ZoneOffset.of(\"+01:30\")
+   \"GMT+01:30\"               -- ZoneOffset.of(\"+01:30\")
+ 
+ + Note that this method is identical to {@code appendZoneId()} except + in the mechanism used to obtain the zone. + Note also that parsing accepts offsets, whereas formatting will never + produce one. + + @return this, for chaining, not null + @see #appendZoneId()" + {:arglists (quote (["java.time.format.DateTimeFormatterBuilder"]))} + (^js/JSJoda.DateTimeFormatterBuilder + [^js/JSJoda.DateTimeFormatterBuilder this] + (.appendZoneRegionId this))) + +(defn parse-defaulting + "Appends a default value for a field to the formatter for use in parsing. + + This appends an instruction to the builder to inject a default value + into the parsed result. This is especially useful in conjunction with + optional parts of the formatter. + + For example, consider a formatter that parses the year, followed by + an optional month, with a further optional day-of-month. Using such a + formatter would require the calling code to check whether a full date, + year-month or just a year had been parsed. This method can be used to + default the month and day-of-month to a sensible value, such as the + first of the month, allowing the calling code to always get a date. + + During formatting, this method has no effect. + + During parsing, the current state of the parse is inspected. + If the specified field has no associated value, because it has not been + parsed successfully at that point, then the specified value is injected + into the parse result. Injection is immediate, thus the field-value pair + will be visible to any subsequent elements in the formatter. + As such, this method is normally called at the end of the builder. + + @param field the field to default the value of, not null + @param value the value to default the field to + @return this, for chaining, not null" + {:arglists (quote (["java.time.format.DateTimeFormatterBuilder" + "java.time.temporal.TemporalField" "long"]))} + (^js/JSJoda.DateTimeFormatterBuilder + [^js/JSJoda.DateTimeFormatterBuilder this ^js/JSJoda.TemporalField field + ^long value] + (.parseDefaulting this field value))) + +(defn append-zone-id + "Appends the time-zone ID, such as 'Europe/Paris' or '+02:00', to the formatter. + + This appends an instruction to format/parse the zone ID to the builder. + The zone ID is obtained in a strict manner suitable for {@code ZonedDateTime}. + By contrast, {@code OffsetDateTime} does not have a zone ID suitable + for use with this method, see {@link #appendZoneOrOffsetId()}. + + During formatting, the zone is obtained using a mechanism equivalent + to querying the temporal with {@link TemporalQueries#zoneId()}. + It will be printed using the result of {@link ZoneId#getId()}. + If the zone cannot be obtained then an exception is thrown unless the + section of the formatter is optional. + + During parsing, the text must match a known zone or offset. + There are two types of zone ID, offset-based, such as '+01:30' and + region-based, such as 'Europe/London'. These are parsed differently. + If the parse starts with '+', '-', 'UT', 'UTC' or 'GMT', then the parser + expects an offset-based zone and will not match region-based zones. + The offset ID, such as '+02:30', may be at the start of the parse, + or prefixed by 'UT', 'UTC' or 'GMT'. The offset ID parsing is + equivalent to using {@link #appendOffset(String, String)} using the + arguments 'HH:MM:ss' and the no offset string '0'. + If the parse starts with 'UT', 'UTC' or 'GMT', and the parser cannot + match a following offset ID, then {@link ZoneOffset#UTC} is selected. + In all other cases, the list of known region-based zones is used to + find the longest available match. If no match is found, and the parse + starts with 'Z', then {@code ZoneOffset.UTC} is selected. + The parser uses the {@linkplain #parseCaseInsensitive() case sensitive} setting. + + For example, the following will parse: +
+   \"Europe/London\"           -- ZoneId.of(\"Europe/London\")
+   \"Z\"                       -- ZoneOffset.UTC
+   \"UT\"                      -- ZoneId.of(\"UT\")
+   \"UTC\"                     -- ZoneId.of(\"UTC\")
+   \"GMT\"                     -- ZoneId.of(\"GMT\")
+   \"+01:30\"                  -- ZoneOffset.of(\"+01:30\")
+   \"UT+01:30\"                -- ZoneOffset.of(\"+01:30\")
+   \"UTC+01:30\"               -- ZoneOffset.of(\"+01:30\")
+   \"GMT+01:30\"               -- ZoneOffset.of(\"+01:30\")
+ 
+ + @return this, for chaining, not null + @see #appendZoneRegionId()" + {:arglists (quote (["java.time.format.DateTimeFormatterBuilder"]))} + (^js/JSJoda.DateTimeFormatterBuilder + [^js/JSJoda.DateTimeFormatterBuilder this] + (.appendZoneId this))) + +(defn get-localized-date-time-pattern + "Gets the formatting pattern for date and time styles for a locale and chronology. + The locale and chronology are used to lookup the locale specific format + for the requested dateStyle and/or timeStyle. + + @param dateStyle the FormatStyle for the date, null for time-only pattern + @param timeStyle the FormatStyle for the time, null for date-only pattern + @param chrono the Chronology, non-null + @param locale the locale, non-null + @return the locale and Chronology specific formatting pattern + @throws IllegalArgumentException if both dateStyle and timeStyle are null" + {:arglists (quote (["java.time.format.FormatStyle" + "java.time.format.FormatStyle" + "java.time.chrono.Chronology" "java.util.Locale"]))} + (^java.lang.String + [^js/JSJoda.FormatStyle date-style ^js/JSJoda.FormatStyle time-style + ^js/JSJoda.Chronology chrono ^java.util.Locale locale] + (js-invoke java.time.format.DateTimeFormatterBuilder + "getLocalizedDateTimePattern" + date-style + time-style + chrono + locale))) + +(defn parse-case-insensitive + "Changes the parse style to be case insensitive for the remainder of the formatter. + + Parsing can be case sensitive or insensitive - by default it is case sensitive. + This method allows the case sensitivity setting of parsing to be changed. + + Calling this method changes the state of the builder such that all + subsequent builder method calls will parse text in case insensitive mode. + See {@link #parseCaseSensitive()} for the opposite setting. + The parse case sensitive/insensitive methods may be called at any point + in the builder, thus the parser can swap between case parsing modes + multiple times during the parse. + + @return this, for chaining, not null" + {:arglists (quote (["java.time.format.DateTimeFormatterBuilder"]))} + (^js/JSJoda.DateTimeFormatterBuilder + [^js/JSJoda.DateTimeFormatterBuilder this] + (.parseCaseInsensitive this))) + +(defn append-localized-offset + "Appends the localized zone offset, such as 'GMT+01:00', to the formatter. + + This appends a localized zone offset to the builder, the format of the + localized offset is controlled by the specified {@link FormatStyle style} + to this method: + + + During formatting, the offset is obtained using a mechanism equivalent + to querying the temporal with {@link TemporalQueries#offset()}. + If the offset cannot be obtained then an exception is thrown unless the + section of the formatter is optional. + + During parsing, the offset is parsed using the format defined above. + If the offset cannot be parsed then an exception is thrown unless the + section of the formatter is optional. + + @param style the format style to use, not null + @return this, for chaining, not null + @throws IllegalArgumentException if style is neither {@link TextStyle#FULL + full} nor {@link TextStyle#SHORT short}" + {:arglists (quote (["java.time.format.DateTimeFormatterBuilder" + "java.time.format.TextStyle"]))} + (^js/JSJoda.DateTimeFormatterBuilder + [^js/JSJoda.DateTimeFormatterBuilder this ^js/JSJoda.TextStyle style] + (.appendLocalizedOffset this style))) + +(defn append + "Appends all the elements of a formatter to the builder. + + This method has the same effect as appending each of the constituent + parts of the formatter directly to this builder. + + @param formatter the formatter to add, not null + @return this, for chaining, not null" + {:arglists (quote (["java.time.format.DateTimeFormatterBuilder" + "java.time.format.DateTimeFormatter"]))} + (^js/JSJoda.DateTimeFormatterBuilder + [^js/JSJoda.DateTimeFormatterBuilder this + ^js/JSJoda.DateTimeFormatter formatter] + (.append this formatter))) + +(defn append-text + {:arglists (quote (["java.time.format.DateTimeFormatterBuilder" + "java.time.temporal.TemporalField"] + ["java.time.format.DateTimeFormatterBuilder" + "java.time.temporal.TemporalField" + "java.time.format.TextStyle"] + ["java.time.format.DateTimeFormatterBuilder" + "java.time.temporal.TemporalField" "java.util.Map"]))} + (^js/JSJoda.DateTimeFormatterBuilder + [^js/JSJoda.DateTimeFormatterBuilder this ^js/JSJoda.TemporalField field] + (.appendText this field)) + (^js/JSJoda.DateTimeFormatterBuilder + [^js/JSJoda.DateTimeFormatterBuilder this arg0 arg1] + (.appendText ^js/JSJoda.DateTimeFormatterBuilder this arg0 arg1))) + +(defn append-localized + "Appends a localized date-time pattern to the formatter. + + This appends a localized section to the builder, suitable for outputting + a date, time or date-time combination. The format of the localized + section is lazily looked up based on four items: + + During formatting, the chronology is obtained from the temporal object + being formatted, which may have been overridden by + {@link DateTimeFormatter#withChronology(Chronology)}. + + During parsing, if a chronology has already been parsed, then it is used. + Otherwise the default from {@code DateTimeFormatter.withChronology(Chronology)} + is used, with {@code IsoChronology} as the fallback. + + Note that this method provides similar functionality to methods on + {@code DateFormat} such as {@link java.text.DateFormat#getDateTimeInstance(int, int)}. + + @param dateStyle the date style to use, null means no date required + @param timeStyle the time style to use, null means no time required + @return this, for chaining, not null + @throws IllegalArgumentException if both the date and time styles are null" + {:arglists (quote (["java.time.format.DateTimeFormatterBuilder" + "java.time.format.FormatStyle" + "java.time.format.FormatStyle"]))} + (^js/JSJoda.DateTimeFormatterBuilder + [^js/JSJoda.DateTimeFormatterBuilder this ^js/JSJoda.FormatStyle date-style + ^js/JSJoda.FormatStyle time-style] + (.appendLocalized this date-style time-style))) + +(defn append-offset + "Appends the zone offset, such as '+01:00', to the formatter. + + This appends an instruction to format/parse the offset ID to the builder. + + During formatting, the offset is obtained using a mechanism equivalent + to querying the temporal with {@link TemporalQueries#offset()}. + It will be printed using the format defined below. + If the offset cannot be obtained then an exception is thrown unless the + section of the formatter is optional. + + During parsing, the offset is parsed using the format defined below. + If the offset cannot be parsed then an exception is thrown unless the + section of the formatter is optional. + + The format of the offset is controlled by a pattern which must be one + of the following: + + The \"no offset\" text controls what text is printed when the total amount of + the offset fields to be output is zero. + Example values would be 'Z', '+00:00', 'UTC' or 'GMT'. + Three formats are accepted for parsing UTC - the \"no offset\" text, and the + plus and minus versions of zero defined by the pattern. + + @param pattern the pattern to use, not null + @param noOffsetText the text to use when the offset is zero, not null + @return this, for chaining, not null" + {:arglists (quote (["java.time.format.DateTimeFormatterBuilder" + "java.lang.String" "java.lang.String"]))} + (^js/JSJoda.DateTimeFormatterBuilder + [^js/JSJoda.DateTimeFormatterBuilder this ^java.lang.String pattern + ^java.lang.String no-offset-text] + (.appendOffset this pattern no-offset-text))) + +(defn append-value-reduced + {:arglists (quote (["java.time.format.DateTimeFormatterBuilder" + "java.time.temporal.TemporalField" "int" "int" "int"] + ["java.time.format.DateTimeFormatterBuilder" + "java.time.temporal.TemporalField" "int" "int" + "java.time.chrono.ChronoLocalDate"]))} + (^js/JSJoda.DateTimeFormatterBuilder + [^js/JSJoda.DateTimeFormatterBuilder this arg0 arg1 arg2 arg3] + (.appendValueReduced ^js/JSJoda.DateTimeFormatterBuilder this + arg0 + arg1 + arg2 + arg3))) + +(defn append-zone-text + {:arglists (quote (["java.time.format.DateTimeFormatterBuilder" + "java.time.format.TextStyle"] + ["java.time.format.DateTimeFormatterBuilder" + "java.time.format.TextStyle" "java.util.Set"]))} + (^js/JSJoda.DateTimeFormatterBuilder + [^js/JSJoda.DateTimeFormatterBuilder this ^js/JSJoda.TextStyle text-style] + (.appendZoneText this text-style)) + (^js/JSJoda.DateTimeFormatterBuilder + [^js/JSJoda.DateTimeFormatterBuilder this ^js/JSJoda.TextStyle text-style + ^java.util.Set preferred-zones] + (.appendZoneText this text-style preferred-zones))) diff --git a/src/cljc/java_time/format/decimal_style.clj b/src/cljc/java_time/format/decimal_style.clj index f37601b..9097e70 100644 --- a/src/cljc/java_time/format/decimal_style.clj +++ b/src/cljc/java_time/format/decimal_style.clj @@ -1,16 +1,167 @@ -(ns cljc.java-time.format.decimal-style (:refer-clojure :exclude [abs get range format min max next name resolve short]) (:require [cljc.java-time.extn.calendar-awareness]) (:import [java.time.format DecimalStyle])) -(def standard java.time.format.DecimalStyle/STANDARD) -(clojure.core/defn with-decimal-separator {:arglists (quote (["java.time.format.DecimalStyle" "char"]))} (^java.time.format.DecimalStyle [^java.time.format.DecimalStyle this16144 ^java.lang.Character char16145] (.withDecimalSeparator this16144 char16145))) -(clojure.core/defn of {:arglists (quote (["java.util.Locale"]))} (^java.time.format.DecimalStyle [^java.util.Locale java-util-Locale16146] (java.time.format.DecimalStyle/of java-util-Locale16146))) -(clojure.core/defn with-positive-sign {:arglists (quote (["java.time.format.DecimalStyle" "char"]))} (^java.time.format.DecimalStyle [^java.time.format.DecimalStyle this16147 ^java.lang.Character char16148] (.withPositiveSign this16147 char16148))) -(clojure.core/defn get-decimal-separator {:arglists (quote (["java.time.format.DecimalStyle"]))} (^java.lang.Character [^java.time.format.DecimalStyle this16149] (.getDecimalSeparator this16149))) -(clojure.core/defn of-default-locale {:arglists (quote ([]))} (^java.time.format.DecimalStyle [] (java.time.format.DecimalStyle/ofDefaultLocale))) -(clojure.core/defn with-zero-digit {:arglists (quote (["java.time.format.DecimalStyle" "char"]))} (^java.time.format.DecimalStyle [^java.time.format.DecimalStyle this16150 ^java.lang.Character char16151] (.withZeroDigit this16150 char16151))) -(clojure.core/defn to-string {:arglists (quote (["java.time.format.DecimalStyle"]))} (^java.lang.String [^java.time.format.DecimalStyle this16152] (.toString this16152))) -(clojure.core/defn get-zero-digit {:arglists (quote (["java.time.format.DecimalStyle"]))} (^java.lang.Character [^java.time.format.DecimalStyle this16153] (.getZeroDigit this16153))) -(clojure.core/defn with-negative-sign {:arglists (quote (["java.time.format.DecimalStyle" "char"]))} (^java.time.format.DecimalStyle [^java.time.format.DecimalStyle this16154 ^java.lang.Character char16155] (.withNegativeSign this16154 char16155))) -(clojure.core/defn get-available-locales {:arglists (quote ([]))} (^java.util.Set [] (java.time.format.DecimalStyle/getAvailableLocales))) -(clojure.core/defn get-positive-sign {:arglists (quote (["java.time.format.DecimalStyle"]))} (^java.lang.Character [^java.time.format.DecimalStyle this16156] (.getPositiveSign this16156))) -(clojure.core/defn hash-code {:arglists (quote (["java.time.format.DecimalStyle"]))} (^java.lang.Integer [^java.time.format.DecimalStyle this16157] (.hashCode this16157))) -(clojure.core/defn get-negative-sign {:arglists (quote (["java.time.format.DecimalStyle"]))} (^java.lang.Character [^java.time.format.DecimalStyle this16158] (.getNegativeSign this16158))) -(clojure.core/defn equals {:arglists (quote (["java.time.format.DecimalStyle" "java.lang.Object"]))} (^java.lang.Boolean [^java.time.format.DecimalStyle this16159 ^java.lang.Object java-lang-Object16160] (.equals this16159 java-lang-Object16160))) +(ns cljc.java-time.format.decimal-style + (:refer-clojure :exclude + [abs get range format min max next name resolve short]) + (:require [cljc.java-time.extn.calendar-awareness]) + (:import [java.time.format DecimalStyle])) + +(def standard + "The standard set of non-localized decimal style symbols. + + This uses standard ASCII characters for zero, positive, negative and a dot for the decimal point." + java.time.format.DecimalStyle/STANDARD) + +(defn with-decimal-separator + "Returns a copy of the info with a new character that represents the decimal point. + + The character used to represent a decimal point may vary by culture. + This method specifies the character to use. + + @param decimalSeparator the character for the decimal point + @return a copy with a new character that represents the decimal point, not null" + {:arglists (quote (["java.time.format.DecimalStyle" "char"]))} + (^java.time.format.DecimalStyle + [^java.time.format.DecimalStyle this ^java.lang.Character decimal-separator] + (.withDecimalSeparator this decimal-separator))) + +(defn of + "Obtains the DecimalStyle for the specified locale. + + This method provides access to locale sensitive decimal style symbols. + + @param locale the locale, not null + @return the decimal style, not null" + {:arglists (quote (["java.util.Locale"]))} + (^java.time.format.DecimalStyle [^java.util.Locale locale] + (java.time.format.DecimalStyle/of locale))) + +(defn with-positive-sign + "Returns a copy of the info with a new character that represents the positive sign. + + The character used to represent a positive number may vary by culture. + This method specifies the character to use. + + @param positiveSign the character for the positive sign + @return a copy with a new character that represents the positive sign, not null" + {:arglists (quote (["java.time.format.DecimalStyle" "char"]))} + (^java.time.format.DecimalStyle + [^java.time.format.DecimalStyle this ^java.lang.Character positive-sign] + (.withPositiveSign this positive-sign))) + +(defn get-decimal-separator + "Gets the character that represents the decimal point. + + The character used to represent a decimal point may vary by culture. + This method specifies the character to use. + + @return the character for the decimal point" + {:arglists (quote (["java.time.format.DecimalStyle"]))} + (^java.lang.Character [^java.time.format.DecimalStyle this] + (.getDecimalSeparator this))) + +(defn of-default-locale + "Obtains the DecimalStyle for the default + {@link java.util.Locale.Category#FORMAT FORMAT} locale. + + This method provides access to locale sensitive decimal style symbols. + + This is equivalent to calling + {@link #of(Locale) + of(Locale.getDefault(Locale.Category.FORMAT))}. + + @see java.util.Locale.Category#FORMAT + @return the decimal style, not null" + {:arglists (quote ([]))} + (^java.time.format.DecimalStyle [] + (java.time.format.DecimalStyle/ofDefaultLocale))) + +(defn with-zero-digit + "Returns a copy of the info with a new character that represents zero. + + The character used to represent digits may vary by culture. + This method specifies the zero character to use, which implies the characters for one to nine. + + @param zeroDigit the character for zero + @return a copy with a new character that represents zero, not null" + {:arglists (quote (["java.time.format.DecimalStyle" "char"]))} + (^java.time.format.DecimalStyle + [^java.time.format.DecimalStyle this ^java.lang.Character zero-digit] + (.withZeroDigit this zero-digit))) + +(defn to-string + "Returns a string describing this DecimalStyle. + + @return a string description, not null" + {:arglists (quote (["java.time.format.DecimalStyle"]))} + (^java.lang.String [^java.time.format.DecimalStyle this] (.toString this))) + +(defn get-zero-digit + "Gets the character that represents zero. + + The character used to represent digits may vary by culture. + This method specifies the zero character to use, which implies the characters for one to nine. + + @return the character for zero" + {:arglists (quote (["java.time.format.DecimalStyle"]))} + (^java.lang.Character [^java.time.format.DecimalStyle this] + (.getZeroDigit this))) + +(defn with-negative-sign + "Returns a copy of the info with a new character that represents the negative sign. + + The character used to represent a negative number may vary by culture. + This method specifies the character to use. + + @param negativeSign the character for the negative sign + @return a copy with a new character that represents the negative sign, not null" + {:arglists (quote (["java.time.format.DecimalStyle" "char"]))} + (^java.time.format.DecimalStyle + [^java.time.format.DecimalStyle this ^java.lang.Character negative-sign] + (.withNegativeSign this negative-sign))) + +(defn get-available-locales + "Lists all the locales that are supported. + + The locale 'en_US' will always be present. + + @return a Set of Locales for which localization is supported" + {:arglists (quote ([]))} + (^java.util.Set [] (java.time.format.DecimalStyle/getAvailableLocales))) + +(defn get-positive-sign + "Gets the character that represents the positive sign. + + The character used to represent a positive number may vary by culture. + This method specifies the character to use. + + @return the character for the positive sign" + {:arglists (quote (["java.time.format.DecimalStyle"]))} + (^java.lang.Character [^java.time.format.DecimalStyle this] + (.getPositiveSign this))) + +(defn hash-code + "A hash code for this DecimalStyle. + + @return a suitable hash code" + {:arglists (quote (["java.time.format.DecimalStyle"]))} + (^java.lang.Integer [^java.time.format.DecimalStyle this] (.hashCode this))) + +(defn get-negative-sign + "Gets the character that represents the negative sign. + + The character used to represent a negative number may vary by culture. + This method specifies the character to use. + + @return the character for the negative sign" + {:arglists (quote (["java.time.format.DecimalStyle"]))} + (^java.lang.Character [^java.time.format.DecimalStyle this] + (.getNegativeSign this))) + +(defn equals + "Checks if this DecimalStyle is equal to another DecimalStyle. + + @param obj the object to check, null returns false + @return true if this is equal to the other date" + {:arglists (quote (["java.time.format.DecimalStyle" "java.lang.Object"]))} + (^java.lang.Boolean + [^java.time.format.DecimalStyle this ^java.lang.Object obj] + (.equals this obj))) diff --git a/src/cljc/java_time/format/decimal_style.cljs b/src/cljc/java_time/format/decimal_style.cljs index 3fadd51..c776be9 100644 --- a/src/cljc/java_time/format/decimal_style.cljs +++ b/src/cljc/java_time/format/decimal_style.cljs @@ -1,16 +1,161 @@ -(ns cljc.java-time.format.decimal-style (:refer-clojure :exclude [abs get range format min max next name resolve short]) (:require [cljc.java-time.extn.calendar-awareness] [goog.object] [java.time.format :refer [DecimalStyle]])) -(def standard (goog.object/get java.time.format.DecimalStyle "STANDARD")) -(clojure.core/defn with-decimal-separator {:arglists (quote (["java.time.format.DecimalStyle" "char"]))} (^js/JSJoda.DecimalStyle [^js/JSJoda.DecimalStyle this16161 ^char char16162] (.withDecimalSeparator this16161 char16162))) -(clojure.core/defn of {:arglists (quote (["java.util.Locale"]))} (^js/JSJoda.DecimalStyle [^java.util.Locale java-util-Locale16163] (js-invoke java.time.format.DecimalStyle "of" java-util-Locale16163))) -(clojure.core/defn with-positive-sign {:arglists (quote (["java.time.format.DecimalStyle" "char"]))} (^js/JSJoda.DecimalStyle [^js/JSJoda.DecimalStyle this16164 ^char char16165] (.withPositiveSign this16164 char16165))) -(clojure.core/defn get-decimal-separator {:arglists (quote (["java.time.format.DecimalStyle"]))} (^char [^js/JSJoda.DecimalStyle this16166] (.decimalSeparator this16166))) -(clojure.core/defn of-default-locale {:arglists (quote ([]))} (^js/JSJoda.DecimalStyle [] (js-invoke java.time.format.DecimalStyle "ofDefaultLocale"))) -(clojure.core/defn with-zero-digit {:arglists (quote (["java.time.format.DecimalStyle" "char"]))} (^js/JSJoda.DecimalStyle [^js/JSJoda.DecimalStyle this16167 ^char char16168] (.withZeroDigit this16167 char16168))) -(clojure.core/defn to-string {:arglists (quote (["java.time.format.DecimalStyle"]))} (^java.lang.String [^js/JSJoda.DecimalStyle this16169] (.toString this16169))) -(clojure.core/defn get-zero-digit {:arglists (quote (["java.time.format.DecimalStyle"]))} (^char [^js/JSJoda.DecimalStyle this16170] (.zeroDigit this16170))) -(clojure.core/defn with-negative-sign {:arglists (quote (["java.time.format.DecimalStyle" "char"]))} (^js/JSJoda.DecimalStyle [^js/JSJoda.DecimalStyle this16171 ^char char16172] (.withNegativeSign this16171 char16172))) -(clojure.core/defn get-available-locales {:arglists (quote ([]))} (^java.util.Set [] (js-invoke java.time.format.DecimalStyle "getAvailableLocales"))) -(clojure.core/defn get-positive-sign {:arglists (quote (["java.time.format.DecimalStyle"]))} (^char [^js/JSJoda.DecimalStyle this16173] (.positiveSign this16173))) -(clojure.core/defn hash-code {:arglists (quote (["java.time.format.DecimalStyle"]))} (^int [^js/JSJoda.DecimalStyle this16174] (.hashCode this16174))) -(clojure.core/defn get-negative-sign {:arglists (quote (["java.time.format.DecimalStyle"]))} (^char [^js/JSJoda.DecimalStyle this16175] (.negativeSign this16175))) -(clojure.core/defn equals {:arglists (quote (["java.time.format.DecimalStyle" "java.lang.Object"]))} (^boolean [^js/JSJoda.DecimalStyle this16176 ^java.lang.Object java-lang-Object16177] (.equals this16176 java-lang-Object16177))) +(ns cljc.java-time.format.decimal-style + (:refer-clojure :exclude + [abs get range format min max next name resolve short]) + (:require [cljc.java-time.extn.calendar-awareness] + [goog.object] + [java.time.format :refer [DecimalStyle]])) + +(def standard + "The standard set of non-localized decimal style symbols. + + This uses standard ASCII characters for zero, positive, negative and a dot for the decimal point." + (goog.object/get java.time.format.DecimalStyle "STANDARD")) + +(defn with-decimal-separator + "Returns a copy of the info with a new character that represents the decimal point. + + The character used to represent a decimal point may vary by culture. + This method specifies the character to use. + + @param decimalSeparator the character for the decimal point + @return a copy with a new character that represents the decimal point, not null" + {:arglists (quote (["java.time.format.DecimalStyle" "char"]))} + (^js/JSJoda.DecimalStyle + [^js/JSJoda.DecimalStyle this ^char decimal-separator] + (.withDecimalSeparator this decimal-separator))) + +(defn of + "Obtains the DecimalStyle for the specified locale. + + This method provides access to locale sensitive decimal style symbols. + + @param locale the locale, not null + @return the decimal style, not null" + {:arglists (quote (["java.util.Locale"]))} + (^js/JSJoda.DecimalStyle [^java.util.Locale locale] + (js-invoke java.time.format.DecimalStyle "of" locale))) + +(defn with-positive-sign + "Returns a copy of the info with a new character that represents the positive sign. + + The character used to represent a positive number may vary by culture. + This method specifies the character to use. + + @param positiveSign the character for the positive sign + @return a copy with a new character that represents the positive sign, not null" + {:arglists (quote (["java.time.format.DecimalStyle" "char"]))} + (^js/JSJoda.DecimalStyle [^js/JSJoda.DecimalStyle this ^char positive-sign] + (.withPositiveSign this positive-sign))) + +(defn get-decimal-separator + "Gets the character that represents the decimal point. + + The character used to represent a decimal point may vary by culture. + This method specifies the character to use. + + @return the character for the decimal point" + {:arglists (quote (["java.time.format.DecimalStyle"]))} + (^char [^js/JSJoda.DecimalStyle this] (.decimalSeparator this))) + +(defn of-default-locale + "Obtains the DecimalStyle for the default + {@link java.util.Locale.Category#FORMAT FORMAT} locale. + + This method provides access to locale sensitive decimal style symbols. + + This is equivalent to calling + {@link #of(Locale) + of(Locale.getDefault(Locale.Category.FORMAT))}. + + @see java.util.Locale.Category#FORMAT + @return the decimal style, not null" + {:arglists (quote ([]))} + (^js/JSJoda.DecimalStyle [] + (js-invoke java.time.format.DecimalStyle "ofDefaultLocale"))) + +(defn with-zero-digit + "Returns a copy of the info with a new character that represents zero. + + The character used to represent digits may vary by culture. + This method specifies the zero character to use, which implies the characters for one to nine. + + @param zeroDigit the character for zero + @return a copy with a new character that represents zero, not null" + {:arglists (quote (["java.time.format.DecimalStyle" "char"]))} + (^js/JSJoda.DecimalStyle [^js/JSJoda.DecimalStyle this ^char zero-digit] + (.withZeroDigit this zero-digit))) + +(defn to-string + "Returns a string describing this DecimalStyle. + + @return a string description, not null" + {:arglists (quote (["java.time.format.DecimalStyle"]))} + (^java.lang.String [^js/JSJoda.DecimalStyle this] (.toString this))) + +(defn get-zero-digit + "Gets the character that represents zero. + + The character used to represent digits may vary by culture. + This method specifies the zero character to use, which implies the characters for one to nine. + + @return the character for zero" + {:arglists (quote (["java.time.format.DecimalStyle"]))} + (^char [^js/JSJoda.DecimalStyle this] (.zeroDigit this))) + +(defn with-negative-sign + "Returns a copy of the info with a new character that represents the negative sign. + + The character used to represent a negative number may vary by culture. + This method specifies the character to use. + + @param negativeSign the character for the negative sign + @return a copy with a new character that represents the negative sign, not null" + {:arglists (quote (["java.time.format.DecimalStyle" "char"]))} + (^js/JSJoda.DecimalStyle [^js/JSJoda.DecimalStyle this ^char negative-sign] + (.withNegativeSign this negative-sign))) + +(defn get-available-locales + "Lists all the locales that are supported. + + The locale 'en_US' will always be present. + + @return a Set of Locales for which localization is supported" + {:arglists (quote ([]))} + (^java.util.Set [] + (js-invoke java.time.format.DecimalStyle "getAvailableLocales"))) + +(defn get-positive-sign + "Gets the character that represents the positive sign. + + The character used to represent a positive number may vary by culture. + This method specifies the character to use. + + @return the character for the positive sign" + {:arglists (quote (["java.time.format.DecimalStyle"]))} + (^char [^js/JSJoda.DecimalStyle this] (.positiveSign this))) + +(defn hash-code + "A hash code for this DecimalStyle. + + @return a suitable hash code" + {:arglists (quote (["java.time.format.DecimalStyle"]))} + (^int [^js/JSJoda.DecimalStyle this] (.hashCode this))) + +(defn get-negative-sign + "Gets the character that represents the negative sign. + + The character used to represent a negative number may vary by culture. + This method specifies the character to use. + + @return the character for the negative sign" + {:arglists (quote (["java.time.format.DecimalStyle"]))} + (^char [^js/JSJoda.DecimalStyle this] (.negativeSign this))) + +(defn equals + "Checks if this DecimalStyle is equal to another DecimalStyle. + + @param obj the object to check, null returns false + @return true if this is equal to the other date" + {:arglists (quote (["java.time.format.DecimalStyle" "java.lang.Object"]))} + (^boolean [^js/JSJoda.DecimalStyle this ^java.lang.Object obj] + (.equals this obj))) diff --git a/src/cljc/java_time/format/resolver_style.clj b/src/cljc/java_time/format/resolver_style.clj index b7c3417..f0ac5bf 100644 --- a/src/cljc/java_time/format/resolver_style.clj +++ b/src/cljc/java_time/format/resolver_style.clj @@ -1,13 +1,136 @@ -(ns cljc.java-time.format.resolver-style (:refer-clojure :exclude [abs get range format min max next name resolve short]) (:require [cljc.java-time.extn.calendar-awareness]) (:import [java.time.format ResolverStyle])) -(def smart java.time.format.ResolverStyle/SMART) -(def strict java.time.format.ResolverStyle/STRICT) -(def lenient java.time.format.ResolverStyle/LENIENT) -(clojure.core/defn values {:arglists (quote ([]))} (^"java.lang.Class" [] (java.time.format.ResolverStyle/values))) -(clojure.core/defn value-of {:arglists (quote (["java.lang.String"] ["java.lang.Class" "java.lang.String"]))} (^java.time.format.ResolverStyle [^java.lang.String java-lang-String16120] (java.time.format.ResolverStyle/valueOf java-lang-String16120)) (^java.lang.Enum [^java.lang.Class java-lang-Class16121 ^java.lang.String java-lang-String16122] (java.time.format.ResolverStyle/valueOf java-lang-Class16121 java-lang-String16122))) -(clojure.core/defn ordinal {:arglists (quote (["java.time.format.ResolverStyle"]))} (^java.lang.Integer [^java.time.format.ResolverStyle this16123] (.ordinal this16123))) -(clojure.core/defn to-string {:arglists (quote (["java.time.format.ResolverStyle"]))} (^java.lang.String [^java.time.format.ResolverStyle this16124] (.toString this16124))) -(clojure.core/defn name {:arglists (quote (["java.time.format.ResolverStyle"]))} (^java.lang.String [^java.time.format.ResolverStyle this16125] (.name this16125))) -(clojure.core/defn get-declaring-class {:arglists (quote (["java.time.format.ResolverStyle"]))} (^java.lang.Class [^java.time.format.ResolverStyle this16126] (.getDeclaringClass this16126))) -(clojure.core/defn hash-code {:arglists (quote (["java.time.format.ResolverStyle"]))} (^java.lang.Integer [^java.time.format.ResolverStyle this16127] (.hashCode this16127))) -(clojure.core/defn compare-to {:arglists (quote (["java.time.format.ResolverStyle" "java.lang.Enum"]))} (^java.lang.Integer [^java.time.format.ResolverStyle this16128 ^java.lang.Enum java-lang-Enum16129] (.compareTo this16128 java-lang-Enum16129))) -(clojure.core/defn equals {:arglists (quote (["java.time.format.ResolverStyle" "java.lang.Object"]))} (^java.lang.Boolean [^java.time.format.ResolverStyle this16130 ^java.lang.Object java-lang-Object16131] (.equals this16130 java-lang-Object16131))) +(ns cljc.java-time.format.resolver-style + (:refer-clojure :exclude + [abs get range format min max next name resolve short]) + (:require [cljc.java-time.extn.calendar-awareness]) + (:import [java.time.format ResolverStyle])) + +(def smart + "Style to resolve dates and times in a smart, or intelligent, manner. + + Using smart resolution will perform the sensible default for each + field, which may be the same as strict, the same as lenient, or a third + behavior. Individual fields will interpret this differently. + + For example, resolving year-month and day-of-month in the ISO calendar + system using smart mode will ensure that the day-of-month is from + 1 to 31, converting any value beyond the last valid day-of-month to be + the last valid day-of-month." + java.time.format.ResolverStyle/SMART) + +(def strict + "Style to resolve dates and times strictly. + + Using strict resolution will ensure that all parsed values are within + the outer range of valid values for the field. Individual fields may + be further processed for strictness. + + For example, resolving year-month and day-of-month in the ISO calendar + system using strict mode will ensure that the day-of-month is valid + for the year-month, rejecting invalid values." + java.time.format.ResolverStyle/STRICT) + +(def lenient + "Style to resolve dates and times leniently. + + Using lenient resolution will resolve the values in an appropriate + lenient manner. Individual fields will interpret this differently. + + For example, lenient mode allows the month in the ISO calendar system + to be outside the range 1 to 12. + For example, month 15 is treated as being 3 months after month 12." + java.time.format.ResolverStyle/LENIENT) + +(defn values + {:arglists (quote ([]))} + (^"java.lang.Class" [] (java.time.format.ResolverStyle/values))) + +(defn value-of + {:arglists (quote (["java.lang.String"] + ["java.lang.Class" "java.lang.String"]))} + (^java.time.format.ResolverStyle [^java.lang.String name] + (java.time.format.ResolverStyle/valueOf name)) + (^java.lang.Enum [^java.lang.Class enum-type ^java.lang.String name] + (java.time.format.ResolverStyle/valueOf enum-type name))) + +(defn ordinal + "Returns the ordinal of this enumeration constant (its position + in its enum declaration, where the initial constant is assigned + an ordinal of zero). + + Most programmers will have no use for this method. It is + designed for use by sophisticated enum-based data structures, such + as {@link java.util.EnumSet} and {@link java.util.EnumMap}. + + @return the ordinal of this enumeration constant" + {:arglists (quote (["java.time.format.ResolverStyle"]))} + (^java.lang.Integer [^java.time.format.ResolverStyle this] (.ordinal this))) + +(defn to-string + "Returns the name of this enum constant, as contained in the + declaration. This method may be overridden, though it typically + isn't necessary or desirable. An enum type should override this + method when a more \"programmer-friendly\" string form exists. + + @return the name of this enum constant" + {:arglists (quote (["java.time.format.ResolverStyle"]))} + (^java.lang.String [^java.time.format.ResolverStyle this] (.toString this))) + +(defn name + "Returns the name of this enum constant, exactly as declared in its + enum declaration. + + Most programmers should use the {@link #toString} method in + preference to this one, as the toString method may return + a more user-friendly name. This method is designed primarily for + use in specialized situations where correctness depends on getting the + exact name, which will not vary from release to release. + + @return the name of this enum constant" + {:arglists (quote (["java.time.format.ResolverStyle"]))} + (^java.lang.String [^java.time.format.ResolverStyle this] (.name this))) + +(defn get-declaring-class + "Returns the Class object corresponding to this enum constant's + enum type. Two enum constants e1 and e2 are of the + same enum type if and only if + e1.getDeclaringClass() == e2.getDeclaringClass(). + (The value returned by this method may differ from the one returned + by the {@link Object#getClass} method for enum constants with + constant-specific class bodies.) + + @return the Class object corresponding to this enum constant's + enum type" + {:arglists (quote (["java.time.format.ResolverStyle"]))} + (^java.lang.Class [^java.time.format.ResolverStyle this] + (.getDeclaringClass this))) + +(defn hash-code + "Returns a hash code for this enum constant. + + @return a hash code for this enum constant." + {:arglists (quote (["java.time.format.ResolverStyle"]))} + (^java.lang.Integer [^java.time.format.ResolverStyle this] (.hashCode this))) + +(defn compare-to + "Compares this enum with the specified object for order. Returns a + negative integer, zero, or a positive integer as this object is less + than, equal to, or greater than the specified object. + + Enum constants are only comparable to other enum constants of the + same enum type. The natural order implemented by this + method is the order in which the constants are declared." + {:arglists (quote (["java.time.format.ResolverStyle" "java.lang.Enum"]))} + (^java.lang.Integer [^java.time.format.ResolverStyle this ^java.lang.Enum o] + (.compareTo this o))) + +(defn equals + "Returns true if the specified object is equal to this + enum constant. + + @param other the object to be compared for equality with this object. + @return true if the specified object is equal to this + enum constant." + {:arglists (quote (["java.time.format.ResolverStyle" "java.lang.Object"]))} + (^java.lang.Boolean + [^java.time.format.ResolverStyle this ^java.lang.Object other] + (.equals this other))) diff --git a/src/cljc/java_time/format/resolver_style.cljs b/src/cljc/java_time/format/resolver_style.cljs index 1298b88..73aec95 100644 --- a/src/cljc/java_time/format/resolver_style.cljs +++ b/src/cljc/java_time/format/resolver_style.cljs @@ -1,13 +1,134 @@ -(ns cljc.java-time.format.resolver-style (:refer-clojure :exclude [abs get range format min max next name resolve short]) (:require [cljc.java-time.extn.calendar-awareness] [goog.object] [java.time.format :refer [ResolverStyle]])) -(def smart (goog.object/get java.time.format.ResolverStyle "SMART")) -(def strict (goog.object/get java.time.format.ResolverStyle "STRICT")) -(def lenient (goog.object/get java.time.format.ResolverStyle "LENIENT")) -(clojure.core/defn values {:arglists (quote ([]))} (^"java.lang.Class" [] (js-invoke java.time.format.ResolverStyle "values"))) -(clojure.core/defn value-of {:arglists (quote (["java.lang.String"] ["java.lang.Class" "java.lang.String"]))} (^js/JSJoda.ResolverStyle [^java.lang.String java-lang-String16132] (js-invoke java.time.format.ResolverStyle "valueOf" java-lang-String16132)) (^java.lang.Enum [^java.lang.Class java-lang-Class16133 ^java.lang.String java-lang-String16134] (js-invoke java.time.format.ResolverStyle "valueOf" java-lang-Class16133 java-lang-String16134))) -(clojure.core/defn ordinal {:arglists (quote (["java.time.format.ResolverStyle"]))} (^int [^js/JSJoda.ResolverStyle this16135] (.ordinal this16135))) -(clojure.core/defn to-string {:arglists (quote (["java.time.format.ResolverStyle"]))} (^java.lang.String [^js/JSJoda.ResolverStyle this16136] (.toString this16136))) -(clojure.core/defn name {:arglists (quote (["java.time.format.ResolverStyle"]))} (^java.lang.String [^js/JSJoda.ResolverStyle this16137] (.name this16137))) -(clojure.core/defn get-declaring-class {:arglists (quote (["java.time.format.ResolverStyle"]))} (^java.lang.Class [^js/JSJoda.ResolverStyle this16138] (.declaringClass this16138))) -(clojure.core/defn hash-code {:arglists (quote (["java.time.format.ResolverStyle"]))} (^int [^js/JSJoda.ResolverStyle this16139] (.hashCode this16139))) -(clojure.core/defn compare-to {:arglists (quote (["java.time.format.ResolverStyle" "java.lang.Enum"]))} (^int [^js/JSJoda.ResolverStyle this16140 ^java.lang.Enum java-lang-Enum16141] (.compareTo this16140 java-lang-Enum16141))) -(clojure.core/defn equals {:arglists (quote (["java.time.format.ResolverStyle" "java.lang.Object"]))} (^boolean [^js/JSJoda.ResolverStyle this16142 ^java.lang.Object java-lang-Object16143] (.equals this16142 java-lang-Object16143))) +(ns cljc.java-time.format.resolver-style + (:refer-clojure :exclude + [abs get range format min max next name resolve short]) + (:require [cljc.java-time.extn.calendar-awareness] + [goog.object] + [java.time.format :refer [ResolverStyle]])) + +(def smart + "Style to resolve dates and times in a smart, or intelligent, manner. + + Using smart resolution will perform the sensible default for each + field, which may be the same as strict, the same as lenient, or a third + behavior. Individual fields will interpret this differently. + + For example, resolving year-month and day-of-month in the ISO calendar + system using smart mode will ensure that the day-of-month is from + 1 to 31, converting any value beyond the last valid day-of-month to be + the last valid day-of-month." + (goog.object/get java.time.format.ResolverStyle "SMART")) + +(def strict + "Style to resolve dates and times strictly. + + Using strict resolution will ensure that all parsed values are within + the outer range of valid values for the field. Individual fields may + be further processed for strictness. + + For example, resolving year-month and day-of-month in the ISO calendar + system using strict mode will ensure that the day-of-month is valid + for the year-month, rejecting invalid values." + (goog.object/get java.time.format.ResolverStyle "STRICT")) + +(def lenient + "Style to resolve dates and times leniently. + + Using lenient resolution will resolve the values in an appropriate + lenient manner. Individual fields will interpret this differently. + + For example, lenient mode allows the month in the ISO calendar system + to be outside the range 1 to 12. + For example, month 15 is treated as being 3 months after month 12." + (goog.object/get java.time.format.ResolverStyle "LENIENT")) + +(defn values + {:arglists (quote ([]))} + (^"java.lang.Class" [] (js-invoke java.time.format.ResolverStyle "values"))) + +(defn value-of + {:arglists (quote (["java.lang.String"] + ["java.lang.Class" "java.lang.String"]))} + (^js/JSJoda.ResolverStyle [^java.lang.String name] + (js-invoke java.time.format.ResolverStyle "valueOf" name)) + (^java.lang.Enum [^java.lang.Class enum-type ^java.lang.String name] + (js-invoke java.time.format.ResolverStyle "valueOf" enum-type name))) + +(defn ordinal + "Returns the ordinal of this enumeration constant (its position + in its enum declaration, where the initial constant is assigned + an ordinal of zero). + + Most programmers will have no use for this method. It is + designed for use by sophisticated enum-based data structures, such + as {@link java.util.EnumSet} and {@link java.util.EnumMap}. + + @return the ordinal of this enumeration constant" + {:arglists (quote (["java.time.format.ResolverStyle"]))} + (^int [^js/JSJoda.ResolverStyle this] (.ordinal this))) + +(defn to-string + "Returns the name of this enum constant, as contained in the + declaration. This method may be overridden, though it typically + isn't necessary or desirable. An enum type should override this + method when a more \"programmer-friendly\" string form exists. + + @return the name of this enum constant" + {:arglists (quote (["java.time.format.ResolverStyle"]))} + (^java.lang.String [^js/JSJoda.ResolverStyle this] (.toString this))) + +(defn name + "Returns the name of this enum constant, exactly as declared in its + enum declaration. + + Most programmers should use the {@link #toString} method in + preference to this one, as the toString method may return + a more user-friendly name. This method is designed primarily for + use in specialized situations where correctness depends on getting the + exact name, which will not vary from release to release. + + @return the name of this enum constant" + {:arglists (quote (["java.time.format.ResolverStyle"]))} + (^java.lang.String [^js/JSJoda.ResolverStyle this] (.name this))) + +(defn get-declaring-class + "Returns the Class object corresponding to this enum constant's + enum type. Two enum constants e1 and e2 are of the + same enum type if and only if + e1.getDeclaringClass() == e2.getDeclaringClass(). + (The value returned by this method may differ from the one returned + by the {@link Object#getClass} method for enum constants with + constant-specific class bodies.) + + @return the Class object corresponding to this enum constant's + enum type" + {:arglists (quote (["java.time.format.ResolverStyle"]))} + (^java.lang.Class [^js/JSJoda.ResolverStyle this] (.declaringClass this))) + +(defn hash-code + "Returns a hash code for this enum constant. + + @return a hash code for this enum constant." + {:arglists (quote (["java.time.format.ResolverStyle"]))} + (^int [^js/JSJoda.ResolverStyle this] (.hashCode this))) + +(defn compare-to + "Compares this enum with the specified object for order. Returns a + negative integer, zero, or a positive integer as this object is less + than, equal to, or greater than the specified object. + + Enum constants are only comparable to other enum constants of the + same enum type. The natural order implemented by this + method is the order in which the constants are declared." + {:arglists (quote (["java.time.format.ResolverStyle" "java.lang.Enum"]))} + (^int [^js/JSJoda.ResolverStyle this ^java.lang.Enum o] (.compareTo this o))) + +(defn equals + "Returns true if the specified object is equal to this + enum constant. + + @param other the object to be compared for equality with this object. + @return true if the specified object is equal to this + enum constant." + {:arglists (quote (["java.time.format.ResolverStyle" "java.lang.Object"]))} + (^boolean [^js/JSJoda.ResolverStyle this ^java.lang.Object other] + (.equals this other))) diff --git a/src/cljc/java_time/format/sign_style.clj b/src/cljc/java_time/format/sign_style.clj index c0b0feb..758db92 100644 --- a/src/cljc/java_time/format/sign_style.clj +++ b/src/cljc/java_time/format/sign_style.clj @@ -1,15 +1,137 @@ -(ns cljc.java-time.format.sign-style (:refer-clojure :exclude [abs get range format min max next name resolve short]) (:require [cljc.java-time.extn.calendar-awareness]) (:import [java.time.format SignStyle])) -(def exceeds-pad java.time.format.SignStyle/EXCEEDS_PAD) -(def normal java.time.format.SignStyle/NORMAL) -(def always java.time.format.SignStyle/ALWAYS) -(def never java.time.format.SignStyle/NEVER) -(def not-negative java.time.format.SignStyle/NOT_NEGATIVE) -(clojure.core/defn values {:arglists (quote ([]))} (^"java.lang.Class" [] (java.time.format.SignStyle/values))) -(clojure.core/defn value-of {:arglists (quote (["java.lang.String"] ["java.lang.Class" "java.lang.String"]))} (^java.time.format.SignStyle [^java.lang.String java-lang-String16178] (java.time.format.SignStyle/valueOf java-lang-String16178)) (^java.lang.Enum [^java.lang.Class java-lang-Class16179 ^java.lang.String java-lang-String16180] (java.time.format.SignStyle/valueOf java-lang-Class16179 java-lang-String16180))) -(clojure.core/defn ordinal {:arglists (quote (["java.time.format.SignStyle"]))} (^java.lang.Integer [^java.time.format.SignStyle this16181] (.ordinal this16181))) -(clojure.core/defn to-string {:arglists (quote (["java.time.format.SignStyle"]))} (^java.lang.String [^java.time.format.SignStyle this16182] (.toString this16182))) -(clojure.core/defn name {:arglists (quote (["java.time.format.SignStyle"]))} (^java.lang.String [^java.time.format.SignStyle this16183] (.name this16183))) -(clojure.core/defn get-declaring-class {:arglists (quote (["java.time.format.SignStyle"]))} (^java.lang.Class [^java.time.format.SignStyle this16184] (.getDeclaringClass this16184))) -(clojure.core/defn hash-code {:arglists (quote (["java.time.format.SignStyle"]))} (^java.lang.Integer [^java.time.format.SignStyle this16185] (.hashCode this16185))) -(clojure.core/defn compare-to {:arglists (quote (["java.time.format.SignStyle" "java.lang.Enum"]))} (^java.lang.Integer [^java.time.format.SignStyle this16186 ^java.lang.Enum java-lang-Enum16187] (.compareTo this16186 java-lang-Enum16187))) -(clojure.core/defn equals {:arglists (quote (["java.time.format.SignStyle" "java.lang.Object"]))} (^java.lang.Boolean [^java.time.format.SignStyle this16188 ^java.lang.Object java-lang-Object16189] (.equals this16188 java-lang-Object16189))) +(ns cljc.java-time.format.sign-style + (:refer-clojure :exclude + [abs get range format min max next name resolve short]) + (:require [cljc.java-time.extn.calendar-awareness]) + (:import [java.time.format SignStyle])) + +(def exceeds-pad + "Style to always output the sign if the value exceeds the pad width. + A negative value will always output the '-' sign. + + In strict parsing, the sign will be rejected unless the pad width is exceeded. + In lenient parsing, any sign will be accepted, with the absence + of a sign treated as a positive number." + java.time.format.SignStyle/EXCEEDS_PAD) + +(def normal + "Style to output the sign only if the value is negative. + + In strict parsing, the negative sign will be accepted and the positive sign rejected. + In lenient parsing, any sign will be accepted." + java.time.format.SignStyle/NORMAL) + +(def always + "Style to always output the sign, where zero will output '+'. + + In strict parsing, the absence of a sign will be rejected. + In lenient parsing, any sign will be accepted, with the absence + of a sign treated as a positive number." + java.time.format.SignStyle/ALWAYS) + +(def never + "Style to never output sign, only outputting the absolute value. + + In strict parsing, any sign will be rejected. + In lenient parsing, any sign will be accepted unless the width is fixed." + java.time.format.SignStyle/NEVER) + +(def not-negative + "Style to block negative values, throwing an exception on printing. + + In strict parsing, any sign will be rejected. + In lenient parsing, any sign will be accepted unless the width is fixed." + java.time.format.SignStyle/NOT_NEGATIVE) + +(defn values + {:arglists (quote ([]))} + (^"java.lang.Class" [] (java.time.format.SignStyle/values))) + +(defn value-of + {:arglists (quote (["java.lang.String"] + ["java.lang.Class" "java.lang.String"]))} + (^java.time.format.SignStyle [^java.lang.String name] + (java.time.format.SignStyle/valueOf name)) + (^java.lang.Enum [^java.lang.Class enum-type ^java.lang.String name] + (java.time.format.SignStyle/valueOf enum-type name))) + +(defn ordinal + "Returns the ordinal of this enumeration constant (its position + in its enum declaration, where the initial constant is assigned + an ordinal of zero). + + Most programmers will have no use for this method. It is + designed for use by sophisticated enum-based data structures, such + as {@link java.util.EnumSet} and {@link java.util.EnumMap}. + + @return the ordinal of this enumeration constant" + {:arglists (quote (["java.time.format.SignStyle"]))} + (^java.lang.Integer [^java.time.format.SignStyle this] (.ordinal this))) + +(defn to-string + "Returns the name of this enum constant, as contained in the + declaration. This method may be overridden, though it typically + isn't necessary or desirable. An enum type should override this + method when a more \"programmer-friendly\" string form exists. + + @return the name of this enum constant" + {:arglists (quote (["java.time.format.SignStyle"]))} + (^java.lang.String [^java.time.format.SignStyle this] (.toString this))) + +(defn name + "Returns the name of this enum constant, exactly as declared in its + enum declaration. + + Most programmers should use the {@link #toString} method in + preference to this one, as the toString method may return + a more user-friendly name. This method is designed primarily for + use in specialized situations where correctness depends on getting the + exact name, which will not vary from release to release. + + @return the name of this enum constant" + {:arglists (quote (["java.time.format.SignStyle"]))} + (^java.lang.String [^java.time.format.SignStyle this] (.name this))) + +(defn get-declaring-class + "Returns the Class object corresponding to this enum constant's + enum type. Two enum constants e1 and e2 are of the + same enum type if and only if + e1.getDeclaringClass() == e2.getDeclaringClass(). + (The value returned by this method may differ from the one returned + by the {@link Object#getClass} method for enum constants with + constant-specific class bodies.) + + @return the Class object corresponding to this enum constant's + enum type" + {:arglists (quote (["java.time.format.SignStyle"]))} + (^java.lang.Class [^java.time.format.SignStyle this] + (.getDeclaringClass this))) + +(defn hash-code + "Returns a hash code for this enum constant. + + @return a hash code for this enum constant." + {:arglists (quote (["java.time.format.SignStyle"]))} + (^java.lang.Integer [^java.time.format.SignStyle this] (.hashCode this))) + +(defn compare-to + "Compares this enum with the specified object for order. Returns a + negative integer, zero, or a positive integer as this object is less + than, equal to, or greater than the specified object. + + Enum constants are only comparable to other enum constants of the + same enum type. The natural order implemented by this + method is the order in which the constants are declared." + {:arglists (quote (["java.time.format.SignStyle" "java.lang.Enum"]))} + (^java.lang.Integer [^java.time.format.SignStyle this ^java.lang.Enum o] + (.compareTo this o))) + +(defn equals + "Returns true if the specified object is equal to this + enum constant. + + @param other the object to be compared for equality with this object. + @return true if the specified object is equal to this + enum constant." + {:arglists (quote (["java.time.format.SignStyle" "java.lang.Object"]))} + (^java.lang.Boolean [^java.time.format.SignStyle this ^java.lang.Object other] + (.equals this other))) diff --git a/src/cljc/java_time/format/sign_style.cljs b/src/cljc/java_time/format/sign_style.cljs index ef155e9..e4b9112 100644 --- a/src/cljc/java_time/format/sign_style.cljs +++ b/src/cljc/java_time/format/sign_style.cljs @@ -1,15 +1,136 @@ -(ns cljc.java-time.format.sign-style (:refer-clojure :exclude [abs get range format min max next name resolve short]) (:require [cljc.java-time.extn.calendar-awareness] [goog.object] [java.time.format :refer [SignStyle]])) -(def exceeds-pad (goog.object/get java.time.format.SignStyle "EXCEEDS_PAD")) -(def normal (goog.object/get java.time.format.SignStyle "NORMAL")) -(def always (goog.object/get java.time.format.SignStyle "ALWAYS")) -(def never (goog.object/get java.time.format.SignStyle "NEVER")) -(def not-negative (goog.object/get java.time.format.SignStyle "NOT_NEGATIVE")) -(clojure.core/defn values {:arglists (quote ([]))} (^"java.lang.Class" [] (js-invoke java.time.format.SignStyle "values"))) -(clojure.core/defn value-of {:arglists (quote (["java.lang.String"] ["java.lang.Class" "java.lang.String"]))} (^js/JSJoda.SignStyle [^java.lang.String java-lang-String16190] (js-invoke java.time.format.SignStyle "valueOf" java-lang-String16190)) (^java.lang.Enum [^java.lang.Class java-lang-Class16191 ^java.lang.String java-lang-String16192] (js-invoke java.time.format.SignStyle "valueOf" java-lang-Class16191 java-lang-String16192))) -(clojure.core/defn ordinal {:arglists (quote (["java.time.format.SignStyle"]))} (^int [^js/JSJoda.SignStyle this16193] (.ordinal this16193))) -(clojure.core/defn to-string {:arglists (quote (["java.time.format.SignStyle"]))} (^java.lang.String [^js/JSJoda.SignStyle this16194] (.toString this16194))) -(clojure.core/defn name {:arglists (quote (["java.time.format.SignStyle"]))} (^java.lang.String [^js/JSJoda.SignStyle this16195] (.name this16195))) -(clojure.core/defn get-declaring-class {:arglists (quote (["java.time.format.SignStyle"]))} (^java.lang.Class [^js/JSJoda.SignStyle this16196] (.declaringClass this16196))) -(clojure.core/defn hash-code {:arglists (quote (["java.time.format.SignStyle"]))} (^int [^js/JSJoda.SignStyle this16197] (.hashCode this16197))) -(clojure.core/defn compare-to {:arglists (quote (["java.time.format.SignStyle" "java.lang.Enum"]))} (^int [^js/JSJoda.SignStyle this16198 ^java.lang.Enum java-lang-Enum16199] (.compareTo this16198 java-lang-Enum16199))) -(clojure.core/defn equals {:arglists (quote (["java.time.format.SignStyle" "java.lang.Object"]))} (^boolean [^js/JSJoda.SignStyle this16200 ^java.lang.Object java-lang-Object16201] (.equals this16200 java-lang-Object16201))) +(ns cljc.java-time.format.sign-style + (:refer-clojure :exclude + [abs get range format min max next name resolve short]) + (:require [cljc.java-time.extn.calendar-awareness] + [goog.object] + [java.time.format :refer [SignStyle]])) + +(def exceeds-pad + "Style to always output the sign if the value exceeds the pad width. + A negative value will always output the '-' sign. + + In strict parsing, the sign will be rejected unless the pad width is exceeded. + In lenient parsing, any sign will be accepted, with the absence + of a sign treated as a positive number." + (goog.object/get java.time.format.SignStyle "EXCEEDS_PAD")) + +(def normal + "Style to output the sign only if the value is negative. + + In strict parsing, the negative sign will be accepted and the positive sign rejected. + In lenient parsing, any sign will be accepted." + (goog.object/get java.time.format.SignStyle "NORMAL")) + +(def always + "Style to always output the sign, where zero will output '+'. + + In strict parsing, the absence of a sign will be rejected. + In lenient parsing, any sign will be accepted, with the absence + of a sign treated as a positive number." + (goog.object/get java.time.format.SignStyle "ALWAYS")) + +(def never + "Style to never output sign, only outputting the absolute value. + + In strict parsing, any sign will be rejected. + In lenient parsing, any sign will be accepted unless the width is fixed." + (goog.object/get java.time.format.SignStyle "NEVER")) + +(def not-negative + "Style to block negative values, throwing an exception on printing. + + In strict parsing, any sign will be rejected. + In lenient parsing, any sign will be accepted unless the width is fixed." + (goog.object/get java.time.format.SignStyle "NOT_NEGATIVE")) + +(defn values + {:arglists (quote ([]))} + (^"java.lang.Class" [] (js-invoke java.time.format.SignStyle "values"))) + +(defn value-of + {:arglists (quote (["java.lang.String"] + ["java.lang.Class" "java.lang.String"]))} + (^js/JSJoda.SignStyle [^java.lang.String name] + (js-invoke java.time.format.SignStyle "valueOf" name)) + (^java.lang.Enum [^java.lang.Class enum-type ^java.lang.String name] + (js-invoke java.time.format.SignStyle "valueOf" enum-type name))) + +(defn ordinal + "Returns the ordinal of this enumeration constant (its position + in its enum declaration, where the initial constant is assigned + an ordinal of zero). + + Most programmers will have no use for this method. It is + designed for use by sophisticated enum-based data structures, such + as {@link java.util.EnumSet} and {@link java.util.EnumMap}. + + @return the ordinal of this enumeration constant" + {:arglists (quote (["java.time.format.SignStyle"]))} + (^int [^js/JSJoda.SignStyle this] (.ordinal this))) + +(defn to-string + "Returns the name of this enum constant, as contained in the + declaration. This method may be overridden, though it typically + isn't necessary or desirable. An enum type should override this + method when a more \"programmer-friendly\" string form exists. + + @return the name of this enum constant" + {:arglists (quote (["java.time.format.SignStyle"]))} + (^java.lang.String [^js/JSJoda.SignStyle this] (.toString this))) + +(defn name + "Returns the name of this enum constant, exactly as declared in its + enum declaration. + + Most programmers should use the {@link #toString} method in + preference to this one, as the toString method may return + a more user-friendly name. This method is designed primarily for + use in specialized situations where correctness depends on getting the + exact name, which will not vary from release to release. + + @return the name of this enum constant" + {:arglists (quote (["java.time.format.SignStyle"]))} + (^java.lang.String [^js/JSJoda.SignStyle this] (.name this))) + +(defn get-declaring-class + "Returns the Class object corresponding to this enum constant's + enum type. Two enum constants e1 and e2 are of the + same enum type if and only if + e1.getDeclaringClass() == e2.getDeclaringClass(). + (The value returned by this method may differ from the one returned + by the {@link Object#getClass} method for enum constants with + constant-specific class bodies.) + + @return the Class object corresponding to this enum constant's + enum type" + {:arglists (quote (["java.time.format.SignStyle"]))} + (^java.lang.Class [^js/JSJoda.SignStyle this] (.declaringClass this))) + +(defn hash-code + "Returns a hash code for this enum constant. + + @return a hash code for this enum constant." + {:arglists (quote (["java.time.format.SignStyle"]))} + (^int [^js/JSJoda.SignStyle this] (.hashCode this))) + +(defn compare-to + "Compares this enum with the specified object for order. Returns a + negative integer, zero, or a positive integer as this object is less + than, equal to, or greater than the specified object. + + Enum constants are only comparable to other enum constants of the + same enum type. The natural order implemented by this + method is the order in which the constants are declared." + {:arglists (quote (["java.time.format.SignStyle" "java.lang.Enum"]))} + (^int [^js/JSJoda.SignStyle this ^java.lang.Enum o] (.compareTo this o))) + +(defn equals + "Returns true if the specified object is equal to this + enum constant. + + @param other the object to be compared for equality with this object. + @return true if the specified object is equal to this + enum constant." + {:arglists (quote (["java.time.format.SignStyle" "java.lang.Object"]))} + (^boolean [^js/JSJoda.SignStyle this ^java.lang.Object other] + (.equals this other))) diff --git a/src/cljc/java_time/format/text_style.clj b/src/cljc/java_time/format/text_style.clj index 0e49f48..2b6987c 100644 --- a/src/cljc/java_time/format/text_style.clj +++ b/src/cljc/java_time/format/text_style.clj @@ -1,19 +1,150 @@ -(ns cljc.java-time.format.text-style (:refer-clojure :exclude [abs get range format min max next name resolve short]) (:require [cljc.java-time.extn.calendar-awareness]) (:import [java.time.format TextStyle])) -(def short java.time.format.TextStyle/SHORT) -(def full-standalone java.time.format.TextStyle/FULL_STANDALONE) -(def full java.time.format.TextStyle/FULL) -(def short-standalone java.time.format.TextStyle/SHORT_STANDALONE) -(def narrow java.time.format.TextStyle/NARROW) -(def narrow-standalone java.time.format.TextStyle/NARROW_STANDALONE) -(clojure.core/defn values {:arglists (quote ([]))} (^"java.lang.Class" [] (java.time.format.TextStyle/values))) -(clojure.core/defn value-of {:arglists (quote (["java.lang.String"] ["java.lang.Class" "java.lang.String"]))} (^java.time.format.TextStyle [^java.lang.String java-lang-String16202] (java.time.format.TextStyle/valueOf java-lang-String16202)) (^java.lang.Enum [^java.lang.Class java-lang-Class16203 ^java.lang.String java-lang-String16204] (java.time.format.TextStyle/valueOf java-lang-Class16203 java-lang-String16204))) -(clojure.core/defn ordinal {:arglists (quote (["java.time.format.TextStyle"]))} (^java.lang.Integer [^java.time.format.TextStyle this16205] (.ordinal this16205))) -(clojure.core/defn as-standalone {:arglists (quote (["java.time.format.TextStyle"]))} (^java.time.format.TextStyle [^java.time.format.TextStyle this16206] (.asStandalone this16206))) -(clojure.core/defn to-string {:arglists (quote (["java.time.format.TextStyle"]))} (^java.lang.String [^java.time.format.TextStyle this16207] (.toString this16207))) -(clojure.core/defn name {:arglists (quote (["java.time.format.TextStyle"]))} (^java.lang.String [^java.time.format.TextStyle this16208] (.name this16208))) -(clojure.core/defn get-declaring-class {:arglists (quote (["java.time.format.TextStyle"]))} (^java.lang.Class [^java.time.format.TextStyle this16209] (.getDeclaringClass this16209))) -(clojure.core/defn as-normal {:arglists (quote (["java.time.format.TextStyle"]))} (^java.time.format.TextStyle [^java.time.format.TextStyle this16210] (.asNormal this16210))) -(clojure.core/defn hash-code {:arglists (quote (["java.time.format.TextStyle"]))} (^java.lang.Integer [^java.time.format.TextStyle this16211] (.hashCode this16211))) -(clojure.core/defn compare-to {:arglists (quote (["java.time.format.TextStyle" "java.lang.Enum"]))} (^java.lang.Integer [^java.time.format.TextStyle this16212 ^java.lang.Enum java-lang-Enum16213] (.compareTo this16212 java-lang-Enum16213))) -(clojure.core/defn is-standalone {:arglists (quote (["java.time.format.TextStyle"]))} (^java.lang.Boolean [^java.time.format.TextStyle this16214] (.isStandalone this16214))) -(clojure.core/defn equals {:arglists (quote (["java.time.format.TextStyle" "java.lang.Object"]))} (^java.lang.Boolean [^java.time.format.TextStyle this16215 ^java.lang.Object java-lang-Object16216] (.equals this16215 java-lang-Object16216))) +(ns cljc.java-time.format.text-style + (:refer-clojure :exclude + [abs get range format min max next name resolve short]) + (:require [cljc.java-time.extn.calendar-awareness]) + (:import [java.time.format TextStyle])) + +(def short + "Short text, typically an abbreviation. + For example, day-of-week Monday might output \"Mon\"." + java.time.format.TextStyle/SHORT) + +(def full-standalone + "Full text for stand-alone use, typically the full description. + For example, day-of-week Monday might output \"Monday\"." + java.time.format.TextStyle/FULL_STANDALONE) + +(def full + "Full text, typically the full description. + For example, day-of-week Monday might output \"Monday\"." + java.time.format.TextStyle/FULL) + +(def short-standalone + "Short text for stand-alone use, typically an abbreviation. + For example, day-of-week Monday might output \"Mon\"." + java.time.format.TextStyle/SHORT_STANDALONE) + +(def narrow + "Narrow text, typically a single letter. + For example, day-of-week Monday might output \"M\"." + java.time.format.TextStyle/NARROW) + +(def narrow-standalone + "Narrow text for stand-alone use, typically a single letter. + For example, day-of-week Monday might output \"M\"." + java.time.format.TextStyle/NARROW_STANDALONE) + +(defn values + {:arglists (quote ([]))} + (^"java.lang.Class" [] (java.time.format.TextStyle/values))) + +(defn value-of + {:arglists (quote (["java.lang.String"] + ["java.lang.Class" "java.lang.String"]))} + (^java.time.format.TextStyle [^java.lang.String name] + (java.time.format.TextStyle/valueOf name)) + (^java.lang.Enum [^java.lang.Class enum-type ^java.lang.String name] + (java.time.format.TextStyle/valueOf enum-type name))) + +(defn ordinal + "Returns the ordinal of this enumeration constant (its position + in its enum declaration, where the initial constant is assigned + an ordinal of zero). + + Most programmers will have no use for this method. It is + designed for use by sophisticated enum-based data structures, such + as {@link java.util.EnumSet} and {@link java.util.EnumMap}. + + @return the ordinal of this enumeration constant" + {:arglists (quote (["java.time.format.TextStyle"]))} + (^java.lang.Integer [^java.time.format.TextStyle this] (.ordinal this))) + +(defn as-standalone + "Returns the stand-alone style with the same size. + @return the stand-alone style with the same size" + {:arglists (quote (["java.time.format.TextStyle"]))} + (^java.time.format.TextStyle [^java.time.format.TextStyle this] + (.asStandalone this))) + +(defn to-string + "Returns the name of this enum constant, as contained in the + declaration. This method may be overridden, though it typically + isn't necessary or desirable. An enum type should override this + method when a more \"programmer-friendly\" string form exists. + + @return the name of this enum constant" + {:arglists (quote (["java.time.format.TextStyle"]))} + (^java.lang.String [^java.time.format.TextStyle this] (.toString this))) + +(defn name + "Returns the name of this enum constant, exactly as declared in its + enum declaration. + + Most programmers should use the {@link #toString} method in + preference to this one, as the toString method may return + a more user-friendly name. This method is designed primarily for + use in specialized situations where correctness depends on getting the + exact name, which will not vary from release to release. + + @return the name of this enum constant" + {:arglists (quote (["java.time.format.TextStyle"]))} + (^java.lang.String [^java.time.format.TextStyle this] (.name this))) + +(defn get-declaring-class + "Returns the Class object corresponding to this enum constant's + enum type. Two enum constants e1 and e2 are of the + same enum type if and only if + e1.getDeclaringClass() == e2.getDeclaringClass(). + (The value returned by this method may differ from the one returned + by the {@link Object#getClass} method for enum constants with + constant-specific class bodies.) + + @return the Class object corresponding to this enum constant's + enum type" + {:arglists (quote (["java.time.format.TextStyle"]))} + (^java.lang.Class [^java.time.format.TextStyle this] + (.getDeclaringClass this))) + +(defn as-normal + "Returns the normal style with the same size. + + @return the normal style with the same size" + {:arglists (quote (["java.time.format.TextStyle"]))} + (^java.time.format.TextStyle [^java.time.format.TextStyle this] + (.asNormal this))) + +(defn hash-code + "Returns a hash code for this enum constant. + + @return a hash code for this enum constant." + {:arglists (quote (["java.time.format.TextStyle"]))} + (^java.lang.Integer [^java.time.format.TextStyle this] (.hashCode this))) + +(defn compare-to + "Compares this enum with the specified object for order. Returns a + negative integer, zero, or a positive integer as this object is less + than, equal to, or greater than the specified object. + + Enum constants are only comparable to other enum constants of the + same enum type. The natural order implemented by this + method is the order in which the constants are declared." + {:arglists (quote (["java.time.format.TextStyle" "java.lang.Enum"]))} + (^java.lang.Integer [^java.time.format.TextStyle this ^java.lang.Enum o] + (.compareTo this o))) + +(defn is-standalone + "Returns true if the Style is a stand-alone style. + @return true if the style is a stand-alone style." + {:arglists (quote (["java.time.format.TextStyle"]))} + (^java.lang.Boolean [^java.time.format.TextStyle this] (.isStandalone this))) + +(defn equals + "Returns true if the specified object is equal to this + enum constant. + + @param other the object to be compared for equality with this object. + @return true if the specified object is equal to this + enum constant." + {:arglists (quote (["java.time.format.TextStyle" "java.lang.Object"]))} + (^java.lang.Boolean [^java.time.format.TextStyle this ^java.lang.Object other] + (.equals this other))) diff --git a/src/cljc/java_time/format/text_style.cljs b/src/cljc/java_time/format/text_style.cljs index f0a8f64..5ee270e 100644 --- a/src/cljc/java_time/format/text_style.cljs +++ b/src/cljc/java_time/format/text_style.cljs @@ -1,19 +1,147 @@ -(ns cljc.java-time.format.text-style (:refer-clojure :exclude [abs get range format min max next name resolve short]) (:require [cljc.java-time.extn.calendar-awareness] [goog.object] [java.time.format :refer [TextStyle]])) -(def short (goog.object/get java.time.format.TextStyle "SHORT")) -(def full-standalone (goog.object/get java.time.format.TextStyle "FULL_STANDALONE")) -(def full (goog.object/get java.time.format.TextStyle "FULL")) -(def short-standalone (goog.object/get java.time.format.TextStyle "SHORT_STANDALONE")) -(def narrow (goog.object/get java.time.format.TextStyle "NARROW")) -(def narrow-standalone (goog.object/get java.time.format.TextStyle "NARROW_STANDALONE")) -(clojure.core/defn values {:arglists (quote ([]))} (^"java.lang.Class" [] (js-invoke java.time.format.TextStyle "values"))) -(clojure.core/defn value-of {:arglists (quote (["java.lang.String"] ["java.lang.Class" "java.lang.String"]))} (^js/JSJoda.TextStyle [^java.lang.String java-lang-String16217] (js-invoke java.time.format.TextStyle "valueOf" java-lang-String16217)) (^java.lang.Enum [^java.lang.Class java-lang-Class16218 ^java.lang.String java-lang-String16219] (js-invoke java.time.format.TextStyle "valueOf" java-lang-Class16218 java-lang-String16219))) -(clojure.core/defn ordinal {:arglists (quote (["java.time.format.TextStyle"]))} (^int [^js/JSJoda.TextStyle this16220] (.ordinal this16220))) -(clojure.core/defn as-standalone {:arglists (quote (["java.time.format.TextStyle"]))} (^js/JSJoda.TextStyle [^js/JSJoda.TextStyle this16221] (.asStandalone this16221))) -(clojure.core/defn to-string {:arglists (quote (["java.time.format.TextStyle"]))} (^java.lang.String [^js/JSJoda.TextStyle this16222] (.toString this16222))) -(clojure.core/defn name {:arglists (quote (["java.time.format.TextStyle"]))} (^java.lang.String [^js/JSJoda.TextStyle this16223] (.name this16223))) -(clojure.core/defn get-declaring-class {:arglists (quote (["java.time.format.TextStyle"]))} (^java.lang.Class [^js/JSJoda.TextStyle this16224] (.declaringClass this16224))) -(clojure.core/defn as-normal {:arglists (quote (["java.time.format.TextStyle"]))} (^js/JSJoda.TextStyle [^js/JSJoda.TextStyle this16225] (.asNormal this16225))) -(clojure.core/defn hash-code {:arglists (quote (["java.time.format.TextStyle"]))} (^int [^js/JSJoda.TextStyle this16226] (.hashCode this16226))) -(clojure.core/defn compare-to {:arglists (quote (["java.time.format.TextStyle" "java.lang.Enum"]))} (^int [^js/JSJoda.TextStyle this16227 ^java.lang.Enum java-lang-Enum16228] (.compareTo this16227 java-lang-Enum16228))) -(clojure.core/defn is-standalone {:arglists (quote (["java.time.format.TextStyle"]))} (^boolean [^js/JSJoda.TextStyle this16229] (.isStandalone this16229))) -(clojure.core/defn equals {:arglists (quote (["java.time.format.TextStyle" "java.lang.Object"]))} (^boolean [^js/JSJoda.TextStyle this16230 ^java.lang.Object java-lang-Object16231] (.equals this16230 java-lang-Object16231))) +(ns cljc.java-time.format.text-style + (:refer-clojure :exclude + [abs get range format min max next name resolve short]) + (:require [cljc.java-time.extn.calendar-awareness] + [goog.object] + [java.time.format :refer [TextStyle]])) + +(def short + "Short text, typically an abbreviation. + For example, day-of-week Monday might output \"Mon\"." + (goog.object/get java.time.format.TextStyle "SHORT")) + +(def full-standalone + "Full text for stand-alone use, typically the full description. + For example, day-of-week Monday might output \"Monday\"." + (goog.object/get java.time.format.TextStyle "FULL_STANDALONE")) + +(def full + "Full text, typically the full description. + For example, day-of-week Monday might output \"Monday\"." + (goog.object/get java.time.format.TextStyle "FULL")) + +(def short-standalone + "Short text for stand-alone use, typically an abbreviation. + For example, day-of-week Monday might output \"Mon\"." + (goog.object/get java.time.format.TextStyle "SHORT_STANDALONE")) + +(def narrow + "Narrow text, typically a single letter. + For example, day-of-week Monday might output \"M\"." + (goog.object/get java.time.format.TextStyle "NARROW")) + +(def narrow-standalone + "Narrow text for stand-alone use, typically a single letter. + For example, day-of-week Monday might output \"M\"." + (goog.object/get java.time.format.TextStyle "NARROW_STANDALONE")) + +(defn values + {:arglists (quote ([]))} + (^"java.lang.Class" [] (js-invoke java.time.format.TextStyle "values"))) + +(defn value-of + {:arglists (quote (["java.lang.String"] + ["java.lang.Class" "java.lang.String"]))} + (^js/JSJoda.TextStyle [^java.lang.String name] + (js-invoke java.time.format.TextStyle "valueOf" name)) + (^java.lang.Enum [^java.lang.Class enum-type ^java.lang.String name] + (js-invoke java.time.format.TextStyle "valueOf" enum-type name))) + +(defn ordinal + "Returns the ordinal of this enumeration constant (its position + in its enum declaration, where the initial constant is assigned + an ordinal of zero). + + Most programmers will have no use for this method. It is + designed for use by sophisticated enum-based data structures, such + as {@link java.util.EnumSet} and {@link java.util.EnumMap}. + + @return the ordinal of this enumeration constant" + {:arglists (quote (["java.time.format.TextStyle"]))} + (^int [^js/JSJoda.TextStyle this] (.ordinal this))) + +(defn as-standalone + "Returns the stand-alone style with the same size. + @return the stand-alone style with the same size" + {:arglists (quote (["java.time.format.TextStyle"]))} + (^js/JSJoda.TextStyle [^js/JSJoda.TextStyle this] (.asStandalone this))) + +(defn to-string + "Returns the name of this enum constant, as contained in the + declaration. This method may be overridden, though it typically + isn't necessary or desirable. An enum type should override this + method when a more \"programmer-friendly\" string form exists. + + @return the name of this enum constant" + {:arglists (quote (["java.time.format.TextStyle"]))} + (^java.lang.String [^js/JSJoda.TextStyle this] (.toString this))) + +(defn name + "Returns the name of this enum constant, exactly as declared in its + enum declaration. + + Most programmers should use the {@link #toString} method in + preference to this one, as the toString method may return + a more user-friendly name. This method is designed primarily for + use in specialized situations where correctness depends on getting the + exact name, which will not vary from release to release. + + @return the name of this enum constant" + {:arglists (quote (["java.time.format.TextStyle"]))} + (^java.lang.String [^js/JSJoda.TextStyle this] (.name this))) + +(defn get-declaring-class + "Returns the Class object corresponding to this enum constant's + enum type. Two enum constants e1 and e2 are of the + same enum type if and only if + e1.getDeclaringClass() == e2.getDeclaringClass(). + (The value returned by this method may differ from the one returned + by the {@link Object#getClass} method for enum constants with + constant-specific class bodies.) + + @return the Class object corresponding to this enum constant's + enum type" + {:arglists (quote (["java.time.format.TextStyle"]))} + (^java.lang.Class [^js/JSJoda.TextStyle this] (.declaringClass this))) + +(defn as-normal + "Returns the normal style with the same size. + + @return the normal style with the same size" + {:arglists (quote (["java.time.format.TextStyle"]))} + (^js/JSJoda.TextStyle [^js/JSJoda.TextStyle this] (.asNormal this))) + +(defn hash-code + "Returns a hash code for this enum constant. + + @return a hash code for this enum constant." + {:arglists (quote (["java.time.format.TextStyle"]))} + (^int [^js/JSJoda.TextStyle this] (.hashCode this))) + +(defn compare-to + "Compares this enum with the specified object for order. Returns a + negative integer, zero, or a positive integer as this object is less + than, equal to, or greater than the specified object. + + Enum constants are only comparable to other enum constants of the + same enum type. The natural order implemented by this + method is the order in which the constants are declared." + {:arglists (quote (["java.time.format.TextStyle" "java.lang.Enum"]))} + (^int [^js/JSJoda.TextStyle this ^java.lang.Enum o] (.compareTo this o))) + +(defn is-standalone + "Returns true if the Style is a stand-alone style. + @return true if the style is a stand-alone style." + {:arglists (quote (["java.time.format.TextStyle"]))} + (^boolean [^js/JSJoda.TextStyle this] (.isStandalone this))) + +(defn equals + "Returns true if the specified object is equal to this + enum constant. + + @param other the object to be compared for equality with this object. + @return true if the specified object is equal to this + enum constant." + {:arglists (quote (["java.time.format.TextStyle" "java.lang.Object"]))} + (^boolean [^js/JSJoda.TextStyle this ^java.lang.Object other] + (.equals this other))) diff --git a/src/cljc/java_time/instant.clj b/src/cljc/java_time/instant.clj index 7e92ac8..ad22480 100644 --- a/src/cljc/java_time/instant.clj +++ b/src/cljc/java_time/instant.clj @@ -1,37 +1,577 @@ -(ns cljc.java-time.instant (:refer-clojure :exclude [abs get range format min max next name resolve short]) (:require [cljc.java-time.extn.calendar-awareness]) (:import [java.time Instant])) -(def min java.time.Instant/MIN) -(def epoch java.time.Instant/EPOCH) -(def max java.time.Instant/MAX) -(clojure.core/defn truncated-to {:arglists (quote (["java.time.Instant" "java.time.temporal.TemporalUnit"]))} (^java.time.Instant [^java.time.Instant this14054 ^java.time.temporal.ChronoUnit java-time-temporal-TemporalUnit14055] (.truncatedTo this14054 java-time-temporal-TemporalUnit14055))) -(clojure.core/defn range {:arglists (quote (["java.time.Instant" "java.time.temporal.TemporalField"]))} (^java.time.temporal.ValueRange [^java.time.Instant this14056 ^java.time.temporal.TemporalField java-time-temporal-TemporalField14057] (cljc.java-time.extn.calendar-awareness/calendar-aware-clj (.range this14056 java-time-temporal-TemporalField14057)))) -(clojure.core/defn of-epoch-second {:arglists (quote (["long" "long"] ["long"]))} (^java.time.Instant [^long long14058 ^long long14059] (java.time.Instant/ofEpochSecond long14058 long14059)) (^java.time.Instant [^long long14060] (java.time.Instant/ofEpochSecond long14060))) -(clojure.core/defn at-offset {:arglists (quote (["java.time.Instant" "java.time.ZoneOffset"]))} (^java.time.OffsetDateTime [^java.time.Instant this14061 ^java.time.ZoneOffset java-time-ZoneOffset14062] (.atOffset this14061 java-time-ZoneOffset14062))) -(clojure.core/defn minus-millis {:arglists (quote (["java.time.Instant" "long"]))} (^java.time.Instant [^java.time.Instant this14063 ^long long14064] (.minusMillis this14063 long14064))) -(clojure.core/defn get-nano {:arglists (quote (["java.time.Instant"]))} (^java.lang.Integer [^java.time.Instant this14065] (.getNano this14065))) -(clojure.core/defn plus-millis {:arglists (quote (["java.time.Instant" "long"]))} (^java.time.Instant [^java.time.Instant this14066 ^long long14067] (.plusMillis this14066 long14067))) -(clojure.core/defn minus-seconds {:arglists (quote (["java.time.Instant" "long"]))} (^java.time.Instant [^java.time.Instant this14068 ^long long14069] (.minusSeconds this14068 long14069))) -(clojure.core/defn plus-nanos {:arglists (quote (["java.time.Instant" "long"]))} (^java.time.Instant [^java.time.Instant this14070 ^long long14071] (.plusNanos this14070 long14071))) -(clojure.core/defn plus {:arglists (quote (["java.time.Instant" "java.time.temporal.TemporalAmount"] ["java.time.Instant" "long" "java.time.temporal.TemporalUnit"]))} (^java.time.Instant [^java.time.Instant this14072 ^java.time.temporal.TemporalAmount java-time-temporal-TemporalAmount14073] (cljc.java-time.extn.calendar-awareness/calendar-aware-clj (.plus this14072 java-time-temporal-TemporalAmount14073))) (^java.time.Instant [^java.time.Instant this14074 ^long long14075 ^java.time.temporal.ChronoUnit java-time-temporal-TemporalUnit14076] (cljc.java-time.extn.calendar-awareness/calendar-aware-clj (.plus this14074 long14075 java-time-temporal-TemporalUnit14076)))) -(clojure.core/defn query {:arglists (quote (["java.time.Instant" "java.time.temporal.TemporalQuery"]))} (^java.lang.Object [^java.time.Instant this14077 ^java.time.temporal.TemporalQuery java-time-temporal-TemporalQuery14078] (.query this14077 java-time-temporal-TemporalQuery14078))) -(clojure.core/defn to-string {:arglists (quote (["java.time.Instant"]))} (^java.lang.String [^java.time.Instant this14079] (.toString this14079))) -(clojure.core/defn is-before {:arglists (quote (["java.time.Instant" "java.time.Instant"]))} (^java.lang.Boolean [^java.time.Instant this14080 ^java.time.Instant java-time-Instant14081] (.isBefore this14080 java-time-Instant14081))) -(clojure.core/defn minus {:arglists (quote (["java.time.Instant" "java.time.temporal.TemporalAmount"] ["java.time.Instant" "long" "java.time.temporal.TemporalUnit"]))} (^java.time.Instant [^java.time.Instant this14082 ^java.time.temporal.TemporalAmount java-time-temporal-TemporalAmount14083] (cljc.java-time.extn.calendar-awareness/calendar-aware-clj (.minus this14082 java-time-temporal-TemporalAmount14083))) (^java.time.Instant [^java.time.Instant this14084 ^long long14085 ^java.time.temporal.ChronoUnit java-time-temporal-TemporalUnit14086] (cljc.java-time.extn.calendar-awareness/calendar-aware-clj (.minus this14084 long14085 java-time-temporal-TemporalUnit14086)))) -(clojure.core/defn at-zone {:arglists (quote (["java.time.Instant" "java.time.ZoneId"]))} (^java.time.ZonedDateTime [^java.time.Instant this14087 ^java.time.ZoneId java-time-ZoneId14088] (.atZone this14087 java-time-ZoneId14088))) -(clojure.core/defn of-epoch-milli {:arglists (quote (["long"]))} (^java.time.Instant [^long long14089] (java.time.Instant/ofEpochMilli long14089))) -(clojure.core/defn get-long {:arglists (quote (["java.time.Instant" "java.time.temporal.TemporalField"]))} (^long [^java.time.Instant this14090 ^java.time.temporal.TemporalField java-time-temporal-TemporalField14091] (.getLong this14090 java-time-temporal-TemporalField14091))) -(clojure.core/defn until {:arglists (quote (["java.time.Instant" "java.time.temporal.Temporal" "java.time.temporal.TemporalUnit"]))} (^long [^java.time.Instant this14092 ^java.time.temporal.Temporal java-time-temporal-Temporal14093 ^java.time.temporal.ChronoUnit java-time-temporal-TemporalUnit14094] (cljc.java-time.extn.calendar-awareness/calendar-aware-clj (.until this14092 java-time-temporal-Temporal14093 java-time-temporal-TemporalUnit14094)))) -(clojure.core/defn from {:arglists (quote (["java.time.temporal.TemporalAccessor"]))} (^java.time.Instant [^java.time.temporal.TemporalAccessor java-time-temporal-TemporalAccessor14095] (cljc.java-time.extn.calendar-awareness/calendar-aware-clj (java.time.Instant/from java-time-temporal-TemporalAccessor14095)))) -(clojure.core/defn is-after {:arglists (quote (["java.time.Instant" "java.time.Instant"]))} (^java.lang.Boolean [^java.time.Instant this14096 ^java.time.Instant java-time-Instant14097] (.isAfter this14096 java-time-Instant14097))) -(clojure.core/defn minus-nanos {:arglists (quote (["java.time.Instant" "long"]))} (^java.time.Instant [^java.time.Instant this14098 ^long long14099] (.minusNanos this14098 long14099))) -(clojure.core/defn is-supported {:arglists (quote (["java.time.Instant" "java.time.temporal.TemporalField"] ["java.time.Instant" "java.time.temporal.TemporalUnit"]))} (^java.lang.Boolean [this14100 G__14101] (clojure.core/cond (clojure.core/and (clojure.core/instance? java.time.temporal.TemporalField G__14101)) (clojure.core/let [G__14101 ^"java.time.temporal.TemporalField" G__14101] (.isSupported ^java.time.Instant this14100 G__14101)) (clojure.core/and (clojure.core/instance? java.time.temporal.ChronoUnit G__14101)) (clojure.core/let [G__14101 ^"java.time.temporal.ChronoUnit" G__14101] (.isSupported ^java.time.Instant this14100 G__14101)) :else (throw (java.lang.IllegalArgumentException. "no corresponding java.time method with these args"))))) -(clojure.core/defn parse {:arglists (quote (["java.lang.CharSequence"]))} (^java.time.Instant [^java.lang.CharSequence java-lang-CharSequence14102] (java.time.Instant/parse java-lang-CharSequence14102))) -(clojure.core/defn hash-code {:arglists (quote (["java.time.Instant"]))} (^java.lang.Integer [^java.time.Instant this14103] (.hashCode this14103))) -(clojure.core/defn adjust-into {:arglists (quote (["java.time.Instant" "java.time.temporal.Temporal"]))} (^java.time.temporal.Temporal [^java.time.Instant this14104 ^java.time.temporal.Temporal java-time-temporal-Temporal14105] (cljc.java-time.extn.calendar-awareness/calendar-aware-clj (.adjustInto this14104 java-time-temporal-Temporal14105)))) -(clojure.core/defn with {:arglists (quote (["java.time.Instant" "java.time.temporal.TemporalField" "long"] ["java.time.Instant" "java.time.temporal.TemporalAdjuster"]))} (^java.time.Instant [^java.time.Instant this14106 ^java.time.temporal.TemporalField java-time-temporal-TemporalField14107 ^long long14108] (cljc.java-time.extn.calendar-awareness/calendar-aware-clj (.with this14106 java-time-temporal-TemporalField14107 long14108))) (^java.time.Instant [^java.time.Instant this14109 ^java.time.temporal.TemporalAdjuster java-time-temporal-TemporalAdjuster14110] (cljc.java-time.extn.calendar-awareness/calendar-aware-clj (.with this14109 java-time-temporal-TemporalAdjuster14110)))) -(clojure.core/defn now {:arglists (quote ([] ["java.time.Clock"]))} (^java.time.Instant [] (java.time.Instant/now)) (^java.time.Instant [^java.time.Clock java-time-Clock14111] (java.time.Instant/now java-time-Clock14111))) -(clojure.core/defn to-epoch-milli {:arglists (quote (["java.time.Instant"]))} (^long [^java.time.Instant this14112] (.toEpochMilli this14112))) -(clojure.core/defn get-epoch-second {:arglists (quote (["java.time.Instant"]))} (^long [^java.time.Instant this14113] (.getEpochSecond this14113))) -(clojure.core/defn compare-to {:arglists (quote (["java.time.Instant" "java.time.Instant"]))} (^java.lang.Integer [^java.time.Instant this14114 ^java.time.Instant java-time-Instant14115] (.compareTo this14114 java-time-Instant14115))) -(clojure.core/defn plus-seconds {:arglists (quote (["java.time.Instant" "long"]))} (^java.time.Instant [^java.time.Instant this14116 ^long long14117] (.plusSeconds this14116 long14117))) -(clojure.core/defn get {:arglists (quote (["java.time.Instant" "java.time.temporal.TemporalField"]))} (^java.lang.Integer [^java.time.Instant this14118 ^java.time.temporal.TemporalField java-time-temporal-TemporalField14119] (cljc.java-time.extn.calendar-awareness/calendar-aware-clj (.get this14118 java-time-temporal-TemporalField14119)))) -(clojure.core/defn equals {:arglists (quote (["java.time.Instant" "java.lang.Object"]))} (^java.lang.Boolean [^java.time.Instant this14120 ^java.lang.Object java-lang-Object14121] (.equals this14120 java-lang-Object14121))) +(ns cljc.java-time.instant + (:refer-clojure :exclude + [abs get range format min max next name resolve short]) + (:require [cljc.java-time.extn.calendar-awareness]) + (:import [java.time Instant])) + +(def min + "The minimum supported {@code Instant}, '-1000000000-01-01T00:00Z'. + This could be used by an application as a \"far past\" instant. + + This is one year earlier than the minimum {@code LocalDateTime}. + This provides sufficient values to handle the range of {@code ZoneOffset} + which affect the instant in addition to the local date-time. + The value is also chosen such that the value of the year fits in + an {@code int}." + java.time.Instant/MIN) + +(def epoch + "Constant for the 1970-01-01T00:00:00Z epoch instant." + java.time.Instant/EPOCH) + +(def max + "The maximum supported {@code Instant}, '1000000000-12-31T23:59:59.999999999Z'. + This could be used by an application as a \"far future\" instant. + + This is one year later than the maximum {@code LocalDateTime}. + This provides sufficient values to handle the range of {@code ZoneOffset} + which affect the instant in addition to the local date-time. + The value is also chosen such that the value of the year fits in + an {@code int}." + java.time.Instant/MAX) + +(defn truncated-to + "Returns a copy of this {@code Instant} truncated to the specified unit. + + Truncating the instant returns a copy of the original with fields + smaller than the specified unit set to zero. + The fields are calculated on the basis of using a UTC offset as seen + in {@code toString}. + For example, truncating with the {@link ChronoUnit#MINUTES MINUTES} unit will + round down to the nearest minute, setting the seconds and nanoseconds to zero. + + The unit must have a {@linkplain TemporalUnit#getDuration() duration} + that divides into the length of a standard day without remainder. + This includes all supplied time units on {@link ChronoUnit} and + {@link ChronoUnit#DAYS DAYS}. Other units throw an exception. + + This instance is immutable and unaffected by this method call. + + @param unit the unit to truncate to, not null + @return an {@code Instant} based on this instant with the time truncated, not null + @throws DateTimeException if the unit is invalid for truncation + @throws UnsupportedTemporalTypeException if the unit is not supported" + {:arglists (quote (["java.time.Instant" "java.time.temporal.TemporalUnit"]))} + (^java.time.Instant + [^java.time.Instant this ^java.time.temporal.ChronoUnit unit] + (.truncatedTo this unit))) + +(defn range + "Gets the range of valid values for the specified field. + + The range object expresses the minimum and maximum valid values for a field. + This instant is used to enhance the accuracy of the returned range. + If it is not possible to return the range, because the field is not supported + or for some other reason, an exception is thrown. + + If the field is a {@link ChronoField} then the query is implemented here. + The {@link #isSupported(TemporalField) supported fields} will return + appropriate range instances. + All other {@code ChronoField} instances will throw an {@code UnsupportedTemporalTypeException}. + + If the field is not a {@code ChronoField}, then the result of this method + is obtained by invoking {@code TemporalField.rangeRefinedBy(TemporalAccessor)} + passing {@code this} as the argument. + Whether the range can be obtained is determined by the field. + + @param field the field to query the range for, not null + @return the range of valid values for the field, not null + @throws DateTimeException if the range for the field cannot be obtained + @throws UnsupportedTemporalTypeException if the field is not supported" + {:arglists (quote (["java.time.Instant" "java.time.temporal.TemporalField"]))} + (^java.time.temporal.ValueRange + [^java.time.Instant this ^java.time.temporal.TemporalField field] + (cljc.java-time.extn.calendar-awareness/calendar-aware-clj (.range this + field)))) + +(defn of-epoch-second + {:arglists (quote (["long"] ["long" "long"]))} + (^java.time.Instant [^long epoch-second] + (java.time.Instant/ofEpochSecond epoch-second)) + (^java.time.Instant [^long epoch-second ^long nano-adjustment] + (java.time.Instant/ofEpochSecond epoch-second nano-adjustment))) + +(defn at-offset + "Combines this instant with an offset to create an {@code OffsetDateTime}. + + This returns an {@code OffsetDateTime} formed from this instant at the + specified offset from UTC/Greenwich. An exception will be thrown if the + instant is too large to fit into an offset date-time. + + This method is equivalent to + {@link OffsetDateTime#ofInstant(Instant, ZoneId) OffsetDateTime.ofInstant(this, offset)}. + + @param offset the offset to combine with, not null + @return the offset date-time formed from this instant and the specified offset, not null + @throws DateTimeException if the result exceeds the supported range" + {:arglists (quote (["java.time.Instant" "java.time.ZoneOffset"]))} + (^java.time.OffsetDateTime + [^java.time.Instant this ^java.time.ZoneOffset offset] + (.atOffset this offset))) + +(defn minus-millis + "Returns a copy of this instant with the specified duration in milliseconds subtracted. + + This instance is immutable and unaffected by this method call. + + @param millisToSubtract the milliseconds to subtract, positive or negative + @return an {@code Instant} based on this instant with the specified milliseconds subtracted, not null + @throws DateTimeException if the result exceeds the maximum or minimum instant + @throws ArithmeticException if numeric overflow occurs" + {:arglists (quote (["java.time.Instant" "long"]))} + (^java.time.Instant [^java.time.Instant this ^long millis-to-subtract] + (.minusMillis this millis-to-subtract))) + +(defn get-nano + "Gets the number of nanoseconds, later along the time-line, from the start + of the second. + + The nanosecond-of-second value measures the total number of nanoseconds from + the second returned by {@code getEpochSecond}. + + @return the nanoseconds within the second, always positive, never exceeds 999,999,999" + {:arglists (quote (["java.time.Instant"]))} + (^java.lang.Integer [^java.time.Instant this] (.getNano this))) + +(defn plus-millis + "Returns a copy of this instant with the specified duration in milliseconds added. + + This instance is immutable and unaffected by this method call. + + @param millisToAdd the milliseconds to add, positive or negative + @return an {@code Instant} based on this instant with the specified milliseconds added, not null + @throws DateTimeException if the result exceeds the maximum or minimum instant + @throws ArithmeticException if numeric overflow occurs" + {:arglists (quote (["java.time.Instant" "long"]))} + (^java.time.Instant [^java.time.Instant this ^long millis-to-add] + (.plusMillis this millis-to-add))) + +(defn minus-seconds + "Returns a copy of this instant with the specified duration in seconds subtracted. + + This instance is immutable and unaffected by this method call. + + @param secondsToSubtract the seconds to subtract, positive or negative + @return an {@code Instant} based on this instant with the specified seconds subtracted, not null + @throws DateTimeException if the result exceeds the maximum or minimum instant + @throws ArithmeticException if numeric overflow occurs" + {:arglists (quote (["java.time.Instant" "long"]))} + (^java.time.Instant [^java.time.Instant this ^long seconds-to-subtract] + (.minusSeconds this seconds-to-subtract))) + +(defn plus-nanos + "Returns a copy of this instant with the specified duration in nanoseconds added. + + This instance is immutable and unaffected by this method call. + + @param nanosToAdd the nanoseconds to add, positive or negative + @return an {@code Instant} based on this instant with the specified nanoseconds added, not null + @throws DateTimeException if the result exceeds the maximum or minimum instant + @throws ArithmeticException if numeric overflow occurs" + {:arglists (quote (["java.time.Instant" "long"]))} + (^java.time.Instant [^java.time.Instant this ^long nanos-to-add] + (.plusNanos this nanos-to-add))) + +(defn plus + {:arglists (quote (["java.time.Instant" "java.time.temporal.TemporalAmount"] + ["java.time.Instant" "long" + "java.time.temporal.TemporalUnit"]))} + (^java.time.Instant + [^java.time.Instant this ^java.time.temporal.TemporalAmount amount-to-add] + (cljc.java-time.extn.calendar-awareness/calendar-aware-clj + (.plus this amount-to-add))) + (^java.time.Instant + [^java.time.Instant this ^long amount-to-add + ^java.time.temporal.ChronoUnit unit] + (cljc.java-time.extn.calendar-awareness/calendar-aware-clj + (.plus this amount-to-add unit)))) + +(defn query + "Queries this instant using the specified query. + + This queries this instant using the specified query strategy object. + The {@code TemporalQuery} object defines the logic to be used to + obtain the result. Read the documentation of the query to understand + what the result of this method will be. + + The result of this method is obtained by invoking the + {@link TemporalQuery#queryFrom(TemporalAccessor)} method on the + specified query passing {@code this} as the argument. + + @param the type of the result + @param query the query to invoke, not null + @return the query result, null may be returned (defined by the query) + @throws DateTimeException if unable to query (defined by the query) + @throws ArithmeticException if numeric overflow occurs (defined by the query)" + {:arglists (quote (["java.time.Instant" "java.time.temporal.TemporalQuery"]))} + (^java.lang.Object + [^java.time.Instant this ^java.time.temporal.TemporalQuery query] + (.query this query))) + +(defn to-string + "A string representation of this instant using ISO-8601 representation. + + The format used is the same as {@link DateTimeFormatter#ISO_INSTANT}. + + @return an ISO-8601 representation of this instant, not null" + {:arglists (quote (["java.time.Instant"]))} + (^java.lang.String [^java.time.Instant this] (.toString this))) + +(defn is-before + "Checks if this instant is before the specified instant. + + The comparison is based on the time-line position of the instants. + + @param otherInstant the other instant to compare to, not null + @return true if this instant is before the specified instant + @throws NullPointerException if otherInstant is null" + {:arglists (quote (["java.time.Instant" "java.time.Instant"]))} + (^java.lang.Boolean [^java.time.Instant this ^java.time.Instant other-instant] + (.isBefore this other-instant))) + +(defn minus + {:arglists (quote (["java.time.Instant" "java.time.temporal.TemporalAmount"] + ["java.time.Instant" "long" + "java.time.temporal.TemporalUnit"]))} + (^java.time.Instant + [^java.time.Instant this + ^java.time.temporal.TemporalAmount amount-to-subtract] + (cljc.java-time.extn.calendar-awareness/calendar-aware-clj + (.minus this amount-to-subtract))) + (^java.time.Instant + [^java.time.Instant this ^long amount-to-subtract + ^java.time.temporal.ChronoUnit unit] + (cljc.java-time.extn.calendar-awareness/calendar-aware-clj + (.minus this amount-to-subtract unit)))) + +(defn at-zone + "Combines this instant with a time-zone to create a {@code ZonedDateTime}. + + This returns an {@code ZonedDateTime} formed from this instant at the + specified time-zone. An exception will be thrown if the instant is too + large to fit into a zoned date-time. + + This method is equivalent to + {@link ZonedDateTime#ofInstant(Instant, ZoneId) ZonedDateTime.ofInstant(this, zone)}. + + @param zone the zone to combine with, not null + @return the zoned date-time formed from this instant and the specified zone, not null + @throws DateTimeException if the result exceeds the supported range" + {:arglists (quote (["java.time.Instant" "java.time.ZoneId"]))} + (^java.time.ZonedDateTime [^java.time.Instant this ^java.time.ZoneId zone] + (.atZone this zone))) + +(defn of-epoch-milli + "Obtains an instance of {@code Instant} using milliseconds from the + epoch of 1970-01-01T00:00:00Z. + + The seconds and nanoseconds are extracted from the specified milliseconds. + + @param epochMilli the number of milliseconds from 1970-01-01T00:00:00Z + @return an instant, not null + @throws DateTimeException if the instant exceeds the maximum or minimum instant" + {:arglists (quote (["long"]))} + (^java.time.Instant [^long epoch-milli] + (java.time.Instant/ofEpochMilli epoch-milli))) + +(defn get-long + "Gets the value of the specified field from this instant as a {@code long}. + + This queries this instant for the value of the specified field. + If it is not possible to return the value, because the field is not supported + or for some other reason, an exception is thrown. + + If the field is a {@link ChronoField} then the query is implemented here. + The {@link #isSupported(TemporalField) supported fields} will return valid + values based on this date-time. + All other {@code ChronoField} instances will throw an {@code UnsupportedTemporalTypeException}. + + If the field is not a {@code ChronoField}, then the result of this method + is obtained by invoking {@code TemporalField.getFrom(TemporalAccessor)} + passing {@code this} as the argument. Whether the value can be obtained, + and what the value represents, is determined by the field. + + @param field the field to get, not null + @return the value for the field + @throws DateTimeException if a value for the field cannot be obtained + @throws UnsupportedTemporalTypeException if the field is not supported + @throws ArithmeticException if numeric overflow occurs" + {:arglists (quote (["java.time.Instant" "java.time.temporal.TemporalField"]))} + (^long [^java.time.Instant this ^java.time.temporal.TemporalField field] + (.getLong this field))) + +(defn until + "Calculates the amount of time until another instant in terms of the specified unit. + + This calculates the amount of time between two {@code Instant} + objects in terms of a single {@code TemporalUnit}. + The start and end points are {@code this} and the specified instant. + The result will be negative if the end is before the start. + The calculation returns a whole number, representing the number of + complete units between the two instants. + The {@code Temporal} passed to this method is converted to a + {@code Instant} using {@link #from(TemporalAccessor)}. + For example, the amount in days between two dates can be calculated + using {@code startInstant.until(endInstant, SECONDS)}. + + There are two equivalent ways of using this method. + The first is to invoke this method. + The second is to use {@link TemporalUnit#between(Temporal, Temporal)}: +
+   // these two lines are equivalent
+   amount = start.until(end, SECONDS);
+   amount = SECONDS.between(start, end);
+ 
+ The choice should be made based on which makes the code more readable. + + The calculation is implemented in this method for {@link ChronoUnit}. + The units {@code NANOS}, {@code MICROS}, {@code MILLIS}, {@code SECONDS}, + {@code MINUTES}, {@code HOURS}, {@code HALF_DAYS} and {@code DAYS} + are supported. Other {@code ChronoUnit} values will throw an exception. + + If the unit is not a {@code ChronoUnit}, then the result of this method + is obtained by invoking {@code TemporalUnit.between(Temporal, Temporal)} + passing {@code this} as the first argument and the converted input temporal + as the second argument. + + This instance is immutable and unaffected by this method call. + + @param endExclusive the end date, exclusive, which is converted to an {@code Instant}, not null + @param unit the unit to measure the amount in, not null + @return the amount of time between this instant and the end instant + @throws DateTimeException if the amount cannot be calculated, or the end + temporal cannot be converted to an {@code Instant} + @throws UnsupportedTemporalTypeException if the unit is not supported + @throws ArithmeticException if numeric overflow occurs" + {:arglists (quote (["java.time.Instant" "java.time.temporal.Temporal" + "java.time.temporal.TemporalUnit"]))} + (^long + [^java.time.Instant this ^java.time.temporal.Temporal end-exclusive + ^java.time.temporal.ChronoUnit unit] + (cljc.java-time.extn.calendar-awareness/calendar-aware-clj + (.until this end-exclusive unit)))) + +(defn from + "Obtains an instance of {@code Instant} from a temporal object. + + This obtains an instant based on the specified temporal. + A {@code TemporalAccessor} represents an arbitrary set of date and time information, + which this factory converts to an instance of {@code Instant}. + + The conversion extracts the {@link ChronoField#INSTANT_SECONDS INSTANT_SECONDS} + and {@link ChronoField#NANO_OF_SECOND NANO_OF_SECOND} fields. + + This method matches the signature of the functional interface {@link TemporalQuery} + allowing it to be used as a query via method reference, {@code Instant::from}. + + @param temporal the temporal object to convert, not null + @return the instant, not null + @throws DateTimeException if unable to convert to an {@code Instant}" + {:arglists (quote (["java.time.temporal.TemporalAccessor"]))} + (^java.time.Instant [^java.time.temporal.TemporalAccessor temporal] + (cljc.java-time.extn.calendar-awareness/calendar-aware-clj + (java.time.Instant/from temporal)))) + +(defn is-after + "Checks if this instant is after the specified instant. + + The comparison is based on the time-line position of the instants. + + @param otherInstant the other instant to compare to, not null + @return true if this instant is after the specified instant + @throws NullPointerException if otherInstant is null" + {:arglists (quote (["java.time.Instant" "java.time.Instant"]))} + (^java.lang.Boolean [^java.time.Instant this ^java.time.Instant other-instant] + (.isAfter this other-instant))) + +(defn minus-nanos + "Returns a copy of this instant with the specified duration in nanoseconds subtracted. + + This instance is immutable and unaffected by this method call. + + @param nanosToSubtract the nanoseconds to subtract, positive or negative + @return an {@code Instant} based on this instant with the specified nanoseconds subtracted, not null + @throws DateTimeException if the result exceeds the maximum or minimum instant + @throws ArithmeticException if numeric overflow occurs" + {:arglists (quote (["java.time.Instant" "long"]))} + (^java.time.Instant [^java.time.Instant this ^long nanos-to-subtract] + (.minusNanos this nanos-to-subtract))) + +(defn is-supported + {:arglists (quote (["java.time.Instant" "java.time.temporal.TemporalField"] + ["java.time.Instant" "java.time.temporal.TemporalUnit"]))} + (^java.lang.Boolean [^java.time.Instant this arg0] + (cond (instance? java.time.temporal.TemporalField arg0) + (let [^java.time.temporal.TemporalField field arg0] + (.isSupported this field)) + (instance? java.time.temporal.ChronoUnit arg0) + (let [^java.time.temporal.TemporalUnit unit arg0] + (.isSupported this unit)) + :else (throw (java.lang.IllegalArgumentException. + "no corresponding java.time method with these args"))))) + +(defn parse + "Obtains an instance of {@code Instant} from a text string such as + {@code 2007-12-03T10:15:30.00Z}. + + The string must represent a valid instant in UTC and is parsed using + {@link DateTimeFormatter#ISO_INSTANT}. + + @param text the text to parse, not null + @return the parsed instant, not null + @throws DateTimeParseException if the text cannot be parsed" + {:arglists (quote (["java.lang.CharSequence"]))} + (^java.time.Instant [^java.lang.CharSequence text] + (java.time.Instant/parse text))) + +(defn hash-code + "Returns a hash code for this instant. + + @return a suitable hash code" + {:arglists (quote (["java.time.Instant"]))} + (^java.lang.Integer [^java.time.Instant this] (.hashCode this))) + +(defn adjust-into + "Adjusts the specified temporal object to have this instant. + + This returns a temporal object of the same observable type as the input + with the instant changed to be the same as this. + + The adjustment is equivalent to using {@link Temporal#with(TemporalField, long)} + twice, passing {@link ChronoField#INSTANT_SECONDS} and + {@link ChronoField#NANO_OF_SECOND} as the fields. + + In most cases, it is clearer to reverse the calling pattern by using + {@link Temporal#with(TemporalAdjuster)}: +
+   // these two lines are equivalent, but the second approach is recommended
+   temporal = thisInstant.adjustInto(temporal);
+   temporal = temporal.with(thisInstant);
+ 
+ + This instance is immutable and unaffected by this method call. + + @param temporal the target object to be adjusted, not null + @return the adjusted object, not null + @throws DateTimeException if unable to make the adjustment + @throws ArithmeticException if numeric overflow occurs" + {:arglists (quote (["java.time.Instant" "java.time.temporal.Temporal"]))} + (^java.time.temporal.Temporal + [^java.time.Instant this ^java.time.temporal.Temporal temporal] + (cljc.java-time.extn.calendar-awareness/calendar-aware-clj + (.adjustInto this temporal)))) + +(defn with + {:arglists (quote (["java.time.Instant" "java.time.temporal.TemporalAdjuster"] + ["java.time.Instant" "java.time.temporal.TemporalField" + "long"]))} + (^java.time.Instant + [^java.time.Instant this ^java.time.temporal.TemporalAdjuster adjuster] + (cljc.java-time.extn.calendar-awareness/calendar-aware-clj (.with this + adjuster))) + (^java.time.Instant + [^java.time.Instant this ^java.time.temporal.TemporalField field + ^long new-value] + (cljc.java-time.extn.calendar-awareness/calendar-aware-clj + (.with this field new-value)))) + +(defn now + {:arglists (quote ([] ["java.time.Clock"]))} + (^java.time.Instant [] (java.time.Instant/now)) + (^java.time.Instant [^java.time.Clock clock] (java.time.Instant/now clock))) + +(defn to-epoch-milli + "Converts this instant to the number of milliseconds from the epoch + of 1970-01-01T00:00:00Z. + + If this instant represents a point on the time-line too far in the future + or past to fit in a {@code long} milliseconds, then an exception is thrown. + + If this instant has greater than millisecond precision, then the conversion + will drop any excess precision information as though the amount in nanoseconds + was subject to integer division by one million. + + @return the number of milliseconds since the epoch of 1970-01-01T00:00:00Z + @throws ArithmeticException if numeric overflow occurs" + {:arglists (quote (["java.time.Instant"]))} + (^long [^java.time.Instant this] (.toEpochMilli this))) + +(defn get-epoch-second + "Gets the number of seconds from the Java epoch of 1970-01-01T00:00:00Z. + + The epoch second count is a simple incrementing count of seconds where + second 0 is 1970-01-01T00:00:00Z. + The nanosecond part of the day is returned by {@code getNanosOfSecond}. + + @return the seconds from the epoch of 1970-01-01T00:00:00Z" + {:arglists (quote (["java.time.Instant"]))} + (^long [^java.time.Instant this] (.getEpochSecond this))) + +(defn compare-to + "Compares this instant to the specified instant. + + The comparison is based on the time-line position of the instants. + It is \"consistent with equals\", as defined by {@link Comparable}. + + @param otherInstant the other instant to compare to, not null + @return the comparator value, negative if less, positive if greater + @throws NullPointerException if otherInstant is null" + {:arglists (quote (["java.time.Instant" "java.time.Instant"]))} + (^java.lang.Integer [^java.time.Instant this ^java.time.Instant other-instant] + (.compareTo this other-instant))) + +(defn plus-seconds + "Returns a copy of this instant with the specified duration in seconds added. + + This instance is immutable and unaffected by this method call. + + @param secondsToAdd the seconds to add, positive or negative + @return an {@code Instant} based on this instant with the specified seconds added, not null + @throws DateTimeException if the result exceeds the maximum or minimum instant + @throws ArithmeticException if numeric overflow occurs" + {:arglists (quote (["java.time.Instant" "long"]))} + (^java.time.Instant [^java.time.Instant this ^long seconds-to-add] + (.plusSeconds this seconds-to-add))) + +(defn get + "Gets the value of the specified field from this instant as an {@code int}. + + This queries this instant for the value of the specified field. + The returned value will always be within the valid range of values for the field. + If it is not possible to return the value, because the field is not supported + or for some other reason, an exception is thrown. + + If the field is a {@link ChronoField} then the query is implemented here. + The {@link #isSupported(TemporalField) supported fields} will return valid + values based on this date-time, except {@code INSTANT_SECONDS} which is too + large to fit in an {@code int} and throws a {@code DateTimeException}. + All other {@code ChronoField} instances will throw an {@code UnsupportedTemporalTypeException}. + + If the field is not a {@code ChronoField}, then the result of this method + is obtained by invoking {@code TemporalField.getFrom(TemporalAccessor)} + passing {@code this} as the argument. Whether the value can be obtained, + and what the value represents, is determined by the field. + + @param field the field to get, not null + @return the value for the field + @throws DateTimeException if a value for the field cannot be obtained or + the value is outside the range of valid values for the field + @throws UnsupportedTemporalTypeException if the field is not supported or + the range of values exceeds an {@code int} + @throws ArithmeticException if numeric overflow occurs" + {:arglists (quote (["java.time.Instant" "java.time.temporal.TemporalField"]))} + (^java.lang.Integer + [^java.time.Instant this ^java.time.temporal.TemporalField field] + (cljc.java-time.extn.calendar-awareness/calendar-aware-clj (.get this + field)))) + +(defn equals + "Checks if this instant is equal to the specified instant. + + The comparison is based on the time-line position of the instants. + + @param otherInstant the other instant, null returns false + @return true if the other instant is equal to this one" + {:arglists (quote (["java.time.Instant" "java.lang.Object"]))} + (^java.lang.Boolean [^java.time.Instant this ^java.lang.Object other-instant] + (.equals this other-instant))) diff --git a/src/cljc/java_time/instant.cljs b/src/cljc/java_time/instant.cljs index 895b83b..5f43c8d 100644 --- a/src/cljc/java_time/instant.cljs +++ b/src/cljc/java_time/instant.cljs @@ -1,37 +1,565 @@ -(ns cljc.java-time.instant (:refer-clojure :exclude [abs get range format min max next name resolve short]) (:require [cljc.java-time.extn.calendar-awareness] [goog.object] [java.time :refer [Instant]])) -(def min (goog.object/get java.time.Instant "MIN")) -(def epoch (goog.object/get java.time.Instant "EPOCH")) -(def max (goog.object/get java.time.Instant "MAX")) -(clojure.core/defn truncated-to {:arglists (quote (["java.time.Instant" "java.time.temporal.TemporalUnit"]))} (^js/JSJoda.Instant [^js/JSJoda.Instant this14122 ^js/JSJoda.TemporalUnit java-time-temporal-TemporalUnit14123] (.truncatedTo this14122 java-time-temporal-TemporalUnit14123))) -(clojure.core/defn range {:arglists (quote (["java.time.Instant" "java.time.temporal.TemporalField"]))} (^js/JSJoda.ValueRange [^js/JSJoda.Instant this14124 ^js/JSJoda.TemporalField java-time-temporal-TemporalField14125] (cljc.java-time.extn.calendar-awareness/calendar-aware-cljs (.range this14124 java-time-temporal-TemporalField14125)))) -(clojure.core/defn of-epoch-second {:arglists (quote (["long" "long"] ["long"]))} (^js/JSJoda.Instant [^long long14126 ^long long14127] (js-invoke java.time.Instant "ofEpochSecond" long14126 long14127)) (^js/JSJoda.Instant [^long long14128] (js-invoke java.time.Instant "ofEpochSecond" long14128))) -(clojure.core/defn at-offset {:arglists (quote (["java.time.Instant" "java.time.ZoneOffset"]))} (^js/JSJoda.OffsetDateTime [^js/JSJoda.Instant this14129 ^js/JSJoda.ZoneOffset java-time-ZoneOffset14130] (.atOffset this14129 java-time-ZoneOffset14130))) -(clojure.core/defn minus-millis {:arglists (quote (["java.time.Instant" "long"]))} (^js/JSJoda.Instant [^js/JSJoda.Instant this14131 ^long long14132] (.minusMillis this14131 long14132))) -(clojure.core/defn get-nano {:arglists (quote (["java.time.Instant"]))} (^int [^js/JSJoda.Instant this14133] (.nano this14133))) -(clojure.core/defn plus-millis {:arglists (quote (["java.time.Instant" "long"]))} (^js/JSJoda.Instant [^js/JSJoda.Instant this14134 ^long long14135] (.plusMillis this14134 long14135))) -(clojure.core/defn minus-seconds {:arglists (quote (["java.time.Instant" "long"]))} (^js/JSJoda.Instant [^js/JSJoda.Instant this14136 ^long long14137] (.minusSeconds this14136 long14137))) -(clojure.core/defn plus-nanos {:arglists (quote (["java.time.Instant" "long"]))} (^js/JSJoda.Instant [^js/JSJoda.Instant this14138 ^long long14139] (.plusNanos this14138 long14139))) -(clojure.core/defn plus {:arglists (quote (["java.time.Instant" "java.time.temporal.TemporalAmount"] ["java.time.Instant" "long" "java.time.temporal.TemporalUnit"]))} (^js/JSJoda.Instant [^js/JSJoda.Instant this14140 ^js/JSJoda.TemporalAmount java-time-temporal-TemporalAmount14141] (cljc.java-time.extn.calendar-awareness/calendar-aware-cljs (.plus this14140 java-time-temporal-TemporalAmount14141))) (^js/JSJoda.Instant [^js/JSJoda.Instant this14142 ^long long14143 ^js/JSJoda.TemporalUnit java-time-temporal-TemporalUnit14144] (cljc.java-time.extn.calendar-awareness/calendar-aware-cljs (.plus this14142 long14143 java-time-temporal-TemporalUnit14144)))) -(clojure.core/defn query {:arglists (quote (["java.time.Instant" "java.time.temporal.TemporalQuery"]))} (^java.lang.Object [^js/JSJoda.Instant this14145 ^js/JSJoda.TemporalQuery java-time-temporal-TemporalQuery14146] (.query this14145 java-time-temporal-TemporalQuery14146))) -(clojure.core/defn to-string {:arglists (quote (["java.time.Instant"]))} (^java.lang.String [^js/JSJoda.Instant this14147] (.toString this14147))) -(clojure.core/defn is-before {:arglists (quote (["java.time.Instant" "java.time.Instant"]))} (^boolean [^js/JSJoda.Instant this14148 ^js/JSJoda.Instant java-time-Instant14149] (.isBefore this14148 java-time-Instant14149))) -(clojure.core/defn minus {:arglists (quote (["java.time.Instant" "java.time.temporal.TemporalAmount"] ["java.time.Instant" "long" "java.time.temporal.TemporalUnit"]))} (^js/JSJoda.Instant [^js/JSJoda.Instant this14150 ^js/JSJoda.TemporalAmount java-time-temporal-TemporalAmount14151] (cljc.java-time.extn.calendar-awareness/calendar-aware-cljs (.minus this14150 java-time-temporal-TemporalAmount14151))) (^js/JSJoda.Instant [^js/JSJoda.Instant this14152 ^long long14153 ^js/JSJoda.TemporalUnit java-time-temporal-TemporalUnit14154] (cljc.java-time.extn.calendar-awareness/calendar-aware-cljs (.minus this14152 long14153 java-time-temporal-TemporalUnit14154)))) -(clojure.core/defn at-zone {:arglists (quote (["java.time.Instant" "java.time.ZoneId"]))} (^js/JSJoda.ZonedDateTime [^js/JSJoda.Instant this14155 ^js/JSJoda.ZoneId java-time-ZoneId14156] (.atZone this14155 java-time-ZoneId14156))) -(clojure.core/defn of-epoch-milli {:arglists (quote (["long"]))} (^js/JSJoda.Instant [^long long14157] (js-invoke java.time.Instant "ofEpochMilli" long14157))) -(clojure.core/defn get-long {:arglists (quote (["java.time.Instant" "java.time.temporal.TemporalField"]))} (^long [^js/JSJoda.Instant this14158 ^js/JSJoda.TemporalField java-time-temporal-TemporalField14159] (.getLong this14158 java-time-temporal-TemporalField14159))) -(clojure.core/defn until {:arglists (quote (["java.time.Instant" "java.time.temporal.Temporal" "java.time.temporal.TemporalUnit"]))} (^long [^js/JSJoda.Instant this14160 ^js/JSJoda.Temporal java-time-temporal-Temporal14161 ^js/JSJoda.TemporalUnit java-time-temporal-TemporalUnit14162] (cljc.java-time.extn.calendar-awareness/calendar-aware-cljs (.until this14160 java-time-temporal-Temporal14161 java-time-temporal-TemporalUnit14162)))) -(clojure.core/defn from {:arglists (quote (["java.time.temporal.TemporalAccessor"]))} (^js/JSJoda.Instant [^js/JSJoda.TemporalAccessor java-time-temporal-TemporalAccessor14163] (cljc.java-time.extn.calendar-awareness/calendar-aware-cljs (js-invoke java.time.Instant "from" java-time-temporal-TemporalAccessor14163)))) -(clojure.core/defn is-after {:arglists (quote (["java.time.Instant" "java.time.Instant"]))} (^boolean [^js/JSJoda.Instant this14164 ^js/JSJoda.Instant java-time-Instant14165] (.isAfter this14164 java-time-Instant14165))) -(clojure.core/defn minus-nanos {:arglists (quote (["java.time.Instant" "long"]))} (^js/JSJoda.Instant [^js/JSJoda.Instant this14166 ^long long14167] (.minusNanos this14166 long14167))) -(clojure.core/defn is-supported {:arglists (quote (["java.time.Instant" "java.time.temporal.TemporalField"] ["java.time.Instant" "java.time.temporal.TemporalUnit"]))} (^boolean [this14168 G__14169] (.isSupported ^js/JSJoda.Instant this14168 G__14169))) -(clojure.core/defn parse {:arglists (quote (["java.lang.CharSequence"]))} (^js/JSJoda.Instant [^java.lang.CharSequence java-lang-CharSequence14170] (js-invoke java.time.Instant "parse" java-lang-CharSequence14170))) -(clojure.core/defn hash-code {:arglists (quote (["java.time.Instant"]))} (^int [^js/JSJoda.Instant this14171] (.hashCode this14171))) -(clojure.core/defn adjust-into {:arglists (quote (["java.time.Instant" "java.time.temporal.Temporal"]))} (^js/JSJoda.Temporal [^js/JSJoda.Instant this14172 ^js/JSJoda.Temporal java-time-temporal-Temporal14173] (cljc.java-time.extn.calendar-awareness/calendar-aware-cljs (.adjustInto this14172 java-time-temporal-Temporal14173)))) -(clojure.core/defn with {:arglists (quote (["java.time.Instant" "java.time.temporal.TemporalField" "long"] ["java.time.Instant" "java.time.temporal.TemporalAdjuster"]))} (^js/JSJoda.Instant [^js/JSJoda.Instant this14174 ^js/JSJoda.TemporalField java-time-temporal-TemporalField14175 ^long long14176] (cljc.java-time.extn.calendar-awareness/calendar-aware-cljs (.with this14174 java-time-temporal-TemporalField14175 long14176))) (^js/JSJoda.Instant [^js/JSJoda.Instant this14177 ^js/JSJoda.TemporalAdjuster java-time-temporal-TemporalAdjuster14178] (cljc.java-time.extn.calendar-awareness/calendar-aware-cljs (.with this14177 java-time-temporal-TemporalAdjuster14178)))) -(clojure.core/defn now {:arglists (quote ([] ["java.time.Clock"]))} (^js/JSJoda.Instant [] (js-invoke java.time.Instant "now")) (^js/JSJoda.Instant [^js/JSJoda.Clock java-time-Clock14179] (js-invoke java.time.Instant "now" java-time-Clock14179))) -(clojure.core/defn to-epoch-milli {:arglists (quote (["java.time.Instant"]))} (^long [^js/JSJoda.Instant this14180] (.toEpochMilli this14180))) -(clojure.core/defn get-epoch-second {:arglists (quote (["java.time.Instant"]))} (^long [^js/JSJoda.Instant this14181] (.epochSecond this14181))) -(clojure.core/defn compare-to {:arglists (quote (["java.time.Instant" "java.time.Instant"]))} (^int [^js/JSJoda.Instant this14182 ^js/JSJoda.Instant java-time-Instant14183] (.compareTo this14182 java-time-Instant14183))) -(clojure.core/defn plus-seconds {:arglists (quote (["java.time.Instant" "long"]))} (^js/JSJoda.Instant [^js/JSJoda.Instant this14184 ^long long14185] (.plusSeconds this14184 long14185))) -(clojure.core/defn get {:arglists (quote (["java.time.Instant" "java.time.temporal.TemporalField"]))} (^int [^js/JSJoda.Instant this14186 ^js/JSJoda.TemporalField java-time-temporal-TemporalField14187] (cljc.java-time.extn.calendar-awareness/calendar-aware-cljs (.get this14186 java-time-temporal-TemporalField14187)))) -(clojure.core/defn equals {:arglists (quote (["java.time.Instant" "java.lang.Object"]))} (^boolean [^js/JSJoda.Instant this14188 ^java.lang.Object java-lang-Object14189] (.equals this14188 java-lang-Object14189))) +(ns cljc.java-time.instant + (:refer-clojure :exclude + [abs get range format min max next name resolve short]) + (:require [cljc.java-time.extn.calendar-awareness] + [goog.object] + [java.time :refer [Instant]])) + +(def min + "The minimum supported {@code Instant}, '-1000000000-01-01T00:00Z'. + This could be used by an application as a \"far past\" instant. + + This is one year earlier than the minimum {@code LocalDateTime}. + This provides sufficient values to handle the range of {@code ZoneOffset} + which affect the instant in addition to the local date-time. + The value is also chosen such that the value of the year fits in + an {@code int}." + (goog.object/get java.time.Instant "MIN")) + +(def epoch + "Constant for the 1970-01-01T00:00:00Z epoch instant." + (goog.object/get java.time.Instant "EPOCH")) + +(def max + "The maximum supported {@code Instant}, '1000000000-12-31T23:59:59.999999999Z'. + This could be used by an application as a \"far future\" instant. + + This is one year later than the maximum {@code LocalDateTime}. + This provides sufficient values to handle the range of {@code ZoneOffset} + which affect the instant in addition to the local date-time. + The value is also chosen such that the value of the year fits in + an {@code int}." + (goog.object/get java.time.Instant "MAX")) + +(defn truncated-to + "Returns a copy of this {@code Instant} truncated to the specified unit. + + Truncating the instant returns a copy of the original with fields + smaller than the specified unit set to zero. + The fields are calculated on the basis of using a UTC offset as seen + in {@code toString}. + For example, truncating with the {@link ChronoUnit#MINUTES MINUTES} unit will + round down to the nearest minute, setting the seconds and nanoseconds to zero. + + The unit must have a {@linkplain TemporalUnit#getDuration() duration} + that divides into the length of a standard day without remainder. + This includes all supplied time units on {@link ChronoUnit} and + {@link ChronoUnit#DAYS DAYS}. Other units throw an exception. + + This instance is immutable and unaffected by this method call. + + @param unit the unit to truncate to, not null + @return an {@code Instant} based on this instant with the time truncated, not null + @throws DateTimeException if the unit is invalid for truncation + @throws UnsupportedTemporalTypeException if the unit is not supported" + {:arglists (quote (["java.time.Instant" "java.time.temporal.TemporalUnit"]))} + (^js/JSJoda.Instant [^js/JSJoda.Instant this ^js/JSJoda.TemporalUnit unit] + (.truncatedTo this unit))) + +(defn range + "Gets the range of valid values for the specified field. + + The range object expresses the minimum and maximum valid values for a field. + This instant is used to enhance the accuracy of the returned range. + If it is not possible to return the range, because the field is not supported + or for some other reason, an exception is thrown. + + If the field is a {@link ChronoField} then the query is implemented here. + The {@link #isSupported(TemporalField) supported fields} will return + appropriate range instances. + All other {@code ChronoField} instances will throw an {@code UnsupportedTemporalTypeException}. + + If the field is not a {@code ChronoField}, then the result of this method + is obtained by invoking {@code TemporalField.rangeRefinedBy(TemporalAccessor)} + passing {@code this} as the argument. + Whether the range can be obtained is determined by the field. + + @param field the field to query the range for, not null + @return the range of valid values for the field, not null + @throws DateTimeException if the range for the field cannot be obtained + @throws UnsupportedTemporalTypeException if the field is not supported" + {:arglists (quote (["java.time.Instant" "java.time.temporal.TemporalField"]))} + (^js/JSJoda.ValueRange + [^js/JSJoda.Instant this ^js/JSJoda.TemporalField field] + (cljc.java-time.extn.calendar-awareness/calendar-aware-cljs (.range this + field)))) + +(defn of-epoch-second + {:arglists (quote (["long"] ["long" "long"]))} + (^js/JSJoda.Instant [^long epoch-second] + (js-invoke java.time.Instant "ofEpochSecond" epoch-second)) + (^js/JSJoda.Instant [^long epoch-second ^long nano-adjustment] + (js-invoke java.time.Instant "ofEpochSecond" epoch-second nano-adjustment))) + +(defn at-offset + "Combines this instant with an offset to create an {@code OffsetDateTime}. + + This returns an {@code OffsetDateTime} formed from this instant at the + specified offset from UTC/Greenwich. An exception will be thrown if the + instant is too large to fit into an offset date-time. + + This method is equivalent to + {@link OffsetDateTime#ofInstant(Instant, ZoneId) OffsetDateTime.ofInstant(this, offset)}. + + @param offset the offset to combine with, not null + @return the offset date-time formed from this instant and the specified offset, not null + @throws DateTimeException if the result exceeds the supported range" + {:arglists (quote (["java.time.Instant" "java.time.ZoneOffset"]))} + (^js/JSJoda.OffsetDateTime + [^js/JSJoda.Instant this ^js/JSJoda.ZoneOffset offset] + (.atOffset this offset))) + +(defn minus-millis + "Returns a copy of this instant with the specified duration in milliseconds subtracted. + + This instance is immutable and unaffected by this method call. + + @param millisToSubtract the milliseconds to subtract, positive or negative + @return an {@code Instant} based on this instant with the specified milliseconds subtracted, not null + @throws DateTimeException if the result exceeds the maximum or minimum instant + @throws ArithmeticException if numeric overflow occurs" + {:arglists (quote (["java.time.Instant" "long"]))} + (^js/JSJoda.Instant [^js/JSJoda.Instant this ^long millis-to-subtract] + (.minusMillis this millis-to-subtract))) + +(defn get-nano + "Gets the number of nanoseconds, later along the time-line, from the start + of the second. + + The nanosecond-of-second value measures the total number of nanoseconds from + the second returned by {@code getEpochSecond}. + + @return the nanoseconds within the second, always positive, never exceeds 999,999,999" + {:arglists (quote (["java.time.Instant"]))} + (^int [^js/JSJoda.Instant this] (.nano this))) + +(defn plus-millis + "Returns a copy of this instant with the specified duration in milliseconds added. + + This instance is immutable and unaffected by this method call. + + @param millisToAdd the milliseconds to add, positive or negative + @return an {@code Instant} based on this instant with the specified milliseconds added, not null + @throws DateTimeException if the result exceeds the maximum or minimum instant + @throws ArithmeticException if numeric overflow occurs" + {:arglists (quote (["java.time.Instant" "long"]))} + (^js/JSJoda.Instant [^js/JSJoda.Instant this ^long millis-to-add] + (.plusMillis this millis-to-add))) + +(defn minus-seconds + "Returns a copy of this instant with the specified duration in seconds subtracted. + + This instance is immutable and unaffected by this method call. + + @param secondsToSubtract the seconds to subtract, positive or negative + @return an {@code Instant} based on this instant with the specified seconds subtracted, not null + @throws DateTimeException if the result exceeds the maximum or minimum instant + @throws ArithmeticException if numeric overflow occurs" + {:arglists (quote (["java.time.Instant" "long"]))} + (^js/JSJoda.Instant [^js/JSJoda.Instant this ^long seconds-to-subtract] + (.minusSeconds this seconds-to-subtract))) + +(defn plus-nanos + "Returns a copy of this instant with the specified duration in nanoseconds added. + + This instance is immutable and unaffected by this method call. + + @param nanosToAdd the nanoseconds to add, positive or negative + @return an {@code Instant} based on this instant with the specified nanoseconds added, not null + @throws DateTimeException if the result exceeds the maximum or minimum instant + @throws ArithmeticException if numeric overflow occurs" + {:arglists (quote (["java.time.Instant" "long"]))} + (^js/JSJoda.Instant [^js/JSJoda.Instant this ^long nanos-to-add] + (.plusNanos this nanos-to-add))) + +(defn plus + {:arglists (quote (["java.time.Instant" "java.time.temporal.TemporalAmount"] + ["java.time.Instant" "long" + "java.time.temporal.TemporalUnit"]))} + (^js/JSJoda.Instant + [^js/JSJoda.Instant this ^js/JSJoda.TemporalAmount amount-to-add] + (cljc.java-time.extn.calendar-awareness/calendar-aware-cljs + (.plus this amount-to-add))) + (^js/JSJoda.Instant + [^js/JSJoda.Instant this ^long amount-to-add ^js/JSJoda.TemporalUnit unit] + (cljc.java-time.extn.calendar-awareness/calendar-aware-cljs + (.plus this amount-to-add unit)))) + +(defn query + "Queries this instant using the specified query. + + This queries this instant using the specified query strategy object. + The {@code TemporalQuery} object defines the logic to be used to + obtain the result. Read the documentation of the query to understand + what the result of this method will be. + + The result of this method is obtained by invoking the + {@link TemporalQuery#queryFrom(TemporalAccessor)} method on the + specified query passing {@code this} as the argument. + + @param the type of the result + @param query the query to invoke, not null + @return the query result, null may be returned (defined by the query) + @throws DateTimeException if unable to query (defined by the query) + @throws ArithmeticException if numeric overflow occurs (defined by the query)" + {:arglists (quote (["java.time.Instant" "java.time.temporal.TemporalQuery"]))} + (^java.lang.Object [^js/JSJoda.Instant this ^js/JSJoda.TemporalQuery query] + (.query this query))) + +(defn to-string + "A string representation of this instant using ISO-8601 representation. + + The format used is the same as {@link DateTimeFormatter#ISO_INSTANT}. + + @return an ISO-8601 representation of this instant, not null" + {:arglists (quote (["java.time.Instant"]))} + (^java.lang.String [^js/JSJoda.Instant this] (.toString this))) + +(defn is-before + "Checks if this instant is before the specified instant. + + The comparison is based on the time-line position of the instants. + + @param otherInstant the other instant to compare to, not null + @return true if this instant is before the specified instant + @throws NullPointerException if otherInstant is null" + {:arglists (quote (["java.time.Instant" "java.time.Instant"]))} + (^boolean [^js/JSJoda.Instant this ^js/JSJoda.Instant other-instant] + (.isBefore this other-instant))) + +(defn minus + {:arglists (quote (["java.time.Instant" "java.time.temporal.TemporalAmount"] + ["java.time.Instant" "long" + "java.time.temporal.TemporalUnit"]))} + (^js/JSJoda.Instant + [^js/JSJoda.Instant this ^js/JSJoda.TemporalAmount amount-to-subtract] + (cljc.java-time.extn.calendar-awareness/calendar-aware-cljs + (.minus this amount-to-subtract))) + (^js/JSJoda.Instant + [^js/JSJoda.Instant this ^long amount-to-subtract + ^js/JSJoda.TemporalUnit unit] + (cljc.java-time.extn.calendar-awareness/calendar-aware-cljs + (.minus this amount-to-subtract unit)))) + +(defn at-zone + "Combines this instant with a time-zone to create a {@code ZonedDateTime}. + + This returns an {@code ZonedDateTime} formed from this instant at the + specified time-zone. An exception will be thrown if the instant is too + large to fit into a zoned date-time. + + This method is equivalent to + {@link ZonedDateTime#ofInstant(Instant, ZoneId) ZonedDateTime.ofInstant(this, zone)}. + + @param zone the zone to combine with, not null + @return the zoned date-time formed from this instant and the specified zone, not null + @throws DateTimeException if the result exceeds the supported range" + {:arglists (quote (["java.time.Instant" "java.time.ZoneId"]))} + (^js/JSJoda.ZonedDateTime [^js/JSJoda.Instant this ^js/JSJoda.ZoneId zone] + (.atZone this zone))) + +(defn of-epoch-milli + "Obtains an instance of {@code Instant} using milliseconds from the + epoch of 1970-01-01T00:00:00Z. + + The seconds and nanoseconds are extracted from the specified milliseconds. + + @param epochMilli the number of milliseconds from 1970-01-01T00:00:00Z + @return an instant, not null + @throws DateTimeException if the instant exceeds the maximum or minimum instant" + {:arglists (quote (["long"]))} + (^js/JSJoda.Instant [^long epoch-milli] + (js-invoke java.time.Instant "ofEpochMilli" epoch-milli))) + +(defn get-long + "Gets the value of the specified field from this instant as a {@code long}. + + This queries this instant for the value of the specified field. + If it is not possible to return the value, because the field is not supported + or for some other reason, an exception is thrown. + + If the field is a {@link ChronoField} then the query is implemented here. + The {@link #isSupported(TemporalField) supported fields} will return valid + values based on this date-time. + All other {@code ChronoField} instances will throw an {@code UnsupportedTemporalTypeException}. + + If the field is not a {@code ChronoField}, then the result of this method + is obtained by invoking {@code TemporalField.getFrom(TemporalAccessor)} + passing {@code this} as the argument. Whether the value can be obtained, + and what the value represents, is determined by the field. + + @param field the field to get, not null + @return the value for the field + @throws DateTimeException if a value for the field cannot be obtained + @throws UnsupportedTemporalTypeException if the field is not supported + @throws ArithmeticException if numeric overflow occurs" + {:arglists (quote (["java.time.Instant" "java.time.temporal.TemporalField"]))} + (^long [^js/JSJoda.Instant this ^js/JSJoda.TemporalField field] + (.getLong this field))) + +(defn until + "Calculates the amount of time until another instant in terms of the specified unit. + + This calculates the amount of time between two {@code Instant} + objects in terms of a single {@code TemporalUnit}. + The start and end points are {@code this} and the specified instant. + The result will be negative if the end is before the start. + The calculation returns a whole number, representing the number of + complete units between the two instants. + The {@code Temporal} passed to this method is converted to a + {@code Instant} using {@link #from(TemporalAccessor)}. + For example, the amount in days between two dates can be calculated + using {@code startInstant.until(endInstant, SECONDS)}. + + There are two equivalent ways of using this method. + The first is to invoke this method. + The second is to use {@link TemporalUnit#between(Temporal, Temporal)}: +
+   // these two lines are equivalent
+   amount = start.until(end, SECONDS);
+   amount = SECONDS.between(start, end);
+ 
+ The choice should be made based on which makes the code more readable. + + The calculation is implemented in this method for {@link ChronoUnit}. + The units {@code NANOS}, {@code MICROS}, {@code MILLIS}, {@code SECONDS}, + {@code MINUTES}, {@code HOURS}, {@code HALF_DAYS} and {@code DAYS} + are supported. Other {@code ChronoUnit} values will throw an exception. + + If the unit is not a {@code ChronoUnit}, then the result of this method + is obtained by invoking {@code TemporalUnit.between(Temporal, Temporal)} + passing {@code this} as the first argument and the converted input temporal + as the second argument. + + This instance is immutable and unaffected by this method call. + + @param endExclusive the end date, exclusive, which is converted to an {@code Instant}, not null + @param unit the unit to measure the amount in, not null + @return the amount of time between this instant and the end instant + @throws DateTimeException if the amount cannot be calculated, or the end + temporal cannot be converted to an {@code Instant} + @throws UnsupportedTemporalTypeException if the unit is not supported + @throws ArithmeticException if numeric overflow occurs" + {:arglists (quote (["java.time.Instant" "java.time.temporal.Temporal" + "java.time.temporal.TemporalUnit"]))} + (^long + [^js/JSJoda.Instant this ^js/JSJoda.Temporal end-exclusive + ^js/JSJoda.TemporalUnit unit] + (cljc.java-time.extn.calendar-awareness/calendar-aware-cljs + (.until this end-exclusive unit)))) + +(defn from + "Obtains an instance of {@code Instant} from a temporal object. + + This obtains an instant based on the specified temporal. + A {@code TemporalAccessor} represents an arbitrary set of date and time information, + which this factory converts to an instance of {@code Instant}. + + The conversion extracts the {@link ChronoField#INSTANT_SECONDS INSTANT_SECONDS} + and {@link ChronoField#NANO_OF_SECOND NANO_OF_SECOND} fields. + + This method matches the signature of the functional interface {@link TemporalQuery} + allowing it to be used as a query via method reference, {@code Instant::from}. + + @param temporal the temporal object to convert, not null + @return the instant, not null + @throws DateTimeException if unable to convert to an {@code Instant}" + {:arglists (quote (["java.time.temporal.TemporalAccessor"]))} + (^js/JSJoda.Instant [^js/JSJoda.TemporalAccessor temporal] + (cljc.java-time.extn.calendar-awareness/calendar-aware-cljs + (js-invoke java.time.Instant "from" temporal)))) + +(defn is-after + "Checks if this instant is after the specified instant. + + The comparison is based on the time-line position of the instants. + + @param otherInstant the other instant to compare to, not null + @return true if this instant is after the specified instant + @throws NullPointerException if otherInstant is null" + {:arglists (quote (["java.time.Instant" "java.time.Instant"]))} + (^boolean [^js/JSJoda.Instant this ^js/JSJoda.Instant other-instant] + (.isAfter this other-instant))) + +(defn minus-nanos + "Returns a copy of this instant with the specified duration in nanoseconds subtracted. + + This instance is immutable and unaffected by this method call. + + @param nanosToSubtract the nanoseconds to subtract, positive or negative + @return an {@code Instant} based on this instant with the specified nanoseconds subtracted, not null + @throws DateTimeException if the result exceeds the maximum or minimum instant + @throws ArithmeticException if numeric overflow occurs" + {:arglists (quote (["java.time.Instant" "long"]))} + (^js/JSJoda.Instant [^js/JSJoda.Instant this ^long nanos-to-subtract] + (.minusNanos this nanos-to-subtract))) + +(defn is-supported + {:arglists (quote (["java.time.Instant" "java.time.temporal.TemporalField"] + ["java.time.Instant" "java.time.temporal.TemporalUnit"]))} + (^boolean [^js/JSJoda.Instant this arg0] + (.isSupported ^js/JSJoda.Instant this arg0))) + +(defn parse + "Obtains an instance of {@code Instant} from a text string such as + {@code 2007-12-03T10:15:30.00Z}. + + The string must represent a valid instant in UTC and is parsed using + {@link DateTimeFormatter#ISO_INSTANT}. + + @param text the text to parse, not null + @return the parsed instant, not null + @throws DateTimeParseException if the text cannot be parsed" + {:arglists (quote (["java.lang.CharSequence"]))} + (^js/JSJoda.Instant [^java.lang.CharSequence text] + (js-invoke java.time.Instant "parse" text))) + +(defn hash-code + "Returns a hash code for this instant. + + @return a suitable hash code" + {:arglists (quote (["java.time.Instant"]))} + (^int [^js/JSJoda.Instant this] (.hashCode this))) + +(defn adjust-into + "Adjusts the specified temporal object to have this instant. + + This returns a temporal object of the same observable type as the input + with the instant changed to be the same as this. + + The adjustment is equivalent to using {@link Temporal#with(TemporalField, long)} + twice, passing {@link ChronoField#INSTANT_SECONDS} and + {@link ChronoField#NANO_OF_SECOND} as the fields. + + In most cases, it is clearer to reverse the calling pattern by using + {@link Temporal#with(TemporalAdjuster)}: +
+   // these two lines are equivalent, but the second approach is recommended
+   temporal = thisInstant.adjustInto(temporal);
+   temporal = temporal.with(thisInstant);
+ 
+ + This instance is immutable and unaffected by this method call. + + @param temporal the target object to be adjusted, not null + @return the adjusted object, not null + @throws DateTimeException if unable to make the adjustment + @throws ArithmeticException if numeric overflow occurs" + {:arglists (quote (["java.time.Instant" "java.time.temporal.Temporal"]))} + (^js/JSJoda.Temporal [^js/JSJoda.Instant this ^js/JSJoda.Temporal temporal] + (cljc.java-time.extn.calendar-awareness/calendar-aware-cljs + (.adjustInto this temporal)))) + +(defn with + {:arglists (quote (["java.time.Instant" "java.time.temporal.TemporalAdjuster"] + ["java.time.Instant" "java.time.temporal.TemporalField" + "long"]))} + (^js/JSJoda.Instant + [^js/JSJoda.Instant this ^js/JSJoda.TemporalAdjuster adjuster] + (cljc.java-time.extn.calendar-awareness/calendar-aware-cljs + (.with this adjuster))) + (^js/JSJoda.Instant + [^js/JSJoda.Instant this ^js/JSJoda.TemporalField field ^long new-value] + (cljc.java-time.extn.calendar-awareness/calendar-aware-cljs + (.with this field new-value)))) + +(defn now + {:arglists (quote ([] ["java.time.Clock"]))} + (^js/JSJoda.Instant [] (js-invoke java.time.Instant "now")) + (^js/JSJoda.Instant [^js/JSJoda.Clock clock] + (js-invoke java.time.Instant "now" clock))) + +(defn to-epoch-milli + "Converts this instant to the number of milliseconds from the epoch + of 1970-01-01T00:00:00Z. + + If this instant represents a point on the time-line too far in the future + or past to fit in a {@code long} milliseconds, then an exception is thrown. + + If this instant has greater than millisecond precision, then the conversion + will drop any excess precision information as though the amount in nanoseconds + was subject to integer division by one million. + + @return the number of milliseconds since the epoch of 1970-01-01T00:00:00Z + @throws ArithmeticException if numeric overflow occurs" + {:arglists (quote (["java.time.Instant"]))} + (^long [^js/JSJoda.Instant this] (.toEpochMilli this))) + +(defn get-epoch-second + "Gets the number of seconds from the Java epoch of 1970-01-01T00:00:00Z. + + The epoch second count is a simple incrementing count of seconds where + second 0 is 1970-01-01T00:00:00Z. + The nanosecond part of the day is returned by {@code getNanosOfSecond}. + + @return the seconds from the epoch of 1970-01-01T00:00:00Z" + {:arglists (quote (["java.time.Instant"]))} + (^long [^js/JSJoda.Instant this] (.epochSecond this))) + +(defn compare-to + "Compares this instant to the specified instant. + + The comparison is based on the time-line position of the instants. + It is \"consistent with equals\", as defined by {@link Comparable}. + + @param otherInstant the other instant to compare to, not null + @return the comparator value, negative if less, positive if greater + @throws NullPointerException if otherInstant is null" + {:arglists (quote (["java.time.Instant" "java.time.Instant"]))} + (^int [^js/JSJoda.Instant this ^js/JSJoda.Instant other-instant] + (.compareTo this other-instant))) + +(defn plus-seconds + "Returns a copy of this instant with the specified duration in seconds added. + + This instance is immutable and unaffected by this method call. + + @param secondsToAdd the seconds to add, positive or negative + @return an {@code Instant} based on this instant with the specified seconds added, not null + @throws DateTimeException if the result exceeds the maximum or minimum instant + @throws ArithmeticException if numeric overflow occurs" + {:arglists (quote (["java.time.Instant" "long"]))} + (^js/JSJoda.Instant [^js/JSJoda.Instant this ^long seconds-to-add] + (.plusSeconds this seconds-to-add))) + +(defn get + "Gets the value of the specified field from this instant as an {@code int}. + + This queries this instant for the value of the specified field. + The returned value will always be within the valid range of values for the field. + If it is not possible to return the value, because the field is not supported + or for some other reason, an exception is thrown. + + If the field is a {@link ChronoField} then the query is implemented here. + The {@link #isSupported(TemporalField) supported fields} will return valid + values based on this date-time, except {@code INSTANT_SECONDS} which is too + large to fit in an {@code int} and throws a {@code DateTimeException}. + All other {@code ChronoField} instances will throw an {@code UnsupportedTemporalTypeException}. + + If the field is not a {@code ChronoField}, then the result of this method + is obtained by invoking {@code TemporalField.getFrom(TemporalAccessor)} + passing {@code this} as the argument. Whether the value can be obtained, + and what the value represents, is determined by the field. + + @param field the field to get, not null + @return the value for the field + @throws DateTimeException if a value for the field cannot be obtained or + the value is outside the range of valid values for the field + @throws UnsupportedTemporalTypeException if the field is not supported or + the range of values exceeds an {@code int} + @throws ArithmeticException if numeric overflow occurs" + {:arglists (quote (["java.time.Instant" "java.time.temporal.TemporalField"]))} + (^int [^js/JSJoda.Instant this ^js/JSJoda.TemporalField field] + (cljc.java-time.extn.calendar-awareness/calendar-aware-cljs (.get this + field)))) + +(defn equals + "Checks if this instant is equal to the specified instant. + + The comparison is based on the time-line position of the instants. + + @param otherInstant the other instant, null returns false + @return true if the other instant is equal to this one" + {:arglists (quote (["java.time.Instant" "java.lang.Object"]))} + (^boolean [^js/JSJoda.Instant this ^java.lang.Object other-instant] + (.equals this other-instant))) diff --git a/src/cljc/java_time/local_date.clj b/src/cljc/java_time/local_date.clj index b34a234..d55e99c 100644 --- a/src/cljc/java_time/local_date.clj +++ b/src/cljc/java_time/local_date.clj @@ -1,53 +1,852 @@ -(ns cljc.java-time.local-date (:refer-clojure :exclude [abs get range format min max next name resolve short]) (:require [cljc.java-time.extn.calendar-awareness]) (:import [java.time LocalDate])) -(def max java.time.LocalDate/MAX) -(def min java.time.LocalDate/MIN) -(clojure.core/defn minus-weeks {:arglists (quote (["java.time.LocalDate" "long"]))} (^java.time.LocalDate [^java.time.LocalDate this13042 ^long long13043] (.minusWeeks this13042 long13043))) -(clojure.core/defn plus-weeks {:arglists (quote (["java.time.LocalDate" "long"]))} (^java.time.LocalDate [^java.time.LocalDate this13044 ^long long13045] (.plusWeeks this13044 long13045))) -(clojure.core/defn length-of-year {:arglists (quote (["java.time.LocalDate"]))} (^java.lang.Integer [^java.time.LocalDate this13046] (.lengthOfYear this13046))) -(clojure.core/defn range {:arglists (quote (["java.time.LocalDate" "java.time.temporal.TemporalField"]))} (^java.time.temporal.ValueRange [^java.time.LocalDate this13047 ^java.time.temporal.TemporalField java-time-temporal-TemporalField13048] (.range this13047 java-time-temporal-TemporalField13048))) -(clojure.core/defn get-era {:arglists (quote (["java.time.LocalDate"]))} (^java.time.chrono.Era [^java.time.LocalDate this13049] (.getEra this13049))) -(clojure.core/defn of {:arglists (quote (["int" "int" "int"] ["int" "java.time.Month" "int"]))} (^java.time.LocalDate [G__13051 G__13052 G__13053] (clojure.core/cond (clojure.core/and (clojure.core/instance? java.lang.Number G__13051) (clojure.core/instance? java.lang.Number G__13052) (clojure.core/instance? java.lang.Number G__13053)) (clojure.core/let [G__13051 (clojure.core/int G__13051) G__13052 (clojure.core/int G__13052) G__13053 (clojure.core/int G__13053)] (java.time.LocalDate/of G__13051 G__13052 G__13053)) (clojure.core/and (clojure.core/instance? java.lang.Number G__13051) (clojure.core/instance? java.time.Month G__13052) (clojure.core/instance? java.lang.Number G__13053)) (clojure.core/let [G__13051 (clojure.core/int G__13051) G__13052 ^"java.time.Month" G__13052 G__13053 (clojure.core/int G__13053)] (java.time.LocalDate/of G__13051 G__13052 G__13053)) :else (throw (java.lang.IllegalArgumentException. "no corresponding java.time method with these args"))))) -(clojure.core/defn with-month {:arglists (quote (["java.time.LocalDate" "int"]))} (^java.time.LocalDate [^java.time.LocalDate this13054 ^java.lang.Integer int13055] (.withMonth this13054 int13055))) -(clojure.core/defn is-equal {:arglists (quote (["java.time.LocalDate" "java.time.chrono.ChronoLocalDate"]))} (^java.lang.Boolean [^java.time.LocalDate this13056 ^java.time.chrono.ChronoLocalDate java-time-chrono-ChronoLocalDate13057] (.isEqual this13056 java-time-chrono-ChronoLocalDate13057))) -(clojure.core/defn get-year {:arglists (quote (["java.time.LocalDate"]))} (^java.lang.Integer [^java.time.LocalDate this13058] (.getYear this13058))) -(clojure.core/defn to-epoch-day {:arglists (quote (["java.time.LocalDate"]))} (^long [^java.time.LocalDate this13059] (.toEpochDay this13059))) -(clojure.core/defn get-day-of-year {:arglists (quote (["java.time.LocalDate"]))} (^java.lang.Integer [^java.time.LocalDate this13060] (.getDayOfYear this13060))) -(clojure.core/defn plus {:arglists (quote (["java.time.LocalDate" "long" "java.time.temporal.TemporalUnit"] ["java.time.LocalDate" "java.time.temporal.TemporalAmount"]))} (^java.time.LocalDate [^java.time.LocalDate this13061 ^long long13062 ^java.time.temporal.ChronoUnit java-time-temporal-TemporalUnit13063] (.plus this13061 long13062 java-time-temporal-TemporalUnit13063)) (^java.time.LocalDate [^java.time.LocalDate this13064 ^java.time.temporal.TemporalAmount java-time-temporal-TemporalAmount13065] (.plus this13064 java-time-temporal-TemporalAmount13065))) -(clojure.core/defn is-leap-year {:arglists (quote (["java.time.LocalDate"]))} (^java.lang.Boolean [^java.time.LocalDate this13066] (.isLeapYear this13066))) -(clojure.core/defn query {:arglists (quote (["java.time.LocalDate" "java.time.temporal.TemporalQuery"]))} (^java.lang.Object [^java.time.LocalDate this13067 ^java.time.temporal.TemporalQuery java-time-temporal-TemporalQuery13068] (.query this13067 java-time-temporal-TemporalQuery13068))) -(clojure.core/defn get-day-of-week {:arglists (quote (["java.time.LocalDate"]))} (^java.time.DayOfWeek [^java.time.LocalDate this13069] (.getDayOfWeek this13069))) -(clojure.core/defn to-string {:arglists (quote (["java.time.LocalDate"]))} (^java.lang.String [^java.time.LocalDate this13070] (.toString this13070))) -(clojure.core/defn plus-months {:arglists (quote (["java.time.LocalDate" "long"]))} (^java.time.LocalDate [^java.time.LocalDate this13071 ^long long13072] (.plusMonths this13071 long13072))) -(clojure.core/defn is-before {:arglists (quote (["java.time.LocalDate" "java.time.chrono.ChronoLocalDate"]))} (^java.lang.Boolean [^java.time.LocalDate this13073 ^java.time.chrono.ChronoLocalDate java-time-chrono-ChronoLocalDate13074] (.isBefore this13073 java-time-chrono-ChronoLocalDate13074))) -(clojure.core/defn minus-months {:arglists (quote (["java.time.LocalDate" "long"]))} (^java.time.LocalDate [^java.time.LocalDate this13075 ^long long13076] (.minusMonths this13075 long13076))) -(clojure.core/defn minus {:arglists (quote (["java.time.LocalDate" "long" "java.time.temporal.TemporalUnit"] ["java.time.LocalDate" "java.time.temporal.TemporalAmount"]))} (^java.time.LocalDate [^java.time.LocalDate this13077 ^long long13078 ^java.time.temporal.ChronoUnit java-time-temporal-TemporalUnit13079] (.minus this13077 long13078 java-time-temporal-TemporalUnit13079)) (^java.time.LocalDate [^java.time.LocalDate this13080 ^java.time.temporal.TemporalAmount java-time-temporal-TemporalAmount13081] (.minus this13080 java-time-temporal-TemporalAmount13081))) -(clojure.core/defn plus-days {:arglists (quote (["java.time.LocalDate" "long"]))} (^java.time.LocalDate [^java.time.LocalDate this13082 ^long long13083] (.plusDays this13082 long13083))) -(clojure.core/defn get-long {:arglists (quote (["java.time.LocalDate" "java.time.temporal.TemporalField"]))} (^long [^java.time.LocalDate this13084 ^java.time.temporal.TemporalField java-time-temporal-TemporalField13085] (.getLong this13084 java-time-temporal-TemporalField13085))) -(clojure.core/defn with-year {:arglists (quote (["java.time.LocalDate" "int"]))} (^java.time.LocalDate [^java.time.LocalDate this13086 ^java.lang.Integer int13087] (.withYear this13086 int13087))) -(clojure.core/defn length-of-month {:arglists (quote (["java.time.LocalDate"]))} (^java.lang.Integer [^java.time.LocalDate this13088] (.lengthOfMonth this13088))) -(clojure.core/defn until {:arglists (quote (["java.time.LocalDate" "java.time.chrono.ChronoLocalDate"] ["java.time.LocalDate" "java.time.temporal.Temporal" "java.time.temporal.TemporalUnit"]))} (^java.time.Period [^java.time.LocalDate this13089 ^java.time.chrono.ChronoLocalDate java-time-chrono-ChronoLocalDate13090] (.until this13089 java-time-chrono-ChronoLocalDate13090)) (^long [^java.time.LocalDate this13091 ^java.time.temporal.Temporal java-time-temporal-Temporal13092 ^java.time.temporal.ChronoUnit java-time-temporal-TemporalUnit13093] (.until this13091 java-time-temporal-Temporal13092 java-time-temporal-TemporalUnit13093))) -(clojure.core/defn of-epoch-day {:arglists (quote (["long"]))} (^java.time.LocalDate [^long long13094] (java.time.LocalDate/ofEpochDay long13094))) -(clojure.core/defn with-day-of-month {:arglists (quote (["java.time.LocalDate" "int"]))} (^java.time.LocalDate [^java.time.LocalDate this13095 ^java.lang.Integer int13096] (.withDayOfMonth this13095 int13096))) -(clojure.core/defn get-day-of-month {:arglists (quote (["java.time.LocalDate"]))} (^java.lang.Integer [^java.time.LocalDate this13097] (.getDayOfMonth this13097))) -(clojure.core/defn from {:arglists (quote (["java.time.temporal.TemporalAccessor"]))} (^java.time.LocalDate [^java.time.temporal.TemporalAccessor java-time-temporal-TemporalAccessor13098] (java.time.LocalDate/from java-time-temporal-TemporalAccessor13098))) -(clojure.core/defn is-after {:arglists (quote (["java.time.LocalDate" "java.time.chrono.ChronoLocalDate"]))} (^java.lang.Boolean [^java.time.LocalDate this13099 ^java.time.chrono.ChronoLocalDate java-time-chrono-ChronoLocalDate13100] (.isAfter this13099 java-time-chrono-ChronoLocalDate13100))) -(clojure.core/defn is-supported {:arglists (quote (["java.time.LocalDate" "java.time.temporal.TemporalField"] ["java.time.LocalDate" "java.time.temporal.TemporalUnit"]))} (^java.lang.Boolean [this13101 G__13102] (clojure.core/cond (clojure.core/and (clojure.core/instance? java.time.temporal.TemporalField G__13102)) (clojure.core/let [G__13102 ^"java.time.temporal.TemporalField" G__13102] (.isSupported ^java.time.LocalDate this13101 G__13102)) (clojure.core/and (clojure.core/instance? java.time.temporal.ChronoUnit G__13102)) (clojure.core/let [G__13102 ^"java.time.temporal.ChronoUnit" G__13102] (.isSupported ^java.time.LocalDate this13101 G__13102)) :else (throw (java.lang.IllegalArgumentException. "no corresponding java.time method with these args"))))) -(clojure.core/defn minus-years {:arglists (quote (["java.time.LocalDate" "long"]))} (^java.time.LocalDate [^java.time.LocalDate this13103 ^long long13104] (.minusYears this13103 long13104))) -(clojure.core/defn get-chronology {:arglists (quote (["java.time.LocalDate"]))} (^java.time.chrono.IsoChronology [^java.time.LocalDate this13105] (.getChronology this13105))) -(clojure.core/defn parse {:arglists (quote (["java.lang.CharSequence" "java.time.format.DateTimeFormatter"] ["java.lang.CharSequence"]))} (^java.time.LocalDate [^java.lang.CharSequence java-lang-CharSequence13106 ^java.time.format.DateTimeFormatter java-time-format-DateTimeFormatter13107] (java.time.LocalDate/parse java-lang-CharSequence13106 java-time-format-DateTimeFormatter13107)) (^java.time.LocalDate [^java.lang.CharSequence java-lang-CharSequence13108] (java.time.LocalDate/parse java-lang-CharSequence13108))) -(clojure.core/defn hash-code {:arglists (quote (["java.time.LocalDate"]))} (^java.lang.Integer [^java.time.LocalDate this13109] (.hashCode this13109))) -(clojure.core/defn adjust-into {:arglists (quote (["java.time.LocalDate" "java.time.temporal.Temporal"]))} (^java.time.temporal.Temporal [^java.time.LocalDate this13110 ^java.time.temporal.Temporal java-time-temporal-Temporal13111] (.adjustInto this13110 java-time-temporal-Temporal13111))) -(clojure.core/defn with {:arglists (quote (["java.time.LocalDate" "java.time.temporal.TemporalField" "long"] ["java.time.LocalDate" "java.time.temporal.TemporalAdjuster"]))} (^java.time.LocalDate [^java.time.LocalDate this13112 ^java.time.temporal.TemporalField java-time-temporal-TemporalField13113 ^long long13114] (.with this13112 java-time-temporal-TemporalField13113 long13114)) (^java.time.LocalDate [^java.time.LocalDate this13115 ^java.time.temporal.TemporalAdjuster java-time-temporal-TemporalAdjuster13116] (.with this13115 java-time-temporal-TemporalAdjuster13116))) -(clojure.core/defn now {:arglists (quote ([] ["java.time.ZoneId"] ["java.time.Clock"]))} (^java.time.LocalDate [] (java.time.LocalDate/now)) (^java.time.LocalDate [G__13118] (clojure.core/cond (clojure.core/and (clojure.core/instance? java.time.ZoneId G__13118)) (clojure.core/let [G__13118 ^"java.time.ZoneId" G__13118] (java.time.LocalDate/now G__13118)) (clojure.core/and (clojure.core/instance? java.time.Clock G__13118)) (clojure.core/let [G__13118 ^"java.time.Clock" G__13118] (java.time.LocalDate/now G__13118)) :else (throw (java.lang.IllegalArgumentException. "no corresponding java.time method with these args"))))) -(clojure.core/defn at-start-of-day {:arglists (quote (["java.time.LocalDate" "java.time.ZoneId"] ["java.time.LocalDate"]))} (^java.time.ZonedDateTime [^java.time.LocalDate this13119 ^java.time.ZoneId java-time-ZoneId13120] (.atStartOfDay this13119 java-time-ZoneId13120)) (^java.time.LocalDateTime [^java.time.LocalDate this13121] (.atStartOfDay this13121))) -(clojure.core/defn get-month-value {:arglists (quote (["java.time.LocalDate"]))} (^java.lang.Integer [^java.time.LocalDate this13122] (.getMonthValue this13122))) -(clojure.core/defn with-day-of-year {:arglists (quote (["java.time.LocalDate" "int"]))} (^java.time.LocalDate [^java.time.LocalDate this13123 ^java.lang.Integer int13124] (.withDayOfYear this13123 int13124))) -(clojure.core/defn compare-to {:arglists (quote (["java.time.LocalDate" "java.time.chrono.ChronoLocalDate"]))} (^java.lang.Integer [^java.time.LocalDate this13125 ^java.time.chrono.ChronoLocalDate java-time-chrono-ChronoLocalDate13126] (.compareTo this13125 java-time-chrono-ChronoLocalDate13126))) -(clojure.core/defn get-month {:arglists (quote (["java.time.LocalDate"]))} (^java.time.Month [^java.time.LocalDate this13127] (.getMonth this13127))) -(clojure.core/defn of-year-day {:arglists (quote (["int" "int"]))} (^java.time.LocalDate [^java.lang.Integer int13128 ^java.lang.Integer int13129] (java.time.LocalDate/ofYearDay int13128 int13129))) -(clojure.core/defn get {:arglists (quote (["java.time.LocalDate" "java.time.temporal.TemporalField"]))} (^java.lang.Integer [^java.time.LocalDate this13130 ^java.time.temporal.TemporalField java-time-temporal-TemporalField13131] (.get this13130 java-time-temporal-TemporalField13131))) -(clojure.core/defn equals {:arglists (quote (["java.time.LocalDate" "java.lang.Object"]))} (^java.lang.Boolean [^java.time.LocalDate this13132 ^java.lang.Object java-lang-Object13133] (.equals this13132 java-lang-Object13133))) -(clojure.core/defn at-time {:arglists (quote (["java.time.LocalDate" "java.time.LocalTime"] ["java.time.LocalDate" "int" "int" "int"] ["java.time.LocalDate" "int" "int" "int" "int"] ["java.time.LocalDate" "java.time.OffsetTime"] ["java.time.LocalDate" "int" "int"]))} (^java.lang.Object [this13134 G__13135] (clojure.core/cond (clojure.core/and (clojure.core/instance? java.time.LocalTime G__13135)) (clojure.core/let [G__13135 ^"java.time.LocalTime" G__13135] (.atTime ^java.time.LocalDate this13134 G__13135)) (clojure.core/and (clojure.core/instance? java.time.OffsetTime G__13135)) (clojure.core/let [G__13135 ^"java.time.OffsetTime" G__13135] (.atTime ^java.time.LocalDate this13134 G__13135)) :else (throw (java.lang.IllegalArgumentException. "no corresponding java.time method with these args")))) (^java.time.LocalDateTime [^java.time.LocalDate this13136 ^java.lang.Integer int13137 ^java.lang.Integer int13138 ^java.lang.Integer int13139] (.atTime this13136 int13137 int13138 int13139)) (^java.time.LocalDateTime [^java.time.LocalDate this13140 ^java.lang.Integer int13141 ^java.lang.Integer int13142 ^java.lang.Integer int13143 ^java.lang.Integer int13144] (.atTime this13140 int13141 int13142 int13143 int13144)) (^java.time.LocalDateTime [^java.time.LocalDate this13145 ^java.lang.Integer int13146 ^java.lang.Integer int13147] (.atTime this13145 int13146 int13147))) -(clojure.core/defn format {:arglists (quote (["java.time.LocalDate" "java.time.format.DateTimeFormatter"]))} (^java.lang.String [^java.time.LocalDate this13148 ^java.time.format.DateTimeFormatter java-time-format-DateTimeFormatter13149] (.format this13148 java-time-format-DateTimeFormatter13149))) -(clojure.core/defn plus-years {:arglists (quote (["java.time.LocalDate" "long"]))} (^java.time.LocalDate [^java.time.LocalDate this13150 ^long long13151] (.plusYears this13150 long13151))) -(clojure.core/defn minus-days {:arglists (quote (["java.time.LocalDate" "long"]))} (^java.time.LocalDate [^java.time.LocalDate this13152 ^long long13153] (.minusDays this13152 long13153))) +(ns cljc.java-time.local-date + (:refer-clojure :exclude + [abs get range format min max next name resolve short]) + (:require [cljc.java-time.extn.calendar-awareness]) + (:import [java.time LocalDate])) + +(def max + "The maximum supported {@code LocalDate}, '+999999999-12-31'. + This could be used by an application as a \"far future\" date." + java.time.LocalDate/MAX) + +(def min + "The minimum supported {@code LocalDate}, '-999999999-01-01'. + This could be used by an application as a \"far past\" date." + java.time.LocalDate/MIN) + +(defn minus-weeks + "Returns a copy of this {@code LocalDate} with the specified number of weeks subtracted. + + This method subtracts the specified amount in weeks from the days field decrementing + the month and year fields as necessary to ensure the result remains valid. + The result is only invalid if the maximum/minimum year is exceeded. + + For example, 2009-01-07 minus one week would result in 2008-12-31. + + This instance is immutable and unaffected by this method call. + + @param weeksToSubtract the weeks to subtract, may be negative + @return a {@code LocalDate} based on this date with the weeks subtracted, not null + @throws DateTimeException if the result exceeds the supported date range" + {:arglists (quote (["java.time.LocalDate" "long"]))} + (^java.time.LocalDate [^java.time.LocalDate this ^long weeks-to-subtract] + (.minusWeeks this weeks-to-subtract))) + +(defn plus-weeks + "Returns a copy of this {@code LocalDate} with the specified number of weeks added. + + This method adds the specified amount in weeks to the days field incrementing + the month and year fields as necessary to ensure the result remains valid. + The result is only invalid if the maximum/minimum year is exceeded. + + For example, 2008-12-31 plus one week would result in 2009-01-07. + + This instance is immutable and unaffected by this method call. + + @param weeksToAdd the weeks to add, may be negative + @return a {@code LocalDate} based on this date with the weeks added, not null + @throws DateTimeException if the result exceeds the supported date range" + {:arglists (quote (["java.time.LocalDate" "long"]))} + (^java.time.LocalDate [^java.time.LocalDate this ^long weeks-to-add] + (.plusWeeks this weeks-to-add))) + +(defn length-of-year + "Returns the length of the year represented by this date. + + This returns the length of the year in days, either 365 or 366. + + @return 366 if the year is leap, 365 otherwise" + {:arglists (quote (["java.time.LocalDate"]))} + (^java.lang.Integer [^java.time.LocalDate this] (.lengthOfYear this))) + +(defn range + "Gets the range of valid values for the specified field. + + The range object expresses the minimum and maximum valid values for a field. + This date is used to enhance the accuracy of the returned range. + If it is not possible to return the range, because the field is not supported + or for some other reason, an exception is thrown. + + If the field is a {@link ChronoField} then the query is implemented here. + The {@link #isSupported(TemporalField) supported fields} will return + appropriate range instances. + All other {@code ChronoField} instances will throw an {@code UnsupportedTemporalTypeException}. + + If the field is not a {@code ChronoField}, then the result of this method + is obtained by invoking {@code TemporalField.rangeRefinedBy(TemporalAccessor)} + passing {@code this} as the argument. + Whether the range can be obtained is determined by the field. + + @param field the field to query the range for, not null + @return the range of valid values for the field, not null + @throws DateTimeException if the range for the field cannot be obtained + @throws UnsupportedTemporalTypeException if the field is not supported" + {:arglists (quote (["java.time.LocalDate" + "java.time.temporal.TemporalField"]))} + (^java.time.temporal.ValueRange + [^java.time.LocalDate this ^java.time.temporal.TemporalField field] + (.range this field))) + +(defn get-era + "Gets the era applicable at this date. + + The official ISO-8601 standard does not define eras, however {@code IsoChronology} does. + It defines two eras, 'CE' from year one onwards and 'BCE' from year zero backwards. + Since dates before the Julian-Gregorian cutover are not in line with history, + the cutover between 'BCE' and 'CE' is also not aligned with the commonly used + eras, often referred to using 'BC' and 'AD'. + + Users of this class should typically ignore this method as it exists primarily + to fulfill the {@link ChronoLocalDate} contract where it is necessary to support + the Japanese calendar system. + + The returned era will be a singleton capable of being compared with the constants + in {@link IsoChronology} using the {@code ==} operator. + + @return the {@code IsoChronology} era constant applicable at this date, not null" + {:arglists (quote (["java.time.LocalDate"]))} + (^java.time.chrono.Era [^java.time.LocalDate this] (.getEra this))) + +(defn of + {:arglists (quote (["int" "int" "int"] ["int" "java.time.Month" "int"]))} + (^java.time.LocalDate [arg0 arg1 arg2] + (cond (and (instance? java.lang.Number arg0) + (instance? java.lang.Number arg1) + (instance? java.lang.Number arg2)) + (let [year (int arg0) + month (int arg1) + day-of-month (int arg2)] + (java.time.LocalDate/of year month day-of-month)) + (and (instance? java.lang.Number arg0) + (instance? java.time.Month arg1) + (instance? java.lang.Number arg2)) + (let [year (int arg0) + ^java.time.Month month arg1 + day-of-month (int arg2)] + (java.time.LocalDate/of year month day-of-month)) + :else (throw (java.lang.IllegalArgumentException. + "no corresponding java.time method with these args"))))) + +(defn with-month + "Returns a copy of this {@code LocalDate} with the month-of-year altered. + + If the day-of-month is invalid for the year, it will be changed to the last valid day of the month. + + This instance is immutable and unaffected by this method call. + + @param month the month-of-year to set in the result, from 1 (January) to 12 (December) + @return a {@code LocalDate} based on this date with the requested month, not null + @throws DateTimeException if the month-of-year value is invalid" + {:arglists (quote (["java.time.LocalDate" "int"]))} + (^java.time.LocalDate [^java.time.LocalDate this ^java.lang.Integer month] + (.withMonth this month))) + +(defn is-equal + "Checks if this date is equal to the specified date. + + This checks to see if this date represents the same point on the + local time-line as the other date. +
+   LocalDate a = LocalDate.of(2012, 6, 30);
+   LocalDate b = LocalDate.of(2012, 7, 1);
+   a.isEqual(b) == false
+   a.isEqual(a) == true
+   b.isEqual(a) == false
+ 
+ + This method only considers the position of the two dates on the local time-line. + It does not take into account the chronology, or calendar system. + This is different from the comparison in {@link #compareTo(ChronoLocalDate)} + but is the same approach as {@link ChronoLocalDate#timeLineOrder()}. + + @param other the other date to compare to, not null + @return true if this date is equal to the specified date" + {:arglists (quote (["java.time.LocalDate" + "java.time.chrono.ChronoLocalDate"]))} + (^java.lang.Boolean + [^java.time.LocalDate this ^java.time.chrono.ChronoLocalDate other] + (.isEqual this other))) + +(defn get-year + "Gets the year field. + + This method returns the primitive {@code int} value for the year. + + The year returned by this method is proleptic as per {@code get(YEAR)}. + To obtain the year-of-era, use {@code get(YEAR_OF_ERA)}. + + @return the year, from MIN_YEAR to MAX_YEAR" + {:arglists (quote (["java.time.LocalDate"]))} + (^java.lang.Integer [^java.time.LocalDate this] (.getYear this))) + +(defn to-epoch-day + {:arglists (quote (["java.time.LocalDate"]))} + (^long [^java.time.LocalDate this] (.toEpochDay this))) + +(defn get-day-of-year + "Gets the day-of-year field. + + This method returns the primitive {@code int} value for the day-of-year. + + @return the day-of-year, from 1 to 365, or 366 in a leap year" + {:arglists (quote (["java.time.LocalDate"]))} + (^java.lang.Integer [^java.time.LocalDate this] (.getDayOfYear this))) + +(defn plus + {:arglists (quote (["java.time.LocalDate" "java.time.temporal.TemporalAmount"] + ["java.time.LocalDate" "long" + "java.time.temporal.TemporalUnit"]))} + (^java.time.LocalDate + [^java.time.LocalDate this ^java.time.temporal.TemporalAmount amount-to-add] + (.plus this amount-to-add)) + (^java.time.LocalDate + [^java.time.LocalDate this ^long amount-to-add + ^java.time.temporal.ChronoUnit unit] + (.plus this amount-to-add unit))) + +(defn is-leap-year + "Checks if the year is a leap year, according to the ISO proleptic + calendar system rules. + + This method applies the current rules for leap years across the whole time-line. + In general, a year is a leap year if it is divisible by four without + remainder. However, years divisible by 100, are not leap years, with + the exception of years divisible by 400 which are. + + For example, 1904 is a leap year it is divisible by 4. + 1900 was not a leap year as it is divisible by 100, however 2000 was a + leap year as it is divisible by 400. + + The calculation is proleptic - applying the same rules into the far future and far past. + This is historically inaccurate, but is correct for the ISO-8601 standard. + + @return true if the year is leap, false otherwise" + {:arglists (quote (["java.time.LocalDate"]))} + (^java.lang.Boolean [^java.time.LocalDate this] (.isLeapYear this))) + +(defn query + "Queries this date using the specified query. + + This queries this date using the specified query strategy object. + The {@code TemporalQuery} object defines the logic to be used to + obtain the result. Read the documentation of the query to understand + what the result of this method will be. + + The result of this method is obtained by invoking the + {@link TemporalQuery#queryFrom(TemporalAccessor)} method on the + specified query passing {@code this} as the argument. + + @param the type of the result + @param query the query to invoke, not null + @return the query result, null may be returned (defined by the query) + @throws DateTimeException if unable to query (defined by the query) + @throws ArithmeticException if numeric overflow occurs (defined by the query)" + {:arglists (quote (["java.time.LocalDate" + "java.time.temporal.TemporalQuery"]))} + (^java.lang.Object + [^java.time.LocalDate this ^java.time.temporal.TemporalQuery query] + (.query this query))) + +(defn get-day-of-week + "Gets the day-of-week field, which is an enum {@code DayOfWeek}. + + This method returns the enum {@link DayOfWeek} for the day-of-week. + This avoids confusion as to what {@code int} values mean. + If you need access to the primitive {@code int} value then the enum + provides the {@link DayOfWeek#getValue() int value}. + + Additional information can be obtained from the {@code DayOfWeek}. + This includes textual names of the values. + + @return the day-of-week, not null" + {:arglists (quote (["java.time.LocalDate"]))} + (^java.time.DayOfWeek [^java.time.LocalDate this] (.getDayOfWeek this))) + +(defn to-string + "Outputs this date as a {@code String}, such as {@code 2007-12-03}. + + The output will be in the ISO-8601 format {@code uuuu-MM-dd}. + + @return a string representation of this date, not null" + {:arglists (quote (["java.time.LocalDate"]))} + (^java.lang.String [^java.time.LocalDate this] (.toString this))) + +(defn plus-months + "Returns a copy of this {@code LocalDate} with the specified number of months added. + + This method adds the specified amount to the months field in three steps: +
    +
  1. Add the input months to the month-of-year field
  2. +
  3. Check if the resulting date would be invalid
  4. +
  5. Adjust the day-of-month to the last valid day if necessary
  6. +
+ + For example, 2007-03-31 plus one month would result in the invalid date + 2007-04-31. Instead of returning an invalid result, the last valid day + of the month, 2007-04-30, is selected instead. + + This instance is immutable and unaffected by this method call. + + @param monthsToAdd the months to add, may be negative + @return a {@code LocalDate} based on this date with the months added, not null + @throws DateTimeException if the result exceeds the supported date range" + {:arglists (quote (["java.time.LocalDate" "long"]))} + (^java.time.LocalDate [^java.time.LocalDate this ^long months-to-add] + (.plusMonths this months-to-add))) + +(defn is-before + "Checks if this date is before the specified date. + + This checks to see if this date represents a point on the + local time-line before the other date. +
+   LocalDate a = LocalDate.of(2012, 6, 30);
+   LocalDate b = LocalDate.of(2012, 7, 1);
+   a.isBefore(b) == true
+   a.isBefore(a) == false
+   b.isBefore(a) == false
+ 
+ + This method only considers the position of the two dates on the local time-line. + It does not take into account the chronology, or calendar system. + This is different from the comparison in {@link #compareTo(ChronoLocalDate)}, + but is the same approach as {@link ChronoLocalDate#timeLineOrder()}. + + @param other the other date to compare to, not null + @return true if this date is before the specified date" + {:arglists (quote (["java.time.LocalDate" + "java.time.chrono.ChronoLocalDate"]))} + (^java.lang.Boolean + [^java.time.LocalDate this ^java.time.chrono.ChronoLocalDate other] + (.isBefore this other))) + +(defn minus-months + "Returns a copy of this {@code LocalDate} with the specified number of months subtracted. + + This method subtracts the specified amount from the months field in three steps: +
    +
  1. Subtract the input months from the month-of-year field
  2. +
  3. Check if the resulting date would be invalid
  4. +
  5. Adjust the day-of-month to the last valid day if necessary
  6. +
+ + For example, 2007-03-31 minus one month would result in the invalid date + 2007-02-31. Instead of returning an invalid result, the last valid day + of the month, 2007-02-28, is selected instead. + + This instance is immutable and unaffected by this method call. + + @param monthsToSubtract the months to subtract, may be negative + @return a {@code LocalDate} based on this date with the months subtracted, not null + @throws DateTimeException if the result exceeds the supported date range" + {:arglists (quote (["java.time.LocalDate" "long"]))} + (^java.time.LocalDate [^java.time.LocalDate this ^long months-to-subtract] + (.minusMonths this months-to-subtract))) + +(defn minus + {:arglists (quote (["java.time.LocalDate" "java.time.temporal.TemporalAmount"] + ["java.time.LocalDate" "long" + "java.time.temporal.TemporalUnit"]))} + (^java.time.LocalDate + [^java.time.LocalDate this + ^java.time.temporal.TemporalAmount amount-to-subtract] + (.minus this amount-to-subtract)) + (^java.time.LocalDate + [^java.time.LocalDate this ^long amount-to-subtract + ^java.time.temporal.ChronoUnit unit] + (.minus this amount-to-subtract unit))) + +(defn plus-days + "Returns a copy of this {@code LocalDate} with the specified number of days added. + + This method adds the specified amount to the days field incrementing the + month and year fields as necessary to ensure the result remains valid. + The result is only invalid if the maximum/minimum year is exceeded. + + For example, 2008-12-31 plus one day would result in 2009-01-01. + + This instance is immutable and unaffected by this method call. + + @param daysToAdd the days to add, may be negative + @return a {@code LocalDate} based on this date with the days added, not null + @throws DateTimeException if the result exceeds the supported date range" + {:arglists (quote (["java.time.LocalDate" "long"]))} + (^java.time.LocalDate [^java.time.LocalDate this ^long days-to-add] + (.plusDays this days-to-add))) + +(defn get-long + "Gets the value of the specified field from this date as a {@code long}. + + This queries this date for the value of the specified field. + If it is not possible to return the value, because the field is not supported + or for some other reason, an exception is thrown. + + If the field is a {@link ChronoField} then the query is implemented here. + The {@link #isSupported(TemporalField) supported fields} will return valid + values based on this date. + All other {@code ChronoField} instances will throw an {@code UnsupportedTemporalTypeException}. + + If the field is not a {@code ChronoField}, then the result of this method + is obtained by invoking {@code TemporalField.getFrom(TemporalAccessor)} + passing {@code this} as the argument. Whether the value can be obtained, + and what the value represents, is determined by the field. + + @param field the field to get, not null + @return the value for the field + @throws DateTimeException if a value for the field cannot be obtained + @throws UnsupportedTemporalTypeException if the field is not supported + @throws ArithmeticException if numeric overflow occurs" + {:arglists (quote (["java.time.LocalDate" + "java.time.temporal.TemporalField"]))} + (^long [^java.time.LocalDate this ^java.time.temporal.TemporalField field] + (.getLong this field))) + +(defn with-year + "Returns a copy of this {@code LocalDate} with the year altered. + + If the day-of-month is invalid for the year, it will be changed to the last valid day of the month. + + This instance is immutable and unaffected by this method call. + + @param year the year to set in the result, from MIN_YEAR to MAX_YEAR + @return a {@code LocalDate} based on this date with the requested year, not null + @throws DateTimeException if the year value is invalid" + {:arglists (quote (["java.time.LocalDate" "int"]))} + (^java.time.LocalDate [^java.time.LocalDate this ^java.lang.Integer year] + (.withYear this year))) + +(defn length-of-month + "Returns the length of the month represented by this date. + + This returns the length of the month in days. + For example, a date in January would return 31. + + @return the length of the month in days" + {:arglists (quote (["java.time.LocalDate"]))} + (^java.lang.Integer [^java.time.LocalDate this] (.lengthOfMonth this))) + +(defn until + {:arglists (quote (["java.time.LocalDate" "java.time.chrono.ChronoLocalDate"] + ["java.time.LocalDate" "java.time.temporal.Temporal" + "java.time.temporal.TemporalUnit"]))} + (^java.time.Period + [^java.time.LocalDate this + ^java.time.chrono.ChronoLocalDate end-date-exclusive] + (.until this end-date-exclusive)) + (^long + [^java.time.LocalDate this ^java.time.temporal.Temporal end-exclusive + ^java.time.temporal.ChronoUnit unit] + (.until this end-exclusive unit))) + +(defn of-epoch-day + "Obtains an instance of {@code LocalDate} from the epoch day count. + + This returns a {@code LocalDate} with the specified epoch-day. + The {@link ChronoField#EPOCH_DAY EPOCH_DAY} is a simple incrementing count + of days where day 0 is 1970-01-01. Negative numbers represent earlier days. + + @param epochDay the Epoch Day to convert, based on the epoch 1970-01-01 + @return the local date, not null + @throws DateTimeException if the epoch day exceeds the supported date range" + {:arglists (quote (["long"]))} + (^java.time.LocalDate [^long epoch-day] + (java.time.LocalDate/ofEpochDay epoch-day))) + +(defn with-day-of-month + "Returns a copy of this {@code LocalDate} with the day-of-month altered. + + If the resulting date is invalid, an exception is thrown. + + This instance is immutable and unaffected by this method call. + + @param dayOfMonth the day-of-month to set in the result, from 1 to 28-31 + @return a {@code LocalDate} based on this date with the requested day, not null + @throws DateTimeException if the day-of-month value is invalid, + or if the day-of-month is invalid for the month-year" + {:arglists (quote (["java.time.LocalDate" "int"]))} + (^java.time.LocalDate + [^java.time.LocalDate this ^java.lang.Integer day-of-month] + (.withDayOfMonth this day-of-month))) + +(defn get-day-of-month + "Gets the day-of-month field. + + This method returns the primitive {@code int} value for the day-of-month. + + @return the day-of-month, from 1 to 31" + {:arglists (quote (["java.time.LocalDate"]))} + (^java.lang.Integer [^java.time.LocalDate this] (.getDayOfMonth this))) + +(defn from + "Obtains an instance of {@code LocalDate} from a temporal object. + + This obtains a local date based on the specified temporal. + A {@code TemporalAccessor} represents an arbitrary set of date and time information, + which this factory converts to an instance of {@code LocalDate}. + + The conversion uses the {@link TemporalQueries#localDate()} query, which relies + on extracting the {@link ChronoField#EPOCH_DAY EPOCH_DAY} field. + + This method matches the signature of the functional interface {@link TemporalQuery} + allowing it to be used as a query via method reference, {@code LocalDate::from}. + + @param temporal the temporal object to convert, not null + @return the local date, not null + @throws DateTimeException if unable to convert to a {@code LocalDate}" + {:arglists (quote (["java.time.temporal.TemporalAccessor"]))} + (^java.time.LocalDate [^java.time.temporal.TemporalAccessor temporal] + (java.time.LocalDate/from temporal))) + +(defn is-after + "Checks if this date is after the specified date. + + This checks to see if this date represents a point on the + local time-line after the other date. +
+   LocalDate a = LocalDate.of(2012, 6, 30);
+   LocalDate b = LocalDate.of(2012, 7, 1);
+   a.isAfter(b) == false
+   a.isAfter(a) == false
+   b.isAfter(a) == true
+ 
+ + This method only considers the position of the two dates on the local time-line. + It does not take into account the chronology, or calendar system. + This is different from the comparison in {@link #compareTo(ChronoLocalDate)}, + but is the same approach as {@link ChronoLocalDate#timeLineOrder()}. + + @param other the other date to compare to, not null + @return true if this date is after the specified date" + {:arglists (quote (["java.time.LocalDate" + "java.time.chrono.ChronoLocalDate"]))} + (^java.lang.Boolean + [^java.time.LocalDate this ^java.time.chrono.ChronoLocalDate other] + (.isAfter this other))) + +(defn is-supported + {:arglists (quote (["java.time.LocalDate" "java.time.temporal.TemporalField"] + ["java.time.LocalDate" + "java.time.temporal.TemporalUnit"]))} + (^java.lang.Boolean [^java.time.LocalDate this arg0] + (cond (instance? java.time.temporal.TemporalField arg0) + (let [^java.time.temporal.TemporalField field arg0] + (.isSupported this field)) + (instance? java.time.temporal.ChronoUnit arg0) + (let [^java.time.temporal.TemporalUnit unit arg0] + (.isSupported this unit)) + :else (throw (java.lang.IllegalArgumentException. + "no corresponding java.time method with these args"))))) + +(defn minus-years + "Returns a copy of this {@code LocalDate} with the specified number of years subtracted. + + This method subtracts the specified amount from the years field in three steps: +
    +
  1. Subtract the input years from the year field
  2. +
  3. Check if the resulting date would be invalid
  4. +
  5. Adjust the day-of-month to the last valid day if necessary
  6. +
+ + For example, 2008-02-29 (leap year) minus one year would result in the + invalid date 2007-02-29 (standard year). Instead of returning an invalid + result, the last valid day of the month, 2007-02-28, is selected instead. + + This instance is immutable and unaffected by this method call. + + @param yearsToSubtract the years to subtract, may be negative + @return a {@code LocalDate} based on this date with the years subtracted, not null + @throws DateTimeException if the result exceeds the supported date range" + {:arglists (quote (["java.time.LocalDate" "long"]))} + (^java.time.LocalDate [^java.time.LocalDate this ^long years-to-subtract] + (.minusYears this years-to-subtract))) + +(defn get-chronology + "Gets the chronology of this date, which is the ISO calendar system. + + The {@code Chronology} represents the calendar system in use. + The ISO-8601 calendar system is the modern civil calendar system used today + in most of the world. It is equivalent to the proleptic Gregorian calendar + system, in which today's rules for leap years are applied for all time. + + @return the ISO chronology, not null" + {:arglists (quote (["java.time.LocalDate"]))} + (^java.time.chrono.IsoChronology [^java.time.LocalDate this] + (.getChronology this))) + +(defn parse + {:arglists (quote (["java.lang.CharSequence"] + ["java.lang.CharSequence" + "java.time.format.DateTimeFormatter"]))} + (^java.time.LocalDate [^java.lang.CharSequence text] + (java.time.LocalDate/parse text)) + (^java.time.LocalDate + [^java.lang.CharSequence text ^java.time.format.DateTimeFormatter formatter] + (java.time.LocalDate/parse text formatter))) + +(defn hash-code + "A hash code for this date. + + @return a suitable hash code" + {:arglists (quote (["java.time.LocalDate"]))} + (^java.lang.Integer [^java.time.LocalDate this] (.hashCode this))) + +(defn adjust-into + "Adjusts the specified temporal object to have the same date as this object. + + This returns a temporal object of the same observable type as the input + with the date changed to be the same as this. + + The adjustment is equivalent to using {@link Temporal#with(TemporalField, long)} + passing {@link ChronoField#EPOCH_DAY} as the field. + + In most cases, it is clearer to reverse the calling pattern by using + {@link Temporal#with(TemporalAdjuster)}: +
+   // these two lines are equivalent, but the second approach is recommended
+   temporal = thisLocalDate.adjustInto(temporal);
+   temporal = temporal.with(thisLocalDate);
+ 
+ + This instance is immutable and unaffected by this method call. + + @param temporal the target object to be adjusted, not null + @return the adjusted object, not null + @throws DateTimeException if unable to make the adjustment + @throws ArithmeticException if numeric overflow occurs" + {:arglists (quote (["java.time.LocalDate" "java.time.temporal.Temporal"]))} + (^java.time.temporal.Temporal + [^java.time.LocalDate this ^java.time.temporal.Temporal temporal] + (.adjustInto this temporal))) + +(defn with + {:arglists (quote (["java.time.LocalDate" + "java.time.temporal.TemporalAdjuster"] + ["java.time.LocalDate" "java.time.temporal.TemporalField" + "long"]))} + (^java.time.LocalDate + [^java.time.LocalDate this ^java.time.temporal.TemporalAdjuster adjuster] + (.with this adjuster)) + (^java.time.LocalDate + [^java.time.LocalDate this ^java.time.temporal.TemporalField field + ^long new-value] + (.with this field new-value))) + +(defn now + {:arglists (quote ([] ["java.time.Clock"] ["java.time.ZoneId"]))} + (^java.time.LocalDate [] (java.time.LocalDate/now)) + (^java.time.LocalDate [arg0] + (cond (instance? java.time.Clock arg0) (let [^java.time.Clock clock arg0] + (java.time.LocalDate/now clock)) + (instance? java.time.ZoneId arg0) (let [^java.time.ZoneId zone arg0] + (java.time.LocalDate/now zone)) + :else (throw (java.lang.IllegalArgumentException. + "no corresponding java.time method with these args"))))) + +(defn at-start-of-day + {:arglists (quote (["java.time.LocalDate"] + ["java.time.LocalDate" "java.time.ZoneId"]))} + (^java.time.LocalDateTime [^java.time.LocalDate this] (.atStartOfDay this)) + (^java.time.ZonedDateTime [^java.time.LocalDate this ^java.time.ZoneId zone] + (.atStartOfDay this zone))) + +(defn get-month-value + "Gets the month-of-year field from 1 to 12. + + This method returns the month as an {@code int} from 1 to 12. + Application code is frequently clearer if the enum {@link Month} + is used by calling {@link #getMonth()}. + + @return the month-of-year, from 1 to 12 + @see #getMonth()" + {:arglists (quote (["java.time.LocalDate"]))} + (^java.lang.Integer [^java.time.LocalDate this] (.getMonthValue this))) + +(defn with-day-of-year + "Returns a copy of this {@code LocalDate} with the day-of-year altered. + + If the resulting date is invalid, an exception is thrown. + + This instance is immutable and unaffected by this method call. + + @param dayOfYear the day-of-year to set in the result, from 1 to 365-366 + @return a {@code LocalDate} based on this date with the requested day, not null + @throws DateTimeException if the day-of-year value is invalid, + or if the day-of-year is invalid for the year" + {:arglists (quote (["java.time.LocalDate" "int"]))} + (^java.time.LocalDate + [^java.time.LocalDate this ^java.lang.Integer day-of-year] + (.withDayOfYear this day-of-year))) + +(defn compare-to + "Compares this date to another date. + + The comparison is primarily based on the date, from earliest to latest. + It is \"consistent with equals\", as defined by {@link Comparable}. + + If all the dates being compared are instances of {@code LocalDate}, + then the comparison will be entirely based on the date. + If some dates being compared are in different chronologies, then the + chronology is also considered, see {@link java.time.chrono.ChronoLocalDate#compareTo}. + + @param other the other date to compare to, not null + @return the comparator value, negative if less, positive if greater" + {:arglists (quote (["java.time.LocalDate" + "java.time.chrono.ChronoLocalDate"]))} + (^java.lang.Integer + [^java.time.LocalDate this ^java.time.chrono.ChronoLocalDate other] + (.compareTo this other))) + +(defn get-month + "Gets the month-of-year field using the {@code Month} enum. + + This method returns the enum {@link Month} for the month. + This avoids confusion as to what {@code int} values mean. + If you need access to the primitive {@code int} value then the enum + provides the {@link Month#getValue() int value}. + + @return the month-of-year, not null + @see #getMonthValue()" + {:arglists (quote (["java.time.LocalDate"]))} + (^java.time.Month [^java.time.LocalDate this] (.getMonth this))) + +(defn of-year-day + "Obtains an instance of {@code LocalDate} from a year and day-of-year. + + This returns a {@code LocalDate} with the specified year and day-of-year. + The day-of-year must be valid for the year, otherwise an exception will be thrown. + + @param year the year to represent, from MIN_YEAR to MAX_YEAR + @param dayOfYear the day-of-year to represent, from 1 to 366 + @return the local date, not null + @throws DateTimeException if the value of any field is out of range, + or if the day-of-year is invalid for the year" + {:arglists (quote (["int" "int"]))} + (^java.time.LocalDate [^java.lang.Integer year ^java.lang.Integer day-of-year] + (java.time.LocalDate/ofYearDay year day-of-year))) + +(defn get + "Gets the value of the specified field from this date as an {@code int}. + + This queries this date for the value of the specified field. + The returned value will always be within the valid range of values for the field. + If it is not possible to return the value, because the field is not supported + or for some other reason, an exception is thrown. + + If the field is a {@link ChronoField} then the query is implemented here. + The {@link #isSupported(TemporalField) supported fields} will return valid + values based on this date, except {@code EPOCH_DAY} and {@code PROLEPTIC_MONTH} + which are too large to fit in an {@code int} and throw a {@code DateTimeException}. + All other {@code ChronoField} instances will throw an {@code UnsupportedTemporalTypeException}. + + If the field is not a {@code ChronoField}, then the result of this method + is obtained by invoking {@code TemporalField.getFrom(TemporalAccessor)} + passing {@code this} as the argument. Whether the value can be obtained, + and what the value represents, is determined by the field. + + @param field the field to get, not null + @return the value for the field + @throws DateTimeException if a value for the field cannot be obtained or + the value is outside the range of valid values for the field + @throws UnsupportedTemporalTypeException if the field is not supported or + the range of values exceeds an {@code int} + @throws ArithmeticException if numeric overflow occurs" + {:arglists (quote (["java.time.LocalDate" + "java.time.temporal.TemporalField"]))} + (^java.lang.Integer + [^java.time.LocalDate this ^java.time.temporal.TemporalField field] + (.get this field))) + +(defn equals + "Checks if this date is equal to another date. + + Compares this {@code LocalDate} with another ensuring that the date is the same. + + Only objects of type {@code LocalDate} are compared, other types return false. + To compare the dates of two {@code TemporalAccessor} instances, including dates + in two different chronologies, use {@link ChronoField#EPOCH_DAY} as a comparator. + + @param obj the object to check, null returns false + @return true if this is equal to the other date" + {:arglists (quote (["java.time.LocalDate" "java.lang.Object"]))} + (^java.lang.Boolean [^java.time.LocalDate this ^java.lang.Object obj] + (.equals this obj))) + +(defn at-time + {:arglists (quote (["java.time.LocalDate" "java.time.LocalTime"] + ["java.time.LocalDate" "java.time.OffsetTime"] + ["java.time.LocalDate" "int" "int"] + ["java.time.LocalDate" "int" "int" "int"] + ["java.time.LocalDate" "int" "int" "int" "int"]))} + (^java.lang.Object [^java.time.LocalDate this arg0] + (cond (instance? java.time.LocalTime arg0) + (let [^java.time.LocalTime time arg0] (.atTime this time)) + (instance? java.time.OffsetTime arg0) + (let [^java.time.OffsetTime time arg0] (.atTime this time)) + :else (throw (java.lang.IllegalArgumentException. + "no corresponding java.time method with these args")))) + (^java.time.LocalDateTime + [^java.time.LocalDate this ^java.lang.Integer hour ^java.lang.Integer minute] + (.atTime this hour minute)) + (^java.time.LocalDateTime + [^java.time.LocalDate this ^java.lang.Integer hour ^java.lang.Integer minute + ^java.lang.Integer second] + (.atTime this hour minute second)) + (^java.time.LocalDateTime + [^java.time.LocalDate this ^java.lang.Integer hour ^java.lang.Integer minute + ^java.lang.Integer second ^java.lang.Integer nano-of-second] + (.atTime this hour minute second nano-of-second))) + +(defn format + "Formats this date using the specified formatter. + + This date will be passed to the formatter to produce a string. + + @param formatter the formatter to use, not null + @return the formatted date string, not null + @throws DateTimeException if an error occurs during printing" + {:arglists (quote (["java.time.LocalDate" + "java.time.format.DateTimeFormatter"]))} + (^java.lang.String + [^java.time.LocalDate this ^java.time.format.DateTimeFormatter formatter] + (.format this formatter))) + +(defn plus-years + "Returns a copy of this {@code LocalDate} with the specified number of years added. + + This method adds the specified amount to the years field in three steps: +
    +
  1. Add the input years to the year field
  2. +
  3. Check if the resulting date would be invalid
  4. +
  5. Adjust the day-of-month to the last valid day if necessary
  6. +
+ + For example, 2008-02-29 (leap year) plus one year would result in the + invalid date 2009-02-29 (standard year). Instead of returning an invalid + result, the last valid day of the month, 2009-02-28, is selected instead. + + This instance is immutable and unaffected by this method call. + + @param yearsToAdd the years to add, may be negative + @return a {@code LocalDate} based on this date with the years added, not null + @throws DateTimeException if the result exceeds the supported date range" + {:arglists (quote (["java.time.LocalDate" "long"]))} + (^java.time.LocalDate [^java.time.LocalDate this ^long years-to-add] + (.plusYears this years-to-add))) + +(defn minus-days + "Returns a copy of this {@code LocalDate} with the specified number of days subtracted. + + This method subtracts the specified amount from the days field decrementing the + month and year fields as necessary to ensure the result remains valid. + The result is only invalid if the maximum/minimum year is exceeded. + + For example, 2009-01-01 minus one day would result in 2008-12-31. + + This instance is immutable and unaffected by this method call. + + @param daysToSubtract the days to subtract, may be negative + @return a {@code LocalDate} based on this date with the days subtracted, not null + @throws DateTimeException if the result exceeds the supported date range" + {:arglists (quote (["java.time.LocalDate" "long"]))} + (^java.time.LocalDate [^java.time.LocalDate this ^long days-to-subtract] + (.minusDays this days-to-subtract))) diff --git a/src/cljc/java_time/local_date.cljs b/src/cljc/java_time/local_date.cljs index 3591af3..a7eb7c5 100644 --- a/src/cljc/java_time/local_date.cljs +++ b/src/cljc/java_time/local_date.cljs @@ -1,53 +1,804 @@ -(ns cljc.java-time.local-date (:refer-clojure :exclude [abs get range format min max next name resolve short]) (:require [cljc.java-time.extn.calendar-awareness] [goog.object] [java.time :refer [LocalDate]])) -(def max (goog.object/get java.time.LocalDate "MAX")) -(def min (goog.object/get java.time.LocalDate "MIN")) -(clojure.core/defn minus-weeks {:arglists (quote (["java.time.LocalDate" "long"]))} (^js/JSJoda.LocalDate [^js/JSJoda.LocalDate this13154 ^long long13155] (.minusWeeks this13154 long13155))) -(clojure.core/defn plus-weeks {:arglists (quote (["java.time.LocalDate" "long"]))} (^js/JSJoda.LocalDate [^js/JSJoda.LocalDate this13156 ^long long13157] (.plusWeeks this13156 long13157))) -(clojure.core/defn length-of-year {:arglists (quote (["java.time.LocalDate"]))} (^int [^js/JSJoda.LocalDate this13158] (.lengthOfYear this13158))) -(clojure.core/defn range {:arglists (quote (["java.time.LocalDate" "java.time.temporal.TemporalField"]))} (^js/JSJoda.ValueRange [^js/JSJoda.LocalDate this13159 ^js/JSJoda.TemporalField java-time-temporal-TemporalField13160] (.range this13159 java-time-temporal-TemporalField13160))) -(clojure.core/defn get-era {:arglists (quote (["java.time.LocalDate"]))} (^js/JSJoda.Era [^js/JSJoda.LocalDate this13161] (.era this13161))) -(clojure.core/defn of {:arglists (quote (["int" "int" "int"] ["int" "java.time.Month" "int"]))} (^js/JSJoda.LocalDate [G__13163 G__13164 G__13165] (js-invoke java.time.LocalDate "of" G__13163 G__13164 G__13165))) -(clojure.core/defn with-month {:arglists (quote (["java.time.LocalDate" "int"]))} (^js/JSJoda.LocalDate [^js/JSJoda.LocalDate this13166 ^int int13167] (.withMonth this13166 int13167))) -(clojure.core/defn is-equal {:arglists (quote (["java.time.LocalDate" "java.time.chrono.ChronoLocalDate"]))} (^boolean [^js/JSJoda.LocalDate this13168 ^js/JSJoda.ChronoLocalDate java-time-chrono-ChronoLocalDate13169] (.isEqual this13168 java-time-chrono-ChronoLocalDate13169))) -(clojure.core/defn get-year {:arglists (quote (["java.time.LocalDate"]))} (^int [^js/JSJoda.LocalDate this13170] (.year this13170))) -(clojure.core/defn to-epoch-day {:arglists (quote (["java.time.LocalDate"]))} (^long [^js/JSJoda.LocalDate this13171] (.toEpochDay this13171))) -(clojure.core/defn get-day-of-year {:arglists (quote (["java.time.LocalDate"]))} (^int [^js/JSJoda.LocalDate this13172] (.dayOfYear this13172))) -(clojure.core/defn plus {:arglists (quote (["java.time.LocalDate" "long" "java.time.temporal.TemporalUnit"] ["java.time.LocalDate" "java.time.temporal.TemporalAmount"]))} (^js/JSJoda.LocalDate [^js/JSJoda.LocalDate this13173 ^long long13174 ^js/JSJoda.TemporalUnit java-time-temporal-TemporalUnit13175] (.plus this13173 long13174 java-time-temporal-TemporalUnit13175)) (^js/JSJoda.LocalDate [^js/JSJoda.LocalDate this13176 ^js/JSJoda.TemporalAmount java-time-temporal-TemporalAmount13177] (.plus this13176 java-time-temporal-TemporalAmount13177))) -(clojure.core/defn is-leap-year {:arglists (quote (["java.time.LocalDate"]))} (^boolean [^js/JSJoda.LocalDate this13178] (.isLeapYear this13178))) -(clojure.core/defn query {:arglists (quote (["java.time.LocalDate" "java.time.temporal.TemporalQuery"]))} (^java.lang.Object [^js/JSJoda.LocalDate this13179 ^js/JSJoda.TemporalQuery java-time-temporal-TemporalQuery13180] (.query this13179 java-time-temporal-TemporalQuery13180))) -(clojure.core/defn get-day-of-week {:arglists (quote (["java.time.LocalDate"]))} (^js/JSJoda.DayOfWeek [^js/JSJoda.LocalDate this13181] (.dayOfWeek this13181))) -(clojure.core/defn to-string {:arglists (quote (["java.time.LocalDate"]))} (^java.lang.String [^js/JSJoda.LocalDate this13182] (.toString this13182))) -(clojure.core/defn plus-months {:arglists (quote (["java.time.LocalDate" "long"]))} (^js/JSJoda.LocalDate [^js/JSJoda.LocalDate this13183 ^long long13184] (.plusMonths this13183 long13184))) -(clojure.core/defn is-before {:arglists (quote (["java.time.LocalDate" "java.time.chrono.ChronoLocalDate"]))} (^boolean [^js/JSJoda.LocalDate this13185 ^js/JSJoda.ChronoLocalDate java-time-chrono-ChronoLocalDate13186] (.isBefore this13185 java-time-chrono-ChronoLocalDate13186))) -(clojure.core/defn minus-months {:arglists (quote (["java.time.LocalDate" "long"]))} (^js/JSJoda.LocalDate [^js/JSJoda.LocalDate this13187 ^long long13188] (.minusMonths this13187 long13188))) -(clojure.core/defn minus {:arglists (quote (["java.time.LocalDate" "long" "java.time.temporal.TemporalUnit"] ["java.time.LocalDate" "java.time.temporal.TemporalAmount"]))} (^js/JSJoda.LocalDate [^js/JSJoda.LocalDate this13189 ^long long13190 ^js/JSJoda.TemporalUnit java-time-temporal-TemporalUnit13191] (.minus this13189 long13190 java-time-temporal-TemporalUnit13191)) (^js/JSJoda.LocalDate [^js/JSJoda.LocalDate this13192 ^js/JSJoda.TemporalAmount java-time-temporal-TemporalAmount13193] (.minus this13192 java-time-temporal-TemporalAmount13193))) -(clojure.core/defn plus-days {:arglists (quote (["java.time.LocalDate" "long"]))} (^js/JSJoda.LocalDate [^js/JSJoda.LocalDate this13194 ^long long13195] (.plusDays this13194 long13195))) -(clojure.core/defn get-long {:arglists (quote (["java.time.LocalDate" "java.time.temporal.TemporalField"]))} (^long [^js/JSJoda.LocalDate this13196 ^js/JSJoda.TemporalField java-time-temporal-TemporalField13197] (.getLong this13196 java-time-temporal-TemporalField13197))) -(clojure.core/defn with-year {:arglists (quote (["java.time.LocalDate" "int"]))} (^js/JSJoda.LocalDate [^js/JSJoda.LocalDate this13198 ^int int13199] (.withYear this13198 int13199))) -(clojure.core/defn length-of-month {:arglists (quote (["java.time.LocalDate"]))} (^int [^js/JSJoda.LocalDate this13200] (.lengthOfMonth this13200))) -(clojure.core/defn until {:arglists (quote (["java.time.LocalDate" "java.time.chrono.ChronoLocalDate"] ["java.time.LocalDate" "java.time.temporal.Temporal" "java.time.temporal.TemporalUnit"]))} (^js/JSJoda.Period [^js/JSJoda.LocalDate this13201 ^js/JSJoda.ChronoLocalDate java-time-chrono-ChronoLocalDate13202] (.until this13201 java-time-chrono-ChronoLocalDate13202)) (^long [^js/JSJoda.LocalDate this13203 ^js/JSJoda.Temporal java-time-temporal-Temporal13204 ^js/JSJoda.TemporalUnit java-time-temporal-TemporalUnit13205] (.until this13203 java-time-temporal-Temporal13204 java-time-temporal-TemporalUnit13205))) -(clojure.core/defn of-epoch-day {:arglists (quote (["long"]))} (^js/JSJoda.LocalDate [^long long13206] (js-invoke java.time.LocalDate "ofEpochDay" long13206))) -(clojure.core/defn with-day-of-month {:arglists (quote (["java.time.LocalDate" "int"]))} (^js/JSJoda.LocalDate [^js/JSJoda.LocalDate this13207 ^int int13208] (.withDayOfMonth this13207 int13208))) -(clojure.core/defn get-day-of-month {:arglists (quote (["java.time.LocalDate"]))} (^int [^js/JSJoda.LocalDate this13209] (.dayOfMonth this13209))) -(clojure.core/defn from {:arglists (quote (["java.time.temporal.TemporalAccessor"]))} (^js/JSJoda.LocalDate [^js/JSJoda.TemporalAccessor java-time-temporal-TemporalAccessor13210] (js-invoke java.time.LocalDate "from" java-time-temporal-TemporalAccessor13210))) -(clojure.core/defn is-after {:arglists (quote (["java.time.LocalDate" "java.time.chrono.ChronoLocalDate"]))} (^boolean [^js/JSJoda.LocalDate this13211 ^js/JSJoda.ChronoLocalDate java-time-chrono-ChronoLocalDate13212] (.isAfter this13211 java-time-chrono-ChronoLocalDate13212))) -(clojure.core/defn is-supported {:arglists (quote (["java.time.LocalDate" "java.time.temporal.TemporalField"] ["java.time.LocalDate" "java.time.temporal.TemporalUnit"]))} (^boolean [this13213 G__13214] (.isSupported ^js/JSJoda.LocalDate this13213 G__13214))) -(clojure.core/defn minus-years {:arglists (quote (["java.time.LocalDate" "long"]))} (^js/JSJoda.LocalDate [^js/JSJoda.LocalDate this13215 ^long long13216] (.minusYears this13215 long13216))) -(clojure.core/defn get-chronology {:arglists (quote (["java.time.LocalDate"]))} (^js/JSJoda.IsoChronology [^js/JSJoda.LocalDate this13217] (.chronology this13217))) -(clojure.core/defn parse {:arglists (quote (["java.lang.CharSequence" "java.time.format.DateTimeFormatter"] ["java.lang.CharSequence"]))} (^js/JSJoda.LocalDate [^java.lang.CharSequence java-lang-CharSequence13218 ^js/JSJoda.DateTimeFormatter java-time-format-DateTimeFormatter13219] (js-invoke java.time.LocalDate "parse" java-lang-CharSequence13218 java-time-format-DateTimeFormatter13219)) (^js/JSJoda.LocalDate [^java.lang.CharSequence java-lang-CharSequence13220] (js-invoke java.time.LocalDate "parse" java-lang-CharSequence13220))) -(clojure.core/defn hash-code {:arglists (quote (["java.time.LocalDate"]))} (^int [^js/JSJoda.LocalDate this13221] (.hashCode this13221))) -(clojure.core/defn adjust-into {:arglists (quote (["java.time.LocalDate" "java.time.temporal.Temporal"]))} (^js/JSJoda.Temporal [^js/JSJoda.LocalDate this13222 ^js/JSJoda.Temporal java-time-temporal-Temporal13223] (.adjustInto this13222 java-time-temporal-Temporal13223))) -(clojure.core/defn with {:arglists (quote (["java.time.LocalDate" "java.time.temporal.TemporalField" "long"] ["java.time.LocalDate" "java.time.temporal.TemporalAdjuster"]))} (^js/JSJoda.LocalDate [^js/JSJoda.LocalDate this13224 ^js/JSJoda.TemporalField java-time-temporal-TemporalField13225 ^long long13226] (.with this13224 java-time-temporal-TemporalField13225 long13226)) (^js/JSJoda.LocalDate [^js/JSJoda.LocalDate this13227 ^js/JSJoda.TemporalAdjuster java-time-temporal-TemporalAdjuster13228] (.with this13227 java-time-temporal-TemporalAdjuster13228))) -(clojure.core/defn now {:arglists (quote ([] ["java.time.ZoneId"] ["java.time.Clock"]))} (^js/JSJoda.LocalDate [] (js-invoke java.time.LocalDate "now")) (^js/JSJoda.LocalDate [G__13230] (js-invoke java.time.LocalDate "now" G__13230))) -(clojure.core/defn at-start-of-day {:arglists (quote (["java.time.LocalDate" "java.time.ZoneId"] ["java.time.LocalDate"]))} (^js/JSJoda.ZonedDateTime [^js/JSJoda.LocalDate this13231 ^js/JSJoda.ZoneId java-time-ZoneId13232] (.atStartOfDay this13231 java-time-ZoneId13232)) (^js/JSJoda.LocalDateTime [^js/JSJoda.LocalDate this13233] (.atStartOfDay this13233))) -(clojure.core/defn get-month-value {:arglists (quote (["java.time.LocalDate"]))} (^int [^js/JSJoda.LocalDate this13234] (.monthValue this13234))) -(clojure.core/defn with-day-of-year {:arglists (quote (["java.time.LocalDate" "int"]))} (^js/JSJoda.LocalDate [^js/JSJoda.LocalDate this13235 ^int int13236] (.withDayOfYear this13235 int13236))) -(clojure.core/defn compare-to {:arglists (quote (["java.time.LocalDate" "java.time.chrono.ChronoLocalDate"]))} (^int [^js/JSJoda.LocalDate this13237 ^js/JSJoda.ChronoLocalDate java-time-chrono-ChronoLocalDate13238] (.compareTo this13237 java-time-chrono-ChronoLocalDate13238))) -(clojure.core/defn get-month {:arglists (quote (["java.time.LocalDate"]))} (^js/JSJoda.Month [^js/JSJoda.LocalDate this13239] (.month this13239))) -(clojure.core/defn of-year-day {:arglists (quote (["int" "int"]))} (^js/JSJoda.LocalDate [^int int13240 ^int int13241] (js-invoke java.time.LocalDate "ofYearDay" int13240 int13241))) -(clojure.core/defn get {:arglists (quote (["java.time.LocalDate" "java.time.temporal.TemporalField"]))} (^int [^js/JSJoda.LocalDate this13242 ^js/JSJoda.TemporalField java-time-temporal-TemporalField13243] (.get this13242 java-time-temporal-TemporalField13243))) -(clojure.core/defn equals {:arglists (quote (["java.time.LocalDate" "java.lang.Object"]))} (^boolean [^js/JSJoda.LocalDate this13244 ^java.lang.Object java-lang-Object13245] (.equals this13244 java-lang-Object13245))) -(clojure.core/defn at-time {:arglists (quote (["java.time.LocalDate" "java.time.LocalTime"] ["java.time.LocalDate" "int" "int" "int"] ["java.time.LocalDate" "int" "int" "int" "int"] ["java.time.LocalDate" "java.time.OffsetTime"] ["java.time.LocalDate" "int" "int"]))} (^java.lang.Object [this13246 G__13247] (.atTime ^js/JSJoda.LocalDate this13246 G__13247)) (^js/JSJoda.LocalDateTime [^js/JSJoda.LocalDate this13248 ^int int13249 ^int int13250 ^int int13251] (.atTime this13248 int13249 int13250 int13251)) (^js/JSJoda.LocalDateTime [^js/JSJoda.LocalDate this13252 ^int int13253 ^int int13254 ^int int13255 ^int int13256] (.atTime this13252 int13253 int13254 int13255 int13256)) (^js/JSJoda.LocalDateTime [^js/JSJoda.LocalDate this13257 ^int int13258 ^int int13259] (.atTime this13257 int13258 int13259))) -(clojure.core/defn format {:arglists (quote (["java.time.LocalDate" "java.time.format.DateTimeFormatter"]))} (^java.lang.String [^js/JSJoda.LocalDate this13260 ^js/JSJoda.DateTimeFormatter java-time-format-DateTimeFormatter13261] (.format this13260 java-time-format-DateTimeFormatter13261))) -(clojure.core/defn plus-years {:arglists (quote (["java.time.LocalDate" "long"]))} (^js/JSJoda.LocalDate [^js/JSJoda.LocalDate this13262 ^long long13263] (.plusYears this13262 long13263))) -(clojure.core/defn minus-days {:arglists (quote (["java.time.LocalDate" "long"]))} (^js/JSJoda.LocalDate [^js/JSJoda.LocalDate this13264 ^long long13265] (.minusDays this13264 long13265))) +(ns cljc.java-time.local-date + (:refer-clojure :exclude + [abs get range format min max next name resolve short]) + (:require [cljc.java-time.extn.calendar-awareness] + [goog.object] + [java.time :refer [LocalDate]])) + +(def max + "The maximum supported {@code LocalDate}, '+999999999-12-31'. + This could be used by an application as a \"far future\" date." + (goog.object/get java.time.LocalDate "MAX")) + +(def min + "The minimum supported {@code LocalDate}, '-999999999-01-01'. + This could be used by an application as a \"far past\" date." + (goog.object/get java.time.LocalDate "MIN")) + +(defn minus-weeks + "Returns a copy of this {@code LocalDate} with the specified number of weeks subtracted. + + This method subtracts the specified amount in weeks from the days field decrementing + the month and year fields as necessary to ensure the result remains valid. + The result is only invalid if the maximum/minimum year is exceeded. + + For example, 2009-01-07 minus one week would result in 2008-12-31. + + This instance is immutable and unaffected by this method call. + + @param weeksToSubtract the weeks to subtract, may be negative + @return a {@code LocalDate} based on this date with the weeks subtracted, not null + @throws DateTimeException if the result exceeds the supported date range" + {:arglists (quote (["java.time.LocalDate" "long"]))} + (^js/JSJoda.LocalDate [^js/JSJoda.LocalDate this ^long weeks-to-subtract] + (.minusWeeks this weeks-to-subtract))) + +(defn plus-weeks + "Returns a copy of this {@code LocalDate} with the specified number of weeks added. + + This method adds the specified amount in weeks to the days field incrementing + the month and year fields as necessary to ensure the result remains valid. + The result is only invalid if the maximum/minimum year is exceeded. + + For example, 2008-12-31 plus one week would result in 2009-01-07. + + This instance is immutable and unaffected by this method call. + + @param weeksToAdd the weeks to add, may be negative + @return a {@code LocalDate} based on this date with the weeks added, not null + @throws DateTimeException if the result exceeds the supported date range" + {:arglists (quote (["java.time.LocalDate" "long"]))} + (^js/JSJoda.LocalDate [^js/JSJoda.LocalDate this ^long weeks-to-add] + (.plusWeeks this weeks-to-add))) + +(defn length-of-year + "Returns the length of the year represented by this date. + + This returns the length of the year in days, either 365 or 366. + + @return 366 if the year is leap, 365 otherwise" + {:arglists (quote (["java.time.LocalDate"]))} + (^int [^js/JSJoda.LocalDate this] (.lengthOfYear this))) + +(defn range + "Gets the range of valid values for the specified field. + + The range object expresses the minimum and maximum valid values for a field. + This date is used to enhance the accuracy of the returned range. + If it is not possible to return the range, because the field is not supported + or for some other reason, an exception is thrown. + + If the field is a {@link ChronoField} then the query is implemented here. + The {@link #isSupported(TemporalField) supported fields} will return + appropriate range instances. + All other {@code ChronoField} instances will throw an {@code UnsupportedTemporalTypeException}. + + If the field is not a {@code ChronoField}, then the result of this method + is obtained by invoking {@code TemporalField.rangeRefinedBy(TemporalAccessor)} + passing {@code this} as the argument. + Whether the range can be obtained is determined by the field. + + @param field the field to query the range for, not null + @return the range of valid values for the field, not null + @throws DateTimeException if the range for the field cannot be obtained + @throws UnsupportedTemporalTypeException if the field is not supported" + {:arglists (quote (["java.time.LocalDate" + "java.time.temporal.TemporalField"]))} + (^js/JSJoda.ValueRange + [^js/JSJoda.LocalDate this ^js/JSJoda.TemporalField field] + (.range this field))) + +(defn get-era + "Gets the era applicable at this date. + + The official ISO-8601 standard does not define eras, however {@code IsoChronology} does. + It defines two eras, 'CE' from year one onwards and 'BCE' from year zero backwards. + Since dates before the Julian-Gregorian cutover are not in line with history, + the cutover between 'BCE' and 'CE' is also not aligned with the commonly used + eras, often referred to using 'BC' and 'AD'. + + Users of this class should typically ignore this method as it exists primarily + to fulfill the {@link ChronoLocalDate} contract where it is necessary to support + the Japanese calendar system. + + The returned era will be a singleton capable of being compared with the constants + in {@link IsoChronology} using the {@code ==} operator. + + @return the {@code IsoChronology} era constant applicable at this date, not null" + {:arglists (quote (["java.time.LocalDate"]))} + (^js/JSJoda.Era [^js/JSJoda.LocalDate this] (.era this))) + +(defn of + {:arglists (quote (["int" "int" "int"] ["int" "java.time.Month" "int"]))} + (^js/JSJoda.LocalDate [arg0 arg1 arg2] + (js-invoke java.time.LocalDate "of" arg0 arg1 arg2))) + +(defn with-month + "Returns a copy of this {@code LocalDate} with the month-of-year altered. + + If the day-of-month is invalid for the year, it will be changed to the last valid day of the month. + + This instance is immutable and unaffected by this method call. + + @param month the month-of-year to set in the result, from 1 (January) to 12 (December) + @return a {@code LocalDate} based on this date with the requested month, not null + @throws DateTimeException if the month-of-year value is invalid" + {:arglists (quote (["java.time.LocalDate" "int"]))} + (^js/JSJoda.LocalDate [^js/JSJoda.LocalDate this ^int month] + (.withMonth this month))) + +(defn is-equal + "Checks if this date is equal to the specified date. + + This checks to see if this date represents the same point on the + local time-line as the other date. +
+   LocalDate a = LocalDate.of(2012, 6, 30);
+   LocalDate b = LocalDate.of(2012, 7, 1);
+   a.isEqual(b) == false
+   a.isEqual(a) == true
+   b.isEqual(a) == false
+ 
+ + This method only considers the position of the two dates on the local time-line. + It does not take into account the chronology, or calendar system. + This is different from the comparison in {@link #compareTo(ChronoLocalDate)} + but is the same approach as {@link ChronoLocalDate#timeLineOrder()}. + + @param other the other date to compare to, not null + @return true if this date is equal to the specified date" + {:arglists (quote (["java.time.LocalDate" + "java.time.chrono.ChronoLocalDate"]))} + (^boolean [^js/JSJoda.LocalDate this ^js/JSJoda.ChronoLocalDate other] + (.isEqual this other))) + +(defn get-year + "Gets the year field. + + This method returns the primitive {@code int} value for the year. + + The year returned by this method is proleptic as per {@code get(YEAR)}. + To obtain the year-of-era, use {@code get(YEAR_OF_ERA)}. + + @return the year, from MIN_YEAR to MAX_YEAR" + {:arglists (quote (["java.time.LocalDate"]))} + (^int [^js/JSJoda.LocalDate this] (.year this))) + +(defn to-epoch-day + {:arglists (quote (["java.time.LocalDate"]))} + (^long [^js/JSJoda.LocalDate this] (.toEpochDay this))) + +(defn get-day-of-year + "Gets the day-of-year field. + + This method returns the primitive {@code int} value for the day-of-year. + + @return the day-of-year, from 1 to 365, or 366 in a leap year" + {:arglists (quote (["java.time.LocalDate"]))} + (^int [^js/JSJoda.LocalDate this] (.dayOfYear this))) + +(defn plus + {:arglists (quote (["java.time.LocalDate" "java.time.temporal.TemporalAmount"] + ["java.time.LocalDate" "long" + "java.time.temporal.TemporalUnit"]))} + (^js/JSJoda.LocalDate + [^js/JSJoda.LocalDate this ^js/JSJoda.TemporalAmount amount-to-add] + (.plus this amount-to-add)) + (^js/JSJoda.LocalDate + [^js/JSJoda.LocalDate this ^long amount-to-add ^js/JSJoda.TemporalUnit unit] + (.plus this amount-to-add unit))) + +(defn is-leap-year + "Checks if the year is a leap year, according to the ISO proleptic + calendar system rules. + + This method applies the current rules for leap years across the whole time-line. + In general, a year is a leap year if it is divisible by four without + remainder. However, years divisible by 100, are not leap years, with + the exception of years divisible by 400 which are. + + For example, 1904 is a leap year it is divisible by 4. + 1900 was not a leap year as it is divisible by 100, however 2000 was a + leap year as it is divisible by 400. + + The calculation is proleptic - applying the same rules into the far future and far past. + This is historically inaccurate, but is correct for the ISO-8601 standard. + + @return true if the year is leap, false otherwise" + {:arglists (quote (["java.time.LocalDate"]))} + (^boolean [^js/JSJoda.LocalDate this] (.isLeapYear this))) + +(defn query + "Queries this date using the specified query. + + This queries this date using the specified query strategy object. + The {@code TemporalQuery} object defines the logic to be used to + obtain the result. Read the documentation of the query to understand + what the result of this method will be. + + The result of this method is obtained by invoking the + {@link TemporalQuery#queryFrom(TemporalAccessor)} method on the + specified query passing {@code this} as the argument. + + @param the type of the result + @param query the query to invoke, not null + @return the query result, null may be returned (defined by the query) + @throws DateTimeException if unable to query (defined by the query) + @throws ArithmeticException if numeric overflow occurs (defined by the query)" + {:arglists (quote (["java.time.LocalDate" + "java.time.temporal.TemporalQuery"]))} + (^java.lang.Object [^js/JSJoda.LocalDate this ^js/JSJoda.TemporalQuery query] + (.query this query))) + +(defn get-day-of-week + "Gets the day-of-week field, which is an enum {@code DayOfWeek}. + + This method returns the enum {@link DayOfWeek} for the day-of-week. + This avoids confusion as to what {@code int} values mean. + If you need access to the primitive {@code int} value then the enum + provides the {@link DayOfWeek#getValue() int value}. + + Additional information can be obtained from the {@code DayOfWeek}. + This includes textual names of the values. + + @return the day-of-week, not null" + {:arglists (quote (["java.time.LocalDate"]))} + (^js/JSJoda.DayOfWeek [^js/JSJoda.LocalDate this] (.dayOfWeek this))) + +(defn to-string + "Outputs this date as a {@code String}, such as {@code 2007-12-03}. + + The output will be in the ISO-8601 format {@code uuuu-MM-dd}. + + @return a string representation of this date, not null" + {:arglists (quote (["java.time.LocalDate"]))} + (^java.lang.String [^js/JSJoda.LocalDate this] (.toString this))) + +(defn plus-months + "Returns a copy of this {@code LocalDate} with the specified number of months added. + + This method adds the specified amount to the months field in three steps: +
    +
  1. Add the input months to the month-of-year field
  2. +
  3. Check if the resulting date would be invalid
  4. +
  5. Adjust the day-of-month to the last valid day if necessary
  6. +
+ + For example, 2007-03-31 plus one month would result in the invalid date + 2007-04-31. Instead of returning an invalid result, the last valid day + of the month, 2007-04-30, is selected instead. + + This instance is immutable and unaffected by this method call. + + @param monthsToAdd the months to add, may be negative + @return a {@code LocalDate} based on this date with the months added, not null + @throws DateTimeException if the result exceeds the supported date range" + {:arglists (quote (["java.time.LocalDate" "long"]))} + (^js/JSJoda.LocalDate [^js/JSJoda.LocalDate this ^long months-to-add] + (.plusMonths this months-to-add))) + +(defn is-before + "Checks if this date is before the specified date. + + This checks to see if this date represents a point on the + local time-line before the other date. +
+   LocalDate a = LocalDate.of(2012, 6, 30);
+   LocalDate b = LocalDate.of(2012, 7, 1);
+   a.isBefore(b) == true
+   a.isBefore(a) == false
+   b.isBefore(a) == false
+ 
+ + This method only considers the position of the two dates on the local time-line. + It does not take into account the chronology, or calendar system. + This is different from the comparison in {@link #compareTo(ChronoLocalDate)}, + but is the same approach as {@link ChronoLocalDate#timeLineOrder()}. + + @param other the other date to compare to, not null + @return true if this date is before the specified date" + {:arglists (quote (["java.time.LocalDate" + "java.time.chrono.ChronoLocalDate"]))} + (^boolean [^js/JSJoda.LocalDate this ^js/JSJoda.ChronoLocalDate other] + (.isBefore this other))) + +(defn minus-months + "Returns a copy of this {@code LocalDate} with the specified number of months subtracted. + + This method subtracts the specified amount from the months field in three steps: +
    +
  1. Subtract the input months from the month-of-year field
  2. +
  3. Check if the resulting date would be invalid
  4. +
  5. Adjust the day-of-month to the last valid day if necessary
  6. +
+ + For example, 2007-03-31 minus one month would result in the invalid date + 2007-02-31. Instead of returning an invalid result, the last valid day + of the month, 2007-02-28, is selected instead. + + This instance is immutable and unaffected by this method call. + + @param monthsToSubtract the months to subtract, may be negative + @return a {@code LocalDate} based on this date with the months subtracted, not null + @throws DateTimeException if the result exceeds the supported date range" + {:arglists (quote (["java.time.LocalDate" "long"]))} + (^js/JSJoda.LocalDate [^js/JSJoda.LocalDate this ^long months-to-subtract] + (.minusMonths this months-to-subtract))) + +(defn minus + {:arglists (quote (["java.time.LocalDate" "java.time.temporal.TemporalAmount"] + ["java.time.LocalDate" "long" + "java.time.temporal.TemporalUnit"]))} + (^js/JSJoda.LocalDate + [^js/JSJoda.LocalDate this ^js/JSJoda.TemporalAmount amount-to-subtract] + (.minus this amount-to-subtract)) + (^js/JSJoda.LocalDate + [^js/JSJoda.LocalDate this ^long amount-to-subtract + ^js/JSJoda.TemporalUnit unit] + (.minus this amount-to-subtract unit))) + +(defn plus-days + "Returns a copy of this {@code LocalDate} with the specified number of days added. + + This method adds the specified amount to the days field incrementing the + month and year fields as necessary to ensure the result remains valid. + The result is only invalid if the maximum/minimum year is exceeded. + + For example, 2008-12-31 plus one day would result in 2009-01-01. + + This instance is immutable and unaffected by this method call. + + @param daysToAdd the days to add, may be negative + @return a {@code LocalDate} based on this date with the days added, not null + @throws DateTimeException if the result exceeds the supported date range" + {:arglists (quote (["java.time.LocalDate" "long"]))} + (^js/JSJoda.LocalDate [^js/JSJoda.LocalDate this ^long days-to-add] + (.plusDays this days-to-add))) + +(defn get-long + "Gets the value of the specified field from this date as a {@code long}. + + This queries this date for the value of the specified field. + If it is not possible to return the value, because the field is not supported + or for some other reason, an exception is thrown. + + If the field is a {@link ChronoField} then the query is implemented here. + The {@link #isSupported(TemporalField) supported fields} will return valid + values based on this date. + All other {@code ChronoField} instances will throw an {@code UnsupportedTemporalTypeException}. + + If the field is not a {@code ChronoField}, then the result of this method + is obtained by invoking {@code TemporalField.getFrom(TemporalAccessor)} + passing {@code this} as the argument. Whether the value can be obtained, + and what the value represents, is determined by the field. + + @param field the field to get, not null + @return the value for the field + @throws DateTimeException if a value for the field cannot be obtained + @throws UnsupportedTemporalTypeException if the field is not supported + @throws ArithmeticException if numeric overflow occurs" + {:arglists (quote (["java.time.LocalDate" + "java.time.temporal.TemporalField"]))} + (^long [^js/JSJoda.LocalDate this ^js/JSJoda.TemporalField field] + (.getLong this field))) + +(defn with-year + "Returns a copy of this {@code LocalDate} with the year altered. + + If the day-of-month is invalid for the year, it will be changed to the last valid day of the month. + + This instance is immutable and unaffected by this method call. + + @param year the year to set in the result, from MIN_YEAR to MAX_YEAR + @return a {@code LocalDate} based on this date with the requested year, not null + @throws DateTimeException if the year value is invalid" + {:arglists (quote (["java.time.LocalDate" "int"]))} + (^js/JSJoda.LocalDate [^js/JSJoda.LocalDate this ^int year] + (.withYear this year))) + +(defn length-of-month + "Returns the length of the month represented by this date. + + This returns the length of the month in days. + For example, a date in January would return 31. + + @return the length of the month in days" + {:arglists (quote (["java.time.LocalDate"]))} + (^int [^js/JSJoda.LocalDate this] (.lengthOfMonth this))) + +(defn until + {:arglists (quote (["java.time.LocalDate" "java.time.chrono.ChronoLocalDate"] + ["java.time.LocalDate" "java.time.temporal.Temporal" + "java.time.temporal.TemporalUnit"]))} + (^js/JSJoda.Period + [^js/JSJoda.LocalDate this ^js/JSJoda.ChronoLocalDate end-date-exclusive] + (.until this end-date-exclusive)) + (^long + [^js/JSJoda.LocalDate this ^js/JSJoda.Temporal end-exclusive + ^js/JSJoda.TemporalUnit unit] + (.until this end-exclusive unit))) + +(defn of-epoch-day + "Obtains an instance of {@code LocalDate} from the epoch day count. + + This returns a {@code LocalDate} with the specified epoch-day. + The {@link ChronoField#EPOCH_DAY EPOCH_DAY} is a simple incrementing count + of days where day 0 is 1970-01-01. Negative numbers represent earlier days. + + @param epochDay the Epoch Day to convert, based on the epoch 1970-01-01 + @return the local date, not null + @throws DateTimeException if the epoch day exceeds the supported date range" + {:arglists (quote (["long"]))} + (^js/JSJoda.LocalDate [^long epoch-day] + (js-invoke java.time.LocalDate "ofEpochDay" epoch-day))) + +(defn with-day-of-month + "Returns a copy of this {@code LocalDate} with the day-of-month altered. + + If the resulting date is invalid, an exception is thrown. + + This instance is immutable and unaffected by this method call. + + @param dayOfMonth the day-of-month to set in the result, from 1 to 28-31 + @return a {@code LocalDate} based on this date with the requested day, not null + @throws DateTimeException if the day-of-month value is invalid, + or if the day-of-month is invalid for the month-year" + {:arglists (quote (["java.time.LocalDate" "int"]))} + (^js/JSJoda.LocalDate [^js/JSJoda.LocalDate this ^int day-of-month] + (.withDayOfMonth this day-of-month))) + +(defn get-day-of-month + "Gets the day-of-month field. + + This method returns the primitive {@code int} value for the day-of-month. + + @return the day-of-month, from 1 to 31" + {:arglists (quote (["java.time.LocalDate"]))} + (^int [^js/JSJoda.LocalDate this] (.dayOfMonth this))) + +(defn from + "Obtains an instance of {@code LocalDate} from a temporal object. + + This obtains a local date based on the specified temporal. + A {@code TemporalAccessor} represents an arbitrary set of date and time information, + which this factory converts to an instance of {@code LocalDate}. + + The conversion uses the {@link TemporalQueries#localDate()} query, which relies + on extracting the {@link ChronoField#EPOCH_DAY EPOCH_DAY} field. + + This method matches the signature of the functional interface {@link TemporalQuery} + allowing it to be used as a query via method reference, {@code LocalDate::from}. + + @param temporal the temporal object to convert, not null + @return the local date, not null + @throws DateTimeException if unable to convert to a {@code LocalDate}" + {:arglists (quote (["java.time.temporal.TemporalAccessor"]))} + (^js/JSJoda.LocalDate [^js/JSJoda.TemporalAccessor temporal] + (js-invoke java.time.LocalDate "from" temporal))) + +(defn is-after + "Checks if this date is after the specified date. + + This checks to see if this date represents a point on the + local time-line after the other date. +
+   LocalDate a = LocalDate.of(2012, 6, 30);
+   LocalDate b = LocalDate.of(2012, 7, 1);
+   a.isAfter(b) == false
+   a.isAfter(a) == false
+   b.isAfter(a) == true
+ 
+ + This method only considers the position of the two dates on the local time-line. + It does not take into account the chronology, or calendar system. + This is different from the comparison in {@link #compareTo(ChronoLocalDate)}, + but is the same approach as {@link ChronoLocalDate#timeLineOrder()}. + + @param other the other date to compare to, not null + @return true if this date is after the specified date" + {:arglists (quote (["java.time.LocalDate" + "java.time.chrono.ChronoLocalDate"]))} + (^boolean [^js/JSJoda.LocalDate this ^js/JSJoda.ChronoLocalDate other] + (.isAfter this other))) + +(defn is-supported + {:arglists (quote (["java.time.LocalDate" "java.time.temporal.TemporalField"] + ["java.time.LocalDate" + "java.time.temporal.TemporalUnit"]))} + (^boolean [^js/JSJoda.LocalDate this arg0] + (.isSupported ^js/JSJoda.LocalDate this arg0))) + +(defn minus-years + "Returns a copy of this {@code LocalDate} with the specified number of years subtracted. + + This method subtracts the specified amount from the years field in three steps: +
    +
  1. Subtract the input years from the year field
  2. +
  3. Check if the resulting date would be invalid
  4. +
  5. Adjust the day-of-month to the last valid day if necessary
  6. +
+ + For example, 2008-02-29 (leap year) minus one year would result in the + invalid date 2007-02-29 (standard year). Instead of returning an invalid + result, the last valid day of the month, 2007-02-28, is selected instead. + + This instance is immutable and unaffected by this method call. + + @param yearsToSubtract the years to subtract, may be negative + @return a {@code LocalDate} based on this date with the years subtracted, not null + @throws DateTimeException if the result exceeds the supported date range" + {:arglists (quote (["java.time.LocalDate" "long"]))} + (^js/JSJoda.LocalDate [^js/JSJoda.LocalDate this ^long years-to-subtract] + (.minusYears this years-to-subtract))) + +(defn get-chronology + "Gets the chronology of this date, which is the ISO calendar system. + + The {@code Chronology} represents the calendar system in use. + The ISO-8601 calendar system is the modern civil calendar system used today + in most of the world. It is equivalent to the proleptic Gregorian calendar + system, in which today's rules for leap years are applied for all time. + + @return the ISO chronology, not null" + {:arglists (quote (["java.time.LocalDate"]))} + (^js/JSJoda.IsoChronology [^js/JSJoda.LocalDate this] (.chronology this))) + +(defn parse + {:arglists (quote (["java.lang.CharSequence"] + ["java.lang.CharSequence" + "java.time.format.DateTimeFormatter"]))} + (^js/JSJoda.LocalDate [^java.lang.CharSequence text] + (js-invoke java.time.LocalDate "parse" text)) + (^js/JSJoda.LocalDate + [^java.lang.CharSequence text ^js/JSJoda.DateTimeFormatter formatter] + (js-invoke java.time.LocalDate "parse" text formatter))) + +(defn hash-code + "A hash code for this date. + + @return a suitable hash code" + {:arglists (quote (["java.time.LocalDate"]))} + (^int [^js/JSJoda.LocalDate this] (.hashCode this))) + +(defn adjust-into + "Adjusts the specified temporal object to have the same date as this object. + + This returns a temporal object of the same observable type as the input + with the date changed to be the same as this. + + The adjustment is equivalent to using {@link Temporal#with(TemporalField, long)} + passing {@link ChronoField#EPOCH_DAY} as the field. + + In most cases, it is clearer to reverse the calling pattern by using + {@link Temporal#with(TemporalAdjuster)}: +
+   // these two lines are equivalent, but the second approach is recommended
+   temporal = thisLocalDate.adjustInto(temporal);
+   temporal = temporal.with(thisLocalDate);
+ 
+ + This instance is immutable and unaffected by this method call. + + @param temporal the target object to be adjusted, not null + @return the adjusted object, not null + @throws DateTimeException if unable to make the adjustment + @throws ArithmeticException if numeric overflow occurs" + {:arglists (quote (["java.time.LocalDate" "java.time.temporal.Temporal"]))} + (^js/JSJoda.Temporal [^js/JSJoda.LocalDate this ^js/JSJoda.Temporal temporal] + (.adjustInto this temporal))) + +(defn with + {:arglists (quote (["java.time.LocalDate" + "java.time.temporal.TemporalAdjuster"] + ["java.time.LocalDate" "java.time.temporal.TemporalField" + "long"]))} + (^js/JSJoda.LocalDate + [^js/JSJoda.LocalDate this ^js/JSJoda.TemporalAdjuster adjuster] + (.with this adjuster)) + (^js/JSJoda.LocalDate + [^js/JSJoda.LocalDate this ^js/JSJoda.TemporalField field ^long new-value] + (.with this field new-value))) + +(defn now + {:arglists (quote ([] ["java.time.Clock"] ["java.time.ZoneId"]))} + (^js/JSJoda.LocalDate [] (js-invoke java.time.LocalDate "now")) + (^js/JSJoda.LocalDate [arg0] (js-invoke java.time.LocalDate "now" arg0))) + +(defn at-start-of-day + {:arglists (quote (["java.time.LocalDate"] + ["java.time.LocalDate" "java.time.ZoneId"]))} + (^js/JSJoda.LocalDateTime [^js/JSJoda.LocalDate this] (.atStartOfDay this)) + (^js/JSJoda.ZonedDateTime [^js/JSJoda.LocalDate this ^js/JSJoda.ZoneId zone] + (.atStartOfDay this zone))) + +(defn get-month-value + "Gets the month-of-year field from 1 to 12. + + This method returns the month as an {@code int} from 1 to 12. + Application code is frequently clearer if the enum {@link Month} + is used by calling {@link #getMonth()}. + + @return the month-of-year, from 1 to 12 + @see #getMonth()" + {:arglists (quote (["java.time.LocalDate"]))} + (^int [^js/JSJoda.LocalDate this] (.monthValue this))) + +(defn with-day-of-year + "Returns a copy of this {@code LocalDate} with the day-of-year altered. + + If the resulting date is invalid, an exception is thrown. + + This instance is immutable and unaffected by this method call. + + @param dayOfYear the day-of-year to set in the result, from 1 to 365-366 + @return a {@code LocalDate} based on this date with the requested day, not null + @throws DateTimeException if the day-of-year value is invalid, + or if the day-of-year is invalid for the year" + {:arglists (quote (["java.time.LocalDate" "int"]))} + (^js/JSJoda.LocalDate [^js/JSJoda.LocalDate this ^int day-of-year] + (.withDayOfYear this day-of-year))) + +(defn compare-to + "Compares this date to another date. + + The comparison is primarily based on the date, from earliest to latest. + It is \"consistent with equals\", as defined by {@link Comparable}. + + If all the dates being compared are instances of {@code LocalDate}, + then the comparison will be entirely based on the date. + If some dates being compared are in different chronologies, then the + chronology is also considered, see {@link java.time.chrono.ChronoLocalDate#compareTo}. + + @param other the other date to compare to, not null + @return the comparator value, negative if less, positive if greater" + {:arglists (quote (["java.time.LocalDate" + "java.time.chrono.ChronoLocalDate"]))} + (^int [^js/JSJoda.LocalDate this ^js/JSJoda.ChronoLocalDate other] + (.compareTo this other))) + +(defn get-month + "Gets the month-of-year field using the {@code Month} enum. + + This method returns the enum {@link Month} for the month. + This avoids confusion as to what {@code int} values mean. + If you need access to the primitive {@code int} value then the enum + provides the {@link Month#getValue() int value}. + + @return the month-of-year, not null + @see #getMonthValue()" + {:arglists (quote (["java.time.LocalDate"]))} + (^js/JSJoda.Month [^js/JSJoda.LocalDate this] (.month this))) + +(defn of-year-day + "Obtains an instance of {@code LocalDate} from a year and day-of-year. + + This returns a {@code LocalDate} with the specified year and day-of-year. + The day-of-year must be valid for the year, otherwise an exception will be thrown. + + @param year the year to represent, from MIN_YEAR to MAX_YEAR + @param dayOfYear the day-of-year to represent, from 1 to 366 + @return the local date, not null + @throws DateTimeException if the value of any field is out of range, + or if the day-of-year is invalid for the year" + {:arglists (quote (["int" "int"]))} + (^js/JSJoda.LocalDate [^int year ^int day-of-year] + (js-invoke java.time.LocalDate "ofYearDay" year day-of-year))) + +(defn get + "Gets the value of the specified field from this date as an {@code int}. + + This queries this date for the value of the specified field. + The returned value will always be within the valid range of values for the field. + If it is not possible to return the value, because the field is not supported + or for some other reason, an exception is thrown. + + If the field is a {@link ChronoField} then the query is implemented here. + The {@link #isSupported(TemporalField) supported fields} will return valid + values based on this date, except {@code EPOCH_DAY} and {@code PROLEPTIC_MONTH} + which are too large to fit in an {@code int} and throw a {@code DateTimeException}. + All other {@code ChronoField} instances will throw an {@code UnsupportedTemporalTypeException}. + + If the field is not a {@code ChronoField}, then the result of this method + is obtained by invoking {@code TemporalField.getFrom(TemporalAccessor)} + passing {@code this} as the argument. Whether the value can be obtained, + and what the value represents, is determined by the field. + + @param field the field to get, not null + @return the value for the field + @throws DateTimeException if a value for the field cannot be obtained or + the value is outside the range of valid values for the field + @throws UnsupportedTemporalTypeException if the field is not supported or + the range of values exceeds an {@code int} + @throws ArithmeticException if numeric overflow occurs" + {:arglists (quote (["java.time.LocalDate" + "java.time.temporal.TemporalField"]))} + (^int [^js/JSJoda.LocalDate this ^js/JSJoda.TemporalField field] + (.get this field))) + +(defn equals + "Checks if this date is equal to another date. + + Compares this {@code LocalDate} with another ensuring that the date is the same. + + Only objects of type {@code LocalDate} are compared, other types return false. + To compare the dates of two {@code TemporalAccessor} instances, including dates + in two different chronologies, use {@link ChronoField#EPOCH_DAY} as a comparator. + + @param obj the object to check, null returns false + @return true if this is equal to the other date" + {:arglists (quote (["java.time.LocalDate" "java.lang.Object"]))} + (^boolean [^js/JSJoda.LocalDate this ^java.lang.Object obj] + (.equals this obj))) + +(defn at-time + {:arglists (quote (["java.time.LocalDate" "java.time.LocalTime"] + ["java.time.LocalDate" "java.time.OffsetTime"] + ["java.time.LocalDate" "int" "int"] + ["java.time.LocalDate" "int" "int" "int"] + ["java.time.LocalDate" "int" "int" "int" "int"]))} + (^java.lang.Object [^js/JSJoda.LocalDate this arg0] + (.atTime ^js/JSJoda.LocalDate this arg0)) + (^js/JSJoda.LocalDateTime [^js/JSJoda.LocalDate this ^int hour ^int minute] + (.atTime this hour minute)) + (^js/JSJoda.LocalDateTime + [^js/JSJoda.LocalDate this ^int hour ^int minute ^int second] + (.atTime this hour minute second)) + (^js/JSJoda.LocalDateTime + [^js/JSJoda.LocalDate this ^int hour ^int minute ^int second + ^int nano-of-second] + (.atTime this hour minute second nano-of-second))) + +(defn format + "Formats this date using the specified formatter. + + This date will be passed to the formatter to produce a string. + + @param formatter the formatter to use, not null + @return the formatted date string, not null + @throws DateTimeException if an error occurs during printing" + {:arglists (quote (["java.time.LocalDate" + "java.time.format.DateTimeFormatter"]))} + (^java.lang.String + [^js/JSJoda.LocalDate this ^js/JSJoda.DateTimeFormatter formatter] + (.format this formatter))) + +(defn plus-years + "Returns a copy of this {@code LocalDate} with the specified number of years added. + + This method adds the specified amount to the years field in three steps: +
    +
  1. Add the input years to the year field
  2. +
  3. Check if the resulting date would be invalid
  4. +
  5. Adjust the day-of-month to the last valid day if necessary
  6. +
+ + For example, 2008-02-29 (leap year) plus one year would result in the + invalid date 2009-02-29 (standard year). Instead of returning an invalid + result, the last valid day of the month, 2009-02-28, is selected instead. + + This instance is immutable and unaffected by this method call. + + @param yearsToAdd the years to add, may be negative + @return a {@code LocalDate} based on this date with the years added, not null + @throws DateTimeException if the result exceeds the supported date range" + {:arglists (quote (["java.time.LocalDate" "long"]))} + (^js/JSJoda.LocalDate [^js/JSJoda.LocalDate this ^long years-to-add] + (.plusYears this years-to-add))) + +(defn minus-days + "Returns a copy of this {@code LocalDate} with the specified number of days subtracted. + + This method subtracts the specified amount from the days field decrementing the + month and year fields as necessary to ensure the result remains valid. + The result is only invalid if the maximum/minimum year is exceeded. + + For example, 2009-01-01 minus one day would result in 2008-12-31. + + This instance is immutable and unaffected by this method call. + + @param daysToSubtract the days to subtract, may be negative + @return a {@code LocalDate} based on this date with the days subtracted, not null + @throws DateTimeException if the result exceeds the supported date range" + {:arglists (quote (["java.time.LocalDate" "long"]))} + (^js/JSJoda.LocalDate [^js/JSJoda.LocalDate this ^long days-to-subtract] + (.minusDays this days-to-subtract))) diff --git a/src/cljc/java_time/local_date_time.clj b/src/cljc/java_time/local_date_time.clj index abc52b9..9fb628a 100644 --- a/src/cljc/java_time/local_date_time.clj +++ b/src/cljc/java_time/local_date_time.clj @@ -1,69 +1,1228 @@ -(ns cljc.java-time.local-date-time (:refer-clojure :exclude [abs get range format min max next name resolve short]) (:require [cljc.java-time.extn.calendar-awareness]) (:import [java.time LocalDateTime])) -(def max java.time.LocalDateTime/MAX) -(def min java.time.LocalDateTime/MIN) -(clojure.core/defn minus-minutes {:arglists (quote (["java.time.LocalDateTime" "long"]))} (^java.time.LocalDateTime [^java.time.LocalDateTime this13266 ^long long13267] (.minusMinutes this13266 long13267))) -(clojure.core/defn truncated-to {:arglists (quote (["java.time.LocalDateTime" "java.time.temporal.TemporalUnit"]))} (^java.time.LocalDateTime [^java.time.LocalDateTime this13268 ^java.time.temporal.ChronoUnit java-time-temporal-TemporalUnit13269] (.truncatedTo this13268 java-time-temporal-TemporalUnit13269))) -(clojure.core/defn minus-weeks {:arglists (quote (["java.time.LocalDateTime" "long"]))} (^java.time.LocalDateTime [^java.time.LocalDateTime this13270 ^long long13271] (.minusWeeks this13270 long13271))) -(clojure.core/defn to-instant {:arglists (quote (["java.time.LocalDateTime" "java.time.ZoneOffset"]))} (^java.time.Instant [^java.time.LocalDateTime this13272 ^java.time.ZoneOffset java-time-ZoneOffset13273] (.toInstant this13272 java-time-ZoneOffset13273))) -(clojure.core/defn plus-weeks {:arglists (quote (["java.time.LocalDateTime" "long"]))} (^java.time.LocalDateTime [^java.time.LocalDateTime this13274 ^long long13275] (.plusWeeks this13274 long13275))) -(clojure.core/defn range {:arglists (quote (["java.time.LocalDateTime" "java.time.temporal.TemporalField"]))} (^java.time.temporal.ValueRange [^java.time.LocalDateTime this13276 ^java.time.temporal.TemporalField java-time-temporal-TemporalField13277] (.range this13276 java-time-temporal-TemporalField13277))) -(clojure.core/defn of-epoch-second {:arglists (quote (["long" "int" "java.time.ZoneOffset"]))} (^java.time.LocalDateTime [^long long13278 ^java.lang.Integer int13279 ^java.time.ZoneOffset java-time-ZoneOffset13280] (java.time.LocalDateTime/ofEpochSecond long13278 int13279 java-time-ZoneOffset13280))) -(clojure.core/defn get-hour {:arglists (quote (["java.time.LocalDateTime"]))} (^java.lang.Integer [^java.time.LocalDateTime this13281] (.getHour this13281))) -(clojure.core/defn at-offset {:arglists (quote (["java.time.LocalDateTime" "java.time.ZoneOffset"]))} (^java.time.OffsetDateTime [^java.time.LocalDateTime this13282 ^java.time.ZoneOffset java-time-ZoneOffset13283] (.atOffset this13282 java-time-ZoneOffset13283))) -(clojure.core/defn minus-hours {:arglists (quote (["java.time.LocalDateTime" "long"]))} (^java.time.LocalDateTime [^java.time.LocalDateTime this13284 ^long long13285] (.minusHours this13284 long13285))) -(clojure.core/defn of {:arglists (quote (["int" "java.time.Month" "int" "int" "int" "int"] ["int" "java.time.Month" "int" "int" "int" "int" "int"] ["int" "java.time.Month" "int" "int" "int"] ["java.time.LocalDate" "java.time.LocalTime"] ["int" "int" "int" "int" "int"] ["int" "int" "int" "int" "int" "int"] ["int" "int" "int" "int" "int" "int" "int"]))} (^java.time.LocalDateTime [G__13287 G__13288 G__13289 G__13290 G__13291 G__13292] (clojure.core/cond (clojure.core/and (clojure.core/instance? java.lang.Number G__13287) (clojure.core/instance? java.time.Month G__13288) (clojure.core/instance? java.lang.Number G__13289) (clojure.core/instance? java.lang.Number G__13290) (clojure.core/instance? java.lang.Number G__13291) (clojure.core/instance? java.lang.Number G__13292)) (clojure.core/let [G__13287 (clojure.core/int G__13287) G__13288 ^"java.time.Month" G__13288 G__13289 (clojure.core/int G__13289) G__13290 (clojure.core/int G__13290) G__13291 (clojure.core/int G__13291) G__13292 (clojure.core/int G__13292)] (java.time.LocalDateTime/of G__13287 G__13288 G__13289 G__13290 G__13291 G__13292)) (clojure.core/and (clojure.core/instance? java.lang.Number G__13287) (clojure.core/instance? java.lang.Number G__13288) (clojure.core/instance? java.lang.Number G__13289) (clojure.core/instance? java.lang.Number G__13290) (clojure.core/instance? java.lang.Number G__13291) (clojure.core/instance? java.lang.Number G__13292)) (clojure.core/let [G__13287 (clojure.core/int G__13287) G__13288 (clojure.core/int G__13288) G__13289 (clojure.core/int G__13289) G__13290 (clojure.core/int G__13290) G__13291 (clojure.core/int G__13291) G__13292 (clojure.core/int G__13292)] (java.time.LocalDateTime/of G__13287 G__13288 G__13289 G__13290 G__13291 G__13292)) :else (throw (java.lang.IllegalArgumentException. "no corresponding java.time method with these args")))) (^java.time.LocalDateTime [G__13294 G__13295 G__13296 G__13297 G__13298 G__13299 G__13300] (clojure.core/cond (clojure.core/and (clojure.core/instance? java.lang.Number G__13294) (clojure.core/instance? java.time.Month G__13295) (clojure.core/instance? java.lang.Number G__13296) (clojure.core/instance? java.lang.Number G__13297) (clojure.core/instance? java.lang.Number G__13298) (clojure.core/instance? java.lang.Number G__13299) (clojure.core/instance? java.lang.Number G__13300)) (clojure.core/let [G__13294 (clojure.core/int G__13294) G__13295 ^"java.time.Month" G__13295 G__13296 (clojure.core/int G__13296) G__13297 (clojure.core/int G__13297) G__13298 (clojure.core/int G__13298) G__13299 (clojure.core/int G__13299) G__13300 (clojure.core/int G__13300)] (java.time.LocalDateTime/of G__13294 G__13295 G__13296 G__13297 G__13298 G__13299 G__13300)) (clojure.core/and (clojure.core/instance? java.lang.Number G__13294) (clojure.core/instance? java.lang.Number G__13295) (clojure.core/instance? java.lang.Number G__13296) (clojure.core/instance? java.lang.Number G__13297) (clojure.core/instance? java.lang.Number G__13298) (clojure.core/instance? java.lang.Number G__13299) (clojure.core/instance? java.lang.Number G__13300)) (clojure.core/let [G__13294 (clojure.core/int G__13294) G__13295 (clojure.core/int G__13295) G__13296 (clojure.core/int G__13296) G__13297 (clojure.core/int G__13297) G__13298 (clojure.core/int G__13298) G__13299 (clojure.core/int G__13299) G__13300 (clojure.core/int G__13300)] (java.time.LocalDateTime/of G__13294 G__13295 G__13296 G__13297 G__13298 G__13299 G__13300)) :else (throw (java.lang.IllegalArgumentException. "no corresponding java.time method with these args")))) (^java.time.LocalDateTime [G__13302 G__13303 G__13304 G__13305 G__13306] (clojure.core/cond (clojure.core/and (clojure.core/instance? java.lang.Number G__13302) (clojure.core/instance? java.time.Month G__13303) (clojure.core/instance? java.lang.Number G__13304) (clojure.core/instance? java.lang.Number G__13305) (clojure.core/instance? java.lang.Number G__13306)) (clojure.core/let [G__13302 (clojure.core/int G__13302) G__13303 ^"java.time.Month" G__13303 G__13304 (clojure.core/int G__13304) G__13305 (clojure.core/int G__13305) G__13306 (clojure.core/int G__13306)] (java.time.LocalDateTime/of G__13302 G__13303 G__13304 G__13305 G__13306)) (clojure.core/and (clojure.core/instance? java.lang.Number G__13302) (clojure.core/instance? java.lang.Number G__13303) (clojure.core/instance? java.lang.Number G__13304) (clojure.core/instance? java.lang.Number G__13305) (clojure.core/instance? java.lang.Number G__13306)) (clojure.core/let [G__13302 (clojure.core/int G__13302) G__13303 (clojure.core/int G__13303) G__13304 (clojure.core/int G__13304) G__13305 (clojure.core/int G__13305) G__13306 (clojure.core/int G__13306)] (java.time.LocalDateTime/of G__13302 G__13303 G__13304 G__13305 G__13306)) :else (throw (java.lang.IllegalArgumentException. "no corresponding java.time method with these args")))) (^java.time.LocalDateTime [^java.time.LocalDate java-time-LocalDate13307 ^java.time.LocalTime java-time-LocalTime13308] (java.time.LocalDateTime/of java-time-LocalDate13307 java-time-LocalTime13308))) -(clojure.core/defn with-month {:arglists (quote (["java.time.LocalDateTime" "int"]))} (^java.time.LocalDateTime [^java.time.LocalDateTime this13309 ^java.lang.Integer int13310] (.withMonth this13309 int13310))) -(clojure.core/defn is-equal {:arglists (quote (["java.time.LocalDateTime" "java.time.chrono.ChronoLocalDateTime"]))} (^java.lang.Boolean [^java.time.LocalDateTime this13311 ^java.time.chrono.ChronoLocalDateTime java-time-chrono-ChronoLocalDateTime13312] (.isEqual this13311 java-time-chrono-ChronoLocalDateTime13312))) -(clojure.core/defn get-nano {:arglists (quote (["java.time.LocalDateTime"]))} (^java.lang.Integer [^java.time.LocalDateTime this13313] (.getNano this13313))) -(clojure.core/defn get-year {:arglists (quote (["java.time.LocalDateTime"]))} (^java.lang.Integer [^java.time.LocalDateTime this13314] (.getYear this13314))) -(clojure.core/defn minus-seconds {:arglists (quote (["java.time.LocalDateTime" "long"]))} (^java.time.LocalDateTime [^java.time.LocalDateTime this13315 ^long long13316] (.minusSeconds this13315 long13316))) -(clojure.core/defn get-second {:arglists (quote (["java.time.LocalDateTime"]))} (^java.lang.Integer [^java.time.LocalDateTime this13317] (.getSecond this13317))) -(clojure.core/defn plus-nanos {:arglists (quote (["java.time.LocalDateTime" "long"]))} (^java.time.LocalDateTime [^java.time.LocalDateTime this13318 ^long long13319] (.plusNanos this13318 long13319))) -(clojure.core/defn get-day-of-year {:arglists (quote (["java.time.LocalDateTime"]))} (^java.lang.Integer [^java.time.LocalDateTime this13320] (.getDayOfYear this13320))) -(clojure.core/defn plus {:arglists (quote (["java.time.LocalDateTime" "java.time.temporal.TemporalAmount"] ["java.time.LocalDateTime" "long" "java.time.temporal.TemporalUnit"]))} (^java.time.LocalDateTime [^java.time.LocalDateTime this13321 ^java.time.temporal.TemporalAmount java-time-temporal-TemporalAmount13322] (.plus this13321 java-time-temporal-TemporalAmount13322)) (^java.time.LocalDateTime [^java.time.LocalDateTime this13323 ^long long13324 ^java.time.temporal.ChronoUnit java-time-temporal-TemporalUnit13325] (.plus this13323 long13324 java-time-temporal-TemporalUnit13325))) -(clojure.core/defn with-hour {:arglists (quote (["java.time.LocalDateTime" "int"]))} (^java.time.LocalDateTime [^java.time.LocalDateTime this13326 ^java.lang.Integer int13327] (.withHour this13326 int13327))) -(clojure.core/defn with-minute {:arglists (quote (["java.time.LocalDateTime" "int"]))} (^java.time.LocalDateTime [^java.time.LocalDateTime this13328 ^java.lang.Integer int13329] (.withMinute this13328 int13329))) -(clojure.core/defn plus-minutes {:arglists (quote (["java.time.LocalDateTime" "long"]))} (^java.time.LocalDateTime [^java.time.LocalDateTime this13330 ^long long13331] (.plusMinutes this13330 long13331))) -(clojure.core/defn query {:arglists (quote (["java.time.LocalDateTime" "java.time.temporal.TemporalQuery"]))} (^java.lang.Object [^java.time.LocalDateTime this13332 ^java.time.temporal.TemporalQuery java-time-temporal-TemporalQuery13333] (.query this13332 java-time-temporal-TemporalQuery13333))) -(clojure.core/defn get-day-of-week {:arglists (quote (["java.time.LocalDateTime"]))} (^java.time.DayOfWeek [^java.time.LocalDateTime this13334] (.getDayOfWeek this13334))) -(clojure.core/defn to-string {:arglists (quote (["java.time.LocalDateTime"]))} (^java.lang.String [^java.time.LocalDateTime this13335] (.toString this13335))) -(clojure.core/defn plus-months {:arglists (quote (["java.time.LocalDateTime" "long"]))} (^java.time.LocalDateTime [^java.time.LocalDateTime this13336 ^long long13337] (.plusMonths this13336 long13337))) -(clojure.core/defn is-before {:arglists (quote (["java.time.LocalDateTime" "java.time.chrono.ChronoLocalDateTime"]))} (^java.lang.Boolean [^java.time.LocalDateTime this13338 ^java.time.chrono.ChronoLocalDateTime java-time-chrono-ChronoLocalDateTime13339] (.isBefore this13338 java-time-chrono-ChronoLocalDateTime13339))) -(clojure.core/defn minus-months {:arglists (quote (["java.time.LocalDateTime" "long"]))} (^java.time.LocalDateTime [^java.time.LocalDateTime this13340 ^long long13341] (.minusMonths this13340 long13341))) -(clojure.core/defn minus {:arglists (quote (["java.time.LocalDateTime" "long" "java.time.temporal.TemporalUnit"] ["java.time.LocalDateTime" "java.time.temporal.TemporalAmount"]))} (^java.time.LocalDateTime [^java.time.LocalDateTime this13342 ^long long13343 ^java.time.temporal.ChronoUnit java-time-temporal-TemporalUnit13344] (.minus this13342 long13343 java-time-temporal-TemporalUnit13344)) (^java.time.LocalDateTime [^java.time.LocalDateTime this13345 ^java.time.temporal.TemporalAmount java-time-temporal-TemporalAmount13346] (.minus this13345 java-time-temporal-TemporalAmount13346))) -(clojure.core/defn at-zone {:arglists (quote (["java.time.LocalDateTime" "java.time.ZoneId"]))} (^java.time.ZonedDateTime [^java.time.LocalDateTime this13347 ^java.time.ZoneId java-time-ZoneId13348] (.atZone this13347 java-time-ZoneId13348))) -(clojure.core/defn plus-hours {:arglists (quote (["java.time.LocalDateTime" "long"]))} (^java.time.LocalDateTime [^java.time.LocalDateTime this13349 ^long long13350] (.plusHours this13349 long13350))) -(clojure.core/defn plus-days {:arglists (quote (["java.time.LocalDateTime" "long"]))} (^java.time.LocalDateTime [^java.time.LocalDateTime this13351 ^long long13352] (.plusDays this13351 long13352))) -(clojure.core/defn to-local-time {:arglists (quote (["java.time.LocalDateTime"]))} (^java.time.LocalTime [^java.time.LocalDateTime this13353] (.toLocalTime this13353))) -(clojure.core/defn get-long {:arglists (quote (["java.time.LocalDateTime" "java.time.temporal.TemporalField"]))} (^long [^java.time.LocalDateTime this13354 ^java.time.temporal.TemporalField java-time-temporal-TemporalField13355] (.getLong this13354 java-time-temporal-TemporalField13355))) -(clojure.core/defn with-year {:arglists (quote (["java.time.LocalDateTime" "int"]))} (^java.time.LocalDateTime [^java.time.LocalDateTime this13356 ^java.lang.Integer int13357] (.withYear this13356 int13357))) -(clojure.core/defn with-nano {:arglists (quote (["java.time.LocalDateTime" "int"]))} (^java.time.LocalDateTime [^java.time.LocalDateTime this13358 ^java.lang.Integer int13359] (.withNano this13358 int13359))) -(clojure.core/defn to-epoch-second {:arglists (quote (["java.time.LocalDateTime" "java.time.ZoneOffset"]))} (^long [^java.time.LocalDateTime this13360 ^java.time.ZoneOffset java-time-ZoneOffset13361] (.toEpochSecond this13360 java-time-ZoneOffset13361))) -(clojure.core/defn until {:arglists (quote (["java.time.LocalDateTime" "java.time.temporal.Temporal" "java.time.temporal.TemporalUnit"]))} (^long [^java.time.LocalDateTime this13362 ^java.time.temporal.Temporal java-time-temporal-Temporal13363 ^java.time.temporal.ChronoUnit java-time-temporal-TemporalUnit13364] (.until this13362 java-time-temporal-Temporal13363 java-time-temporal-TemporalUnit13364))) -(clojure.core/defn with-day-of-month {:arglists (quote (["java.time.LocalDateTime" "int"]))} (^java.time.LocalDateTime [^java.time.LocalDateTime this13365 ^java.lang.Integer int13366] (.withDayOfMonth this13365 int13366))) -(clojure.core/defn get-day-of-month {:arglists (quote (["java.time.LocalDateTime"]))} (^java.lang.Integer [^java.time.LocalDateTime this13367] (.getDayOfMonth this13367))) -(clojure.core/defn from {:arglists (quote (["java.time.temporal.TemporalAccessor"]))} (^java.time.LocalDateTime [^java.time.temporal.TemporalAccessor java-time-temporal-TemporalAccessor13368] (java.time.LocalDateTime/from java-time-temporal-TemporalAccessor13368))) -(clojure.core/defn is-after {:arglists (quote (["java.time.LocalDateTime" "java.time.chrono.ChronoLocalDateTime"]))} (^java.lang.Boolean [^java.time.LocalDateTime this13369 ^java.time.chrono.ChronoLocalDateTime java-time-chrono-ChronoLocalDateTime13370] (.isAfter this13369 java-time-chrono-ChronoLocalDateTime13370))) -(clojure.core/defn minus-nanos {:arglists (quote (["java.time.LocalDateTime" "long"]))} (^java.time.LocalDateTime [^java.time.LocalDateTime this13371 ^long long13372] (.minusNanos this13371 long13372))) -(clojure.core/defn is-supported {:arglists (quote (["java.time.LocalDateTime" "java.time.temporal.TemporalField"] ["java.time.LocalDateTime" "java.time.temporal.TemporalUnit"]))} (^java.lang.Boolean [this13373 G__13374] (clojure.core/cond (clojure.core/and (clojure.core/instance? java.time.temporal.TemporalField G__13374)) (clojure.core/let [G__13374 ^"java.time.temporal.TemporalField" G__13374] (.isSupported ^java.time.LocalDateTime this13373 G__13374)) (clojure.core/and (clojure.core/instance? java.time.temporal.ChronoUnit G__13374)) (clojure.core/let [G__13374 ^"java.time.temporal.ChronoUnit" G__13374] (.isSupported ^java.time.LocalDateTime this13373 G__13374)) :else (throw (java.lang.IllegalArgumentException. "no corresponding java.time method with these args"))))) -(clojure.core/defn minus-years {:arglists (quote (["java.time.LocalDateTime" "long"]))} (^java.time.LocalDateTime [^java.time.LocalDateTime this13375 ^long long13376] (.minusYears this13375 long13376))) -(clojure.core/defn get-chronology {:arglists (quote (["java.time.LocalDateTime"]))} (^java.time.chrono.Chronology [^java.time.LocalDateTime this13377] (.getChronology this13377))) -(clojure.core/defn parse {:arglists (quote (["java.lang.CharSequence" "java.time.format.DateTimeFormatter"] ["java.lang.CharSequence"]))} (^java.time.LocalDateTime [^java.lang.CharSequence java-lang-CharSequence13378 ^java.time.format.DateTimeFormatter java-time-format-DateTimeFormatter13379] (java.time.LocalDateTime/parse java-lang-CharSequence13378 java-time-format-DateTimeFormatter13379)) (^java.time.LocalDateTime [^java.lang.CharSequence java-lang-CharSequence13380] (java.time.LocalDateTime/parse java-lang-CharSequence13380))) -(clojure.core/defn with-second {:arglists (quote (["java.time.LocalDateTime" "int"]))} (^java.time.LocalDateTime [^java.time.LocalDateTime this13381 ^java.lang.Integer int13382] (.withSecond this13381 int13382))) -(clojure.core/defn to-local-date {:arglists (quote (["java.time.LocalDateTime"]))} (^java.time.LocalDate [^java.time.LocalDateTime this13383] (.toLocalDate this13383))) -(clojure.core/defn get-minute {:arglists (quote (["java.time.LocalDateTime"]))} (^java.lang.Integer [^java.time.LocalDateTime this13384] (.getMinute this13384))) -(clojure.core/defn hash-code {:arglists (quote (["java.time.LocalDateTime"]))} (^java.lang.Integer [^java.time.LocalDateTime this13385] (.hashCode this13385))) -(clojure.core/defn adjust-into {:arglists (quote (["java.time.LocalDateTime" "java.time.temporal.Temporal"]))} (^java.time.temporal.Temporal [^java.time.LocalDateTime this13386 ^java.time.temporal.Temporal java-time-temporal-Temporal13387] (.adjustInto this13386 java-time-temporal-Temporal13387))) -(clojure.core/defn with {:arglists (quote (["java.time.LocalDateTime" "java.time.temporal.TemporalField" "long"] ["java.time.LocalDateTime" "java.time.temporal.TemporalAdjuster"]))} (^java.time.LocalDateTime [^java.time.LocalDateTime this13388 ^java.time.temporal.TemporalField java-time-temporal-TemporalField13389 ^long long13390] (.with this13388 java-time-temporal-TemporalField13389 long13390)) (^java.time.LocalDateTime [^java.time.LocalDateTime this13391 ^java.time.temporal.TemporalAdjuster java-time-temporal-TemporalAdjuster13392] (.with this13391 java-time-temporal-TemporalAdjuster13392))) -(clojure.core/defn now {:arglists (quote ([] ["java.time.ZoneId"] ["java.time.Clock"]))} (^java.time.LocalDateTime [] (java.time.LocalDateTime/now)) (^java.time.LocalDateTime [G__13394] (clojure.core/cond (clojure.core/and (clojure.core/instance? java.time.ZoneId G__13394)) (clojure.core/let [G__13394 ^"java.time.ZoneId" G__13394] (java.time.LocalDateTime/now G__13394)) (clojure.core/and (clojure.core/instance? java.time.Clock G__13394)) (clojure.core/let [G__13394 ^"java.time.Clock" G__13394] (java.time.LocalDateTime/now G__13394)) :else (throw (java.lang.IllegalArgumentException. "no corresponding java.time method with these args"))))) -(clojure.core/defn get-month-value {:arglists (quote (["java.time.LocalDateTime"]))} (^java.lang.Integer [^java.time.LocalDateTime this13395] (.getMonthValue this13395))) -(clojure.core/defn with-day-of-year {:arglists (quote (["java.time.LocalDateTime" "int"]))} (^java.time.LocalDateTime [^java.time.LocalDateTime this13396 ^java.lang.Integer int13397] (.withDayOfYear this13396 int13397))) -(clojure.core/defn compare-to {:arglists (quote (["java.time.LocalDateTime" "java.time.chrono.ChronoLocalDateTime"]))} (^java.lang.Integer [^java.time.LocalDateTime this13398 ^java.time.chrono.ChronoLocalDateTime java-time-chrono-ChronoLocalDateTime13399] (.compareTo this13398 java-time-chrono-ChronoLocalDateTime13399))) -(clojure.core/defn get-month {:arglists (quote (["java.time.LocalDateTime"]))} (^java.time.Month [^java.time.LocalDateTime this13400] (.getMonth this13400))) -(clojure.core/defn of-instant {:arglists (quote (["java.time.Instant" "java.time.ZoneId"]))} (^java.time.LocalDateTime [^java.time.Instant java-time-Instant13401 ^java.time.ZoneId java-time-ZoneId13402] (java.time.LocalDateTime/ofInstant java-time-Instant13401 java-time-ZoneId13402))) -(clojure.core/defn plus-seconds {:arglists (quote (["java.time.LocalDateTime" "long"]))} (^java.time.LocalDateTime [^java.time.LocalDateTime this13403 ^long long13404] (.plusSeconds this13403 long13404))) -(clojure.core/defn get {:arglists (quote (["java.time.LocalDateTime" "java.time.temporal.TemporalField"]))} (^java.lang.Integer [^java.time.LocalDateTime this13405 ^java.time.temporal.TemporalField java-time-temporal-TemporalField13406] (.get this13405 java-time-temporal-TemporalField13406))) -(clojure.core/defn equals {:arglists (quote (["java.time.LocalDateTime" "java.lang.Object"]))} (^java.lang.Boolean [^java.time.LocalDateTime this13407 ^java.lang.Object java-lang-Object13408] (.equals this13407 java-lang-Object13408))) -(clojure.core/defn format {:arglists (quote (["java.time.LocalDateTime" "java.time.format.DateTimeFormatter"]))} (^java.lang.String [^java.time.LocalDateTime this13409 ^java.time.format.DateTimeFormatter java-time-format-DateTimeFormatter13410] (.format this13409 java-time-format-DateTimeFormatter13410))) -(clojure.core/defn plus-years {:arglists (quote (["java.time.LocalDateTime" "long"]))} (^java.time.LocalDateTime [^java.time.LocalDateTime this13411 ^long long13412] (.plusYears this13411 long13412))) -(clojure.core/defn minus-days {:arglists (quote (["java.time.LocalDateTime" "long"]))} (^java.time.LocalDateTime [^java.time.LocalDateTime this13413 ^long long13414] (.minusDays this13413 long13414))) +(ns cljc.java-time.local-date-time + (:refer-clojure :exclude + [abs get range format min max next name resolve short]) + (:require [cljc.java-time.extn.calendar-awareness]) + (:import [java.time LocalDateTime])) + +(def max + "The maximum supported {@code LocalDateTime}, '+999999999-12-31T23:59:59.999999999'. + This is the local date-time just before midnight at the end of the maximum date. + This combines {@link LocalDate#MAX} and {@link LocalTime#MAX}. + This could be used by an application as a \"far future\" date-time." + java.time.LocalDateTime/MAX) + +(def min + "The minimum supported {@code LocalDateTime}, '-999999999-01-01T00:00:00'. + This is the local date-time of midnight at the start of the minimum date. + This combines {@link LocalDate#MIN} and {@link LocalTime#MIN}. + This could be used by an application as a \"far past\" date-time." + java.time.LocalDateTime/MIN) + +(defn minus-minutes + "Returns a copy of this {@code LocalDateTime} with the specified number of minutes subtracted. + + This instance is immutable and unaffected by this method call. + + @param minutes the minutes to subtract, may be negative + @return a {@code LocalDateTime} based on this date-time with the minutes subtracted, not null + @throws DateTimeException if the result exceeds the supported date range" + {:arglists (quote (["java.time.LocalDateTime" "long"]))} + (^java.time.LocalDateTime [^java.time.LocalDateTime this ^long minutes] + (.minusMinutes this minutes))) + +(defn truncated-to + "Returns a copy of this {@code LocalDateTime} with the time truncated. + + Truncation returns a copy of the original date-time with fields + smaller than the specified unit set to zero. + For example, truncating with the {@link ChronoUnit#MINUTES minutes} unit + will set the second-of-minute and nano-of-second field to zero. + + The unit must have a {@linkplain TemporalUnit#getDuration() duration} + that divides into the length of a standard day without remainder. + This includes all supplied time units on {@link ChronoUnit} and + {@link ChronoUnit#DAYS DAYS}. Other units throw an exception. + + This instance is immutable and unaffected by this method call. + + @param unit the unit to truncate to, not null + @return a {@code LocalDateTime} based on this date-time with the time truncated, not null + @throws DateTimeException if unable to truncate + @throws UnsupportedTemporalTypeException if the unit is not supported" + {:arglists (quote (["java.time.LocalDateTime" + "java.time.temporal.TemporalUnit"]))} + (^java.time.LocalDateTime + [^java.time.LocalDateTime this ^java.time.temporal.ChronoUnit unit] + (.truncatedTo this unit))) + +(defn minus-weeks + "Returns a copy of this {@code LocalDateTime} with the specified number of weeks subtracted. + + This method subtracts the specified amount in weeks from the days field decrementing + the month and year fields as necessary to ensure the result remains valid. + The result is only invalid if the maximum/minimum year is exceeded. + + For example, 2009-01-07 minus one week would result in 2008-12-31. + + This instance is immutable and unaffected by this method call. + + @param weeks the weeks to subtract, may be negative + @return a {@code LocalDateTime} based on this date-time with the weeks subtracted, not null + @throws DateTimeException if the result exceeds the supported date range" + {:arglists (quote (["java.time.LocalDateTime" "long"]))} + (^java.time.LocalDateTime [^java.time.LocalDateTime this ^long weeks] + (.minusWeeks this weeks))) + +(defn to-instant + "Converts this date-time to an {@code Instant}. + + This combines this local date-time and the specified offset to form + an {@code Instant}. + + This default implementation calculates from the epoch-day of the date and the + second-of-day of the time. + + @param offset the offset to use for the conversion, not null + @return an {@code Instant} representing the same instant, not null" + {:arglists (quote (["java.time.LocalDateTime" "java.time.ZoneOffset"]))} + (^java.time.Instant + [^java.time.LocalDateTime this ^java.time.ZoneOffset offset] + (.toInstant this offset))) + +(defn plus-weeks + "Returns a copy of this {@code LocalDateTime} with the specified number of weeks added. + + This method adds the specified amount in weeks to the days field incrementing + the month and year fields as necessary to ensure the result remains valid. + The result is only invalid if the maximum/minimum year is exceeded. + + For example, 2008-12-31 plus one week would result in 2009-01-07. + + This instance is immutable and unaffected by this method call. + + @param weeks the weeks to add, may be negative + @return a {@code LocalDateTime} based on this date-time with the weeks added, not null + @throws DateTimeException if the result exceeds the supported date range" + {:arglists (quote (["java.time.LocalDateTime" "long"]))} + (^java.time.LocalDateTime [^java.time.LocalDateTime this ^long weeks] + (.plusWeeks this weeks))) + +(defn range + "Gets the range of valid values for the specified field. + + The range object expresses the minimum and maximum valid values for a field. + This date-time is used to enhance the accuracy of the returned range. + If it is not possible to return the range, because the field is not supported + or for some other reason, an exception is thrown. + + If the field is a {@link ChronoField} then the query is implemented here. + The {@link #isSupported(TemporalField) supported fields} will return + appropriate range instances. + All other {@code ChronoField} instances will throw an {@code UnsupportedTemporalTypeException}. + + If the field is not a {@code ChronoField}, then the result of this method + is obtained by invoking {@code TemporalField.rangeRefinedBy(TemporalAccessor)} + passing {@code this} as the argument. + Whether the range can be obtained is determined by the field. + + @param field the field to query the range for, not null + @return the range of valid values for the field, not null + @throws DateTimeException if the range for the field cannot be obtained + @throws UnsupportedTemporalTypeException if the field is not supported" + {:arglists (quote (["java.time.LocalDateTime" + "java.time.temporal.TemporalField"]))} + (^java.time.temporal.ValueRange + [^java.time.LocalDateTime this ^java.time.temporal.TemporalField field] + (.range this field))) + +(defn of-epoch-second + "Obtains an instance of {@code LocalDateTime} using seconds from the + epoch of 1970-01-01T00:00:00Z. + + This allows the {@link ChronoField#INSTANT_SECONDS epoch-second} field + to be converted to a local date-time. This is primarily intended for + low-level conversions rather than general application usage. + + @param epochSecond the number of seconds from the epoch of 1970-01-01T00:00:00Z + @param nanoOfSecond the nanosecond within the second, from 0 to 999,999,999 + @param offset the zone offset, not null + @return the local date-time, not null + @throws DateTimeException if the result exceeds the supported range, + or if the nano-of-second is invalid" + {:arglists (quote (["long" "int" "java.time.ZoneOffset"]))} + (^java.time.LocalDateTime + [^long epoch-second ^java.lang.Integer nano-of-second + ^java.time.ZoneOffset offset] + (java.time.LocalDateTime/ofEpochSecond epoch-second nano-of-second offset))) + +(defn get-hour + "Gets the hour-of-day field. + + @return the hour-of-day, from 0 to 23" + {:arglists (quote (["java.time.LocalDateTime"]))} + (^java.lang.Integer [^java.time.LocalDateTime this] (.getHour this))) + +(defn at-offset + "Combines this date-time with an offset to create an {@code OffsetDateTime}. + + This returns an {@code OffsetDateTime} formed from this date-time at the specified offset. + All possible combinations of date-time and offset are valid. + + @param offset the offset to combine with, not null + @return the offset date-time formed from this date-time and the specified offset, not null" + {:arglists (quote (["java.time.LocalDateTime" "java.time.ZoneOffset"]))} + (^java.time.OffsetDateTime + [^java.time.LocalDateTime this ^java.time.ZoneOffset offset] + (.atOffset this offset))) + +(defn minus-hours + "Returns a copy of this {@code LocalDateTime} with the specified number of hours subtracted. + + This instance is immutable and unaffected by this method call. + + @param hours the hours to subtract, may be negative + @return a {@code LocalDateTime} based on this date-time with the hours subtracted, not null + @throws DateTimeException if the result exceeds the supported date range" + {:arglists (quote (["java.time.LocalDateTime" "long"]))} + (^java.time.LocalDateTime [^java.time.LocalDateTime this ^long hours] + (.minusHours this hours))) + +(defn of + {:arglists (quote (["java.time.LocalDate" "java.time.LocalTime"] + ["int" "int" "int" "int" "int"] + ["int" "java.time.Month" "int" "int" "int"] + ["int" "int" "int" "int" "int" "int"] + ["int" "java.time.Month" "int" "int" "int" "int"] + ["int" "int" "int" "int" "int" "int" "int"] + ["int" "java.time.Month" "int" "int" "int" "int" "int"]))} + (^java.time.LocalDateTime + [^java.time.LocalDate date ^java.time.LocalTime time] + (java.time.LocalDateTime/of date time)) + (^java.time.LocalDateTime [arg0 arg1 arg2 arg3 arg4] + (cond (and (instance? java.lang.Number arg0) + (instance? java.lang.Number arg1) + (instance? java.lang.Number arg2) + (instance? java.lang.Number arg3) + (instance? java.lang.Number arg4)) + (let [year (int arg0) + month (int arg1) + day-of-month (int arg2) + hour (int arg3) + minute (int arg4)] + (java.time.LocalDateTime/of year month day-of-month hour minute)) + (and (instance? java.lang.Number arg0) + (instance? java.time.Month arg1) + (instance? java.lang.Number arg2) + (instance? java.lang.Number arg3) + (instance? java.lang.Number arg4)) + (let [year (int arg0) + ^java.time.Month month arg1 + day-of-month (int arg2) + hour (int arg3) + minute (int arg4)] + (java.time.LocalDateTime/of year month day-of-month hour minute)) + :else (throw (java.lang.IllegalArgumentException. + "no corresponding java.time method with these args")))) + (^java.time.LocalDateTime [arg0 arg1 arg2 arg3 arg4 arg5] + (cond (and (instance? java.lang.Number arg0) + (instance? java.lang.Number arg1) + (instance? java.lang.Number arg2) + (instance? java.lang.Number arg3) + (instance? java.lang.Number arg4) + (instance? java.lang.Number arg5)) + (let [year (int arg0) + month (int arg1) + day-of-month (int arg2) + hour (int arg3) + minute (int arg4) + second (int arg5)] + (java.time.LocalDateTime/of year + month + day-of-month + hour + minute + second)) + (and (instance? java.lang.Number arg0) + (instance? java.time.Month arg1) + (instance? java.lang.Number arg2) + (instance? java.lang.Number arg3) + (instance? java.lang.Number arg4) + (instance? java.lang.Number arg5)) + (let [year (int arg0) + ^java.time.Month month arg1 + day-of-month (int arg2) + hour (int arg3) + minute (int arg4) + second (int arg5)] + (java.time.LocalDateTime/of year + month + day-of-month + hour + minute + second)) + :else (throw (java.lang.IllegalArgumentException. + "no corresponding java.time method with these args")))) + (^java.time.LocalDateTime [arg0 arg1 arg2 arg3 arg4 arg5 arg6] + (cond (and (instance? java.lang.Number arg0) + (instance? java.lang.Number arg1) + (instance? java.lang.Number arg2) + (instance? java.lang.Number arg3) + (instance? java.lang.Number arg4) + (instance? java.lang.Number arg5) + (instance? java.lang.Number arg6)) + (let [year (int arg0) + month (int arg1) + day-of-month (int arg2) + hour (int arg3) + minute (int arg4) + second (int arg5) + nano-of-second (int arg6)] + (java.time.LocalDateTime/of year + month + day-of-month + hour + minute + second + nano-of-second)) + (and (instance? java.lang.Number arg0) + (instance? java.time.Month arg1) + (instance? java.lang.Number arg2) + (instance? java.lang.Number arg3) + (instance? java.lang.Number arg4) + (instance? java.lang.Number arg5) + (instance? java.lang.Number arg6)) + (let [year (int arg0) + ^java.time.Month month arg1 + day-of-month (int arg2) + hour (int arg3) + minute (int arg4) + second (int arg5) + nano-of-second (int arg6)] + (java.time.LocalDateTime/of year + month + day-of-month + hour + minute + second + nano-of-second)) + :else (throw (java.lang.IllegalArgumentException. + "no corresponding java.time method with these args"))))) + +(defn with-month + "Returns a copy of this {@code LocalDateTime} with the month-of-year altered. + + The time does not affect the calculation and will be the same in the result. + If the day-of-month is invalid for the year, it will be changed to the last valid day of the month. + + This instance is immutable and unaffected by this method call. + + @param month the month-of-year to set in the result, from 1 (January) to 12 (December) + @return a {@code LocalDateTime} based on this date-time with the requested month, not null + @throws DateTimeException if the month-of-year value is invalid" + {:arglists (quote (["java.time.LocalDateTime" "int"]))} + (^java.time.LocalDateTime + [^java.time.LocalDateTime this ^java.lang.Integer month] + (.withMonth this month))) + +(defn is-equal + "Checks if this date-time is equal to the specified date-time. + + This checks to see if this date-time represents the same point on the + local time-line as the other date-time. +
+   LocalDate a = LocalDateTime.of(2012, 6, 30, 12, 00);
+   LocalDate b = LocalDateTime.of(2012, 7, 1, 12, 00);
+   a.isEqual(b) == false
+   a.isEqual(a) == true
+   b.isEqual(a) == false
+ 
+ + This method only considers the position of the two date-times on the local time-line. + It does not take into account the chronology, or calendar system. + This is different from the comparison in {@link #compareTo(ChronoLocalDateTime)}, + but is the same approach as {@link ChronoLocalDateTime#timeLineOrder()}. + + @param other the other date-time to compare to, not null + @return true if this date-time is equal to the specified date-time" + {:arglists (quote (["java.time.LocalDateTime" + "java.time.chrono.ChronoLocalDateTime"]))} + (^java.lang.Boolean + [^java.time.LocalDateTime this ^java.time.chrono.ChronoLocalDateTime other] + (.isEqual this other))) + +(defn get-nano + "Gets the nano-of-second field. + + @return the nano-of-second, from 0 to 999,999,999" + {:arglists (quote (["java.time.LocalDateTime"]))} + (^java.lang.Integer [^java.time.LocalDateTime this] (.getNano this))) + +(defn get-year + "Gets the year field. + + This method returns the primitive {@code int} value for the year. + + The year returned by this method is proleptic as per {@code get(YEAR)}. + To obtain the year-of-era, use {@code get(YEAR_OF_ERA)}. + + @return the year, from MIN_YEAR to MAX_YEAR" + {:arglists (quote (["java.time.LocalDateTime"]))} + (^java.lang.Integer [^java.time.LocalDateTime this] (.getYear this))) + +(defn minus-seconds + "Returns a copy of this {@code LocalDateTime} with the specified number of seconds subtracted. + + This instance is immutable and unaffected by this method call. + + @param seconds the seconds to subtract, may be negative + @return a {@code LocalDateTime} based on this date-time with the seconds subtracted, not null + @throws DateTimeException if the result exceeds the supported date range" + {:arglists (quote (["java.time.LocalDateTime" "long"]))} + (^java.time.LocalDateTime [^java.time.LocalDateTime this ^long seconds] + (.minusSeconds this seconds))) + +(defn get-second + "Gets the second-of-minute field. + + @return the second-of-minute, from 0 to 59" + {:arglists (quote (["java.time.LocalDateTime"]))} + (^java.lang.Integer [^java.time.LocalDateTime this] (.getSecond this))) + +(defn plus-nanos + "Returns a copy of this {@code LocalDateTime} with the specified number of nanoseconds added. + + This instance is immutable and unaffected by this method call. + + @param nanos the nanos to add, may be negative + @return a {@code LocalDateTime} based on this date-time with the nanoseconds added, not null + @throws DateTimeException if the result exceeds the supported date range" + {:arglists (quote (["java.time.LocalDateTime" "long"]))} + (^java.time.LocalDateTime [^java.time.LocalDateTime this ^long nanos] + (.plusNanos this nanos))) + +(defn get-day-of-year + "Gets the day-of-year field. + + This method returns the primitive {@code int} value for the day-of-year. + + @return the day-of-year, from 1 to 365, or 366 in a leap year" + {:arglists (quote (["java.time.LocalDateTime"]))} + (^java.lang.Integer [^java.time.LocalDateTime this] (.getDayOfYear this))) + +(defn plus + {:arglists (quote (["java.time.LocalDateTime" + "java.time.temporal.TemporalAmount"] + ["java.time.LocalDateTime" "long" + "java.time.temporal.TemporalUnit"]))} + (^java.time.LocalDateTime + [^java.time.LocalDateTime this + ^java.time.temporal.TemporalAmount amount-to-add] + (.plus this amount-to-add)) + (^java.time.LocalDateTime + [^java.time.LocalDateTime this ^long amount-to-add + ^java.time.temporal.ChronoUnit unit] + (.plus this amount-to-add unit))) + +(defn with-hour + "Returns a copy of this {@code LocalDateTime} with the hour-of-day altered. + + This instance is immutable and unaffected by this method call. + + @param hour the hour-of-day to set in the result, from 0 to 23 + @return a {@code LocalDateTime} based on this date-time with the requested hour, not null + @throws DateTimeException if the hour value is invalid" + {:arglists (quote (["java.time.LocalDateTime" "int"]))} + (^java.time.LocalDateTime + [^java.time.LocalDateTime this ^java.lang.Integer hour] + (.withHour this hour))) + +(defn with-minute + "Returns a copy of this {@code LocalDateTime} with the minute-of-hour altered. + + This instance is immutable and unaffected by this method call. + + @param minute the minute-of-hour to set in the result, from 0 to 59 + @return a {@code LocalDateTime} based on this date-time with the requested minute, not null + @throws DateTimeException if the minute value is invalid" + {:arglists (quote (["java.time.LocalDateTime" "int"]))} + (^java.time.LocalDateTime + [^java.time.LocalDateTime this ^java.lang.Integer minute] + (.withMinute this minute))) + +(defn plus-minutes + "Returns a copy of this {@code LocalDateTime} with the specified number of minutes added. + + This instance is immutable and unaffected by this method call. + + @param minutes the minutes to add, may be negative + @return a {@code LocalDateTime} based on this date-time with the minutes added, not null + @throws DateTimeException if the result exceeds the supported date range" + {:arglists (quote (["java.time.LocalDateTime" "long"]))} + (^java.time.LocalDateTime [^java.time.LocalDateTime this ^long minutes] + (.plusMinutes this minutes))) + +(defn query + "Queries this date-time using the specified query. + + This queries this date-time using the specified query strategy object. + The {@code TemporalQuery} object defines the logic to be used to + obtain the result. Read the documentation of the query to understand + what the result of this method will be. + + The result of this method is obtained by invoking the + {@link TemporalQuery#queryFrom(TemporalAccessor)} method on the + specified query passing {@code this} as the argument. + + @param the type of the result + @param query the query to invoke, not null + @return the query result, null may be returned (defined by the query) + @throws DateTimeException if unable to query (defined by the query) + @throws ArithmeticException if numeric overflow occurs (defined by the query)" + {:arglists (quote (["java.time.LocalDateTime" + "java.time.temporal.TemporalQuery"]))} + (^java.lang.Object + [^java.time.LocalDateTime this ^java.time.temporal.TemporalQuery query] + (.query this query))) + +(defn get-day-of-week + "Gets the day-of-week field, which is an enum {@code DayOfWeek}. + + This method returns the enum {@link DayOfWeek} for the day-of-week. + This avoids confusion as to what {@code int} values mean. + If you need access to the primitive {@code int} value then the enum + provides the {@link DayOfWeek#getValue() int value}. + + Additional information can be obtained from the {@code DayOfWeek}. + This includes textual names of the values. + + @return the day-of-week, not null" + {:arglists (quote (["java.time.LocalDateTime"]))} + (^java.time.DayOfWeek [^java.time.LocalDateTime this] (.getDayOfWeek this))) + +(defn to-string + "Outputs this date-time as a {@code String}, such as {@code 2007-12-03T10:15:30}. + + The output will be one of the following ISO-8601 formats: +
    +
  • {@code uuuu-MM-dd'T'HH:mm}
  • +
  • {@code uuuu-MM-dd'T'HH:mm:ss}
  • +
  • {@code uuuu-MM-dd'T'HH:mm:ss.SSS}
  • +
  • {@code uuuu-MM-dd'T'HH:mm:ss.SSSSSS}
  • +
  • {@code uuuu-MM-dd'T'HH:mm:ss.SSSSSSSSS}
  • +
+ The format used will be the shortest that outputs the full value of + the time where the omitted parts are implied to be zero. + + @return a string representation of this date-time, not null" + {:arglists (quote (["java.time.LocalDateTime"]))} + (^java.lang.String [^java.time.LocalDateTime this] (.toString this))) + +(defn plus-months + "Returns a copy of this {@code LocalDateTime} with the specified number of months added. + + This method adds the specified amount to the months field in three steps: +
    +
  1. Add the input months to the month-of-year field
  2. +
  3. Check if the resulting date would be invalid
  4. +
  5. Adjust the day-of-month to the last valid day if necessary
  6. +
+ + For example, 2007-03-31 plus one month would result in the invalid date + 2007-04-31. Instead of returning an invalid result, the last valid day + of the month, 2007-04-30, is selected instead. + + This instance is immutable and unaffected by this method call. + + @param months the months to add, may be negative + @return a {@code LocalDateTime} based on this date-time with the months added, not null + @throws DateTimeException if the result exceeds the supported date range" + {:arglists (quote (["java.time.LocalDateTime" "long"]))} + (^java.time.LocalDateTime [^java.time.LocalDateTime this ^long months] + (.plusMonths this months))) + +(defn is-before + "Checks if this date-time is before the specified date-time. + + This checks to see if this date-time represents a point on the + local time-line before the other date-time. +
+   LocalDate a = LocalDateTime.of(2012, 6, 30, 12, 00);
+   LocalDate b = LocalDateTime.of(2012, 7, 1, 12, 00);
+   a.isBefore(b) == true
+   a.isBefore(a) == false
+   b.isBefore(a) == false
+ 
+ + This method only considers the position of the two date-times on the local time-line. + It does not take into account the chronology, or calendar system. + This is different from the comparison in {@link #compareTo(ChronoLocalDateTime)}, + but is the same approach as {@link ChronoLocalDateTime#timeLineOrder()}. + + @param other the other date-time to compare to, not null + @return true if this date-time is before the specified date-time" + {:arglists (quote (["java.time.LocalDateTime" + "java.time.chrono.ChronoLocalDateTime"]))} + (^java.lang.Boolean + [^java.time.LocalDateTime this ^java.time.chrono.ChronoLocalDateTime other] + (.isBefore this other))) + +(defn minus-months + "Returns a copy of this {@code LocalDateTime} with the specified number of months subtracted. + + This method subtracts the specified amount from the months field in three steps: +
    +
  1. Subtract the input months from the month-of-year field
  2. +
  3. Check if the resulting date would be invalid
  4. +
  5. Adjust the day-of-month to the last valid day if necessary
  6. +
+ + For example, 2007-03-31 minus one month would result in the invalid date + 2007-04-31. Instead of returning an invalid result, the last valid day + of the month, 2007-04-30, is selected instead. + + This instance is immutable and unaffected by this method call. + + @param months the months to subtract, may be negative + @return a {@code LocalDateTime} based on this date-time with the months subtracted, not null + @throws DateTimeException if the result exceeds the supported date range" + {:arglists (quote (["java.time.LocalDateTime" "long"]))} + (^java.time.LocalDateTime [^java.time.LocalDateTime this ^long months] + (.minusMonths this months))) + +(defn minus + {:arglists (quote (["java.time.LocalDateTime" + "java.time.temporal.TemporalAmount"] + ["java.time.LocalDateTime" "long" + "java.time.temporal.TemporalUnit"]))} + (^java.time.LocalDateTime + [^java.time.LocalDateTime this + ^java.time.temporal.TemporalAmount amount-to-subtract] + (.minus this amount-to-subtract)) + (^java.time.LocalDateTime + [^java.time.LocalDateTime this ^long amount-to-subtract + ^java.time.temporal.ChronoUnit unit] + (.minus this amount-to-subtract unit))) + +(defn at-zone + "Combines this date-time with a time-zone to create a {@code ZonedDateTime}. + + This returns a {@code ZonedDateTime} formed from this date-time at the + specified time-zone. The result will match this date-time as closely as possible. + Time-zone rules, such as daylight savings, mean that not every local date-time + is valid for the specified zone, thus the local date-time may be adjusted. + + The local date-time is resolved to a single instant on the time-line. + This is achieved by finding a valid offset from UTC/Greenwich for the local + date-time as defined by the {@link ZoneRules rules} of the zone ID. + + In most cases, there is only one valid offset for a local date-time. + In the case of an overlap, where clocks are set back, there are two valid offsets. + This method uses the earlier offset typically corresponding to \"summer\". + + In the case of a gap, where clocks jump forward, there is no valid offset. + Instead, the local date-time is adjusted to be later by the length of the gap. + For a typical one hour daylight savings change, the local date-time will be + moved one hour later into the offset typically corresponding to \"summer\". + + To obtain the later offset during an overlap, call + {@link ZonedDateTime#withLaterOffsetAtOverlap()} on the result of this method. + To throw an exception when there is a gap or overlap, use + {@link ZonedDateTime#ofStrict(LocalDateTime, ZoneOffset, ZoneId)}. + + @param zone the time-zone to use, not null + @return the zoned date-time formed from this date-time, not null" + {:arglists (quote (["java.time.LocalDateTime" "java.time.ZoneId"]))} + (^java.time.ZonedDateTime + [^java.time.LocalDateTime this ^java.time.ZoneId zone] + (.atZone this zone))) + +(defn plus-hours + "Returns a copy of this {@code LocalDateTime} with the specified number of hours added. + + This instance is immutable and unaffected by this method call. + + @param hours the hours to add, may be negative + @return a {@code LocalDateTime} based on this date-time with the hours added, not null + @throws DateTimeException if the result exceeds the supported date range" + {:arglists (quote (["java.time.LocalDateTime" "long"]))} + (^java.time.LocalDateTime [^java.time.LocalDateTime this ^long hours] + (.plusHours this hours))) + +(defn plus-days + "Returns a copy of this {@code LocalDateTime} with the specified number of days added. + + This method adds the specified amount to the days field incrementing the + month and year fields as necessary to ensure the result remains valid. + The result is only invalid if the maximum/minimum year is exceeded. + + For example, 2008-12-31 plus one day would result in 2009-01-01. + + This instance is immutable and unaffected by this method call. + + @param days the days to add, may be negative + @return a {@code LocalDateTime} based on this date-time with the days added, not null + @throws DateTimeException if the result exceeds the supported date range" + {:arglists (quote (["java.time.LocalDateTime" "long"]))} + (^java.time.LocalDateTime [^java.time.LocalDateTime this ^long days] + (.plusDays this days))) + +(defn to-local-time + "Gets the {@code LocalTime} part of this date-time. + + This returns a {@code LocalTime} with the same hour, minute, second and + nanosecond as this date-time. + + @return the time part of this date-time, not null" + {:arglists (quote (["java.time.LocalDateTime"]))} + (^java.time.LocalTime [^java.time.LocalDateTime this] (.toLocalTime this))) + +(defn get-long + "Gets the value of the specified field from this date-time as a {@code long}. + + This queries this date-time for the value of the specified field. + If it is not possible to return the value, because the field is not supported + or for some other reason, an exception is thrown. + + If the field is a {@link ChronoField} then the query is implemented here. + The {@link #isSupported(TemporalField) supported fields} will return valid + values based on this date-time. + All other {@code ChronoField} instances will throw an {@code UnsupportedTemporalTypeException}. + + If the field is not a {@code ChronoField}, then the result of this method + is obtained by invoking {@code TemporalField.getFrom(TemporalAccessor)} + passing {@code this} as the argument. Whether the value can be obtained, + and what the value represents, is determined by the field. + + @param field the field to get, not null + @return the value for the field + @throws DateTimeException if a value for the field cannot be obtained + @throws UnsupportedTemporalTypeException if the field is not supported + @throws ArithmeticException if numeric overflow occurs" + {:arglists (quote (["java.time.LocalDateTime" + "java.time.temporal.TemporalField"]))} + (^long [^java.time.LocalDateTime this ^java.time.temporal.TemporalField field] + (.getLong this field))) + +(defn with-year + "Returns a copy of this {@code LocalDateTime} with the year altered. + + The time does not affect the calculation and will be the same in the result. + If the day-of-month is invalid for the year, it will be changed to the last valid day of the month. + + This instance is immutable and unaffected by this method call. + + @param year the year to set in the result, from MIN_YEAR to MAX_YEAR + @return a {@code LocalDateTime} based on this date-time with the requested year, not null + @throws DateTimeException if the year value is invalid" + {:arglists (quote (["java.time.LocalDateTime" "int"]))} + (^java.time.LocalDateTime + [^java.time.LocalDateTime this ^java.lang.Integer year] + (.withYear this year))) + +(defn with-nano + "Returns a copy of this {@code LocalDateTime} with the nano-of-second altered. + + This instance is immutable and unaffected by this method call. + + @param nanoOfSecond the nano-of-second to set in the result, from 0 to 999,999,999 + @return a {@code LocalDateTime} based on this date-time with the requested nanosecond, not null + @throws DateTimeException if the nano value is invalid" + {:arglists (quote (["java.time.LocalDateTime" "int"]))} + (^java.time.LocalDateTime + [^java.time.LocalDateTime this ^java.lang.Integer nano-of-second] + (.withNano this nano-of-second))) + +(defn to-epoch-second + "Converts this date-time to the number of seconds from the epoch + of 1970-01-01T00:00:00Z. + + This combines this local date-time and the specified offset to calculate the + epoch-second value, which is the number of elapsed seconds from 1970-01-01T00:00:00Z. + Instants on the time-line after the epoch are positive, earlier are negative. + + This default implementation calculates from the epoch-day of the date and the + second-of-day of the time. + + @param offset the offset to use for the conversion, not null + @return the number of seconds from the epoch of 1970-01-01T00:00:00Z" + {:arglists (quote (["java.time.LocalDateTime" "java.time.ZoneOffset"]))} + (^long [^java.time.LocalDateTime this ^java.time.ZoneOffset offset] + (.toEpochSecond this offset))) + +(defn until + "Calculates the amount of time until another date-time in terms of the specified unit. + + This calculates the amount of time between two {@code LocalDateTime} + objects in terms of a single {@code TemporalUnit}. + The start and end points are {@code this} and the specified date-time. + The result will be negative if the end is before the start. + The {@code Temporal} passed to this method is converted to a + {@code LocalDateTime} using {@link #from(TemporalAccessor)}. + For example, the amount in days between two date-times can be calculated + using {@code startDateTime.until(endDateTime, DAYS)}. + + The calculation returns a whole number, representing the number of + complete units between the two date-times. + For example, the amount in months between 2012-06-15T00:00 and 2012-08-14T23:59 + will only be one month as it is one minute short of two months. + + There are two equivalent ways of using this method. + The first is to invoke this method. + The second is to use {@link TemporalUnit#between(Temporal, Temporal)}: +
+   // these two lines are equivalent
+   amount = start.until(end, MONTHS);
+   amount = MONTHS.between(start, end);
+ 
+ The choice should be made based on which makes the code more readable. + + The calculation is implemented in this method for {@link ChronoUnit}. + The units {@code NANOS}, {@code MICROS}, {@code MILLIS}, {@code SECONDS}, + {@code MINUTES}, {@code HOURS} and {@code HALF_DAYS}, {@code DAYS}, + {@code WEEKS}, {@code MONTHS}, {@code YEARS}, {@code DECADES}, + {@code CENTURIES}, {@code MILLENNIA} and {@code ERAS} are supported. + Other {@code ChronoUnit} values will throw an exception. + + If the unit is not a {@code ChronoUnit}, then the result of this method + is obtained by invoking {@code TemporalUnit.between(Temporal, Temporal)} + passing {@code this} as the first argument and the converted input temporal + as the second argument. + + This instance is immutable and unaffected by this method call. + + @param endExclusive the end date, exclusive, which is converted to a {@code LocalDateTime}, not null + @param unit the unit to measure the amount in, not null + @return the amount of time between this date-time and the end date-time + @throws DateTimeException if the amount cannot be calculated, or the end + temporal cannot be converted to a {@code LocalDateTime} + @throws UnsupportedTemporalTypeException if the unit is not supported + @throws ArithmeticException if numeric overflow occurs" + {:arglists (quote (["java.time.LocalDateTime" "java.time.temporal.Temporal" + "java.time.temporal.TemporalUnit"]))} + (^long + [^java.time.LocalDateTime this ^java.time.temporal.Temporal end-exclusive + ^java.time.temporal.ChronoUnit unit] + (.until this end-exclusive unit))) + +(defn with-day-of-month + "Returns a copy of this {@code LocalDateTime} with the day-of-month altered. + + If the resulting date-time is invalid, an exception is thrown. + The time does not affect the calculation and will be the same in the result. + + This instance is immutable and unaffected by this method call. + + @param dayOfMonth the day-of-month to set in the result, from 1 to 28-31 + @return a {@code LocalDateTime} based on this date-time with the requested day, not null + @throws DateTimeException if the day-of-month value is invalid, + or if the day-of-month is invalid for the month-year" + {:arglists (quote (["java.time.LocalDateTime" "int"]))} + (^java.time.LocalDateTime + [^java.time.LocalDateTime this ^java.lang.Integer day-of-month] + (.withDayOfMonth this day-of-month))) + +(defn get-day-of-month + "Gets the day-of-month field. + + This method returns the primitive {@code int} value for the day-of-month. + + @return the day-of-month, from 1 to 31" + {:arglists (quote (["java.time.LocalDateTime"]))} + (^java.lang.Integer [^java.time.LocalDateTime this] (.getDayOfMonth this))) + +(defn from + "Obtains an instance of {@code LocalDateTime} from a temporal object. + + This obtains a local date-time based on the specified temporal. + A {@code TemporalAccessor} represents an arbitrary set of date and time information, + which this factory converts to an instance of {@code LocalDateTime}. + + The conversion extracts and combines the {@code LocalDate} and the + {@code LocalTime} from the temporal object. + Implementations are permitted to perform optimizations such as accessing + those fields that are equivalent to the relevant objects. + + This method matches the signature of the functional interface {@link TemporalQuery} + allowing it to be used as a query via method reference, {@code LocalDateTime::from}. + + @param temporal the temporal object to convert, not null + @return the local date-time, not null + @throws DateTimeException if unable to convert to a {@code LocalDateTime}" + {:arglists (quote (["java.time.temporal.TemporalAccessor"]))} + (^java.time.LocalDateTime [^java.time.temporal.TemporalAccessor temporal] + (java.time.LocalDateTime/from temporal))) + +(defn is-after + "Checks if this date-time is after the specified date-time. + + This checks to see if this date-time represents a point on the + local time-line after the other date-time. +
+   LocalDate a = LocalDateTime.of(2012, 6, 30, 12, 00);
+   LocalDate b = LocalDateTime.of(2012, 7, 1, 12, 00);
+   a.isAfter(b) == false
+   a.isAfter(a) == false
+   b.isAfter(a) == true
+ 
+ + This method only considers the position of the two date-times on the local time-line. + It does not take into account the chronology, or calendar system. + This is different from the comparison in {@link #compareTo(ChronoLocalDateTime)}, + but is the same approach as {@link ChronoLocalDateTime#timeLineOrder()}. + + @param other the other date-time to compare to, not null + @return true if this date-time is after the specified date-time" + {:arglists (quote (["java.time.LocalDateTime" + "java.time.chrono.ChronoLocalDateTime"]))} + (^java.lang.Boolean + [^java.time.LocalDateTime this ^java.time.chrono.ChronoLocalDateTime other] + (.isAfter this other))) + +(defn minus-nanos + "Returns a copy of this {@code LocalDateTime} with the specified number of nanoseconds subtracted. + + This instance is immutable and unaffected by this method call. + + @param nanos the nanos to subtract, may be negative + @return a {@code LocalDateTime} based on this date-time with the nanoseconds subtracted, not null + @throws DateTimeException if the result exceeds the supported date range" + {:arglists (quote (["java.time.LocalDateTime" "long"]))} + (^java.time.LocalDateTime [^java.time.LocalDateTime this ^long nanos] + (.minusNanos this nanos))) + +(defn is-supported + {:arglists (quote + (["java.time.LocalDateTime" "java.time.temporal.TemporalField"] + ["java.time.LocalDateTime" "java.time.temporal.TemporalUnit"]))} + (^java.lang.Boolean [^java.time.LocalDateTime this arg0] + (cond (instance? java.time.temporal.TemporalField arg0) + (let [^java.time.temporal.TemporalField field arg0] + (.isSupported this field)) + (instance? java.time.temporal.ChronoUnit arg0) + (let [^java.time.temporal.TemporalUnit unit arg0] + (.isSupported this unit)) + :else (throw (java.lang.IllegalArgumentException. + "no corresponding java.time method with these args"))))) + +(defn minus-years + "Returns a copy of this {@code LocalDateTime} with the specified number of years subtracted. + + This method subtracts the specified amount from the years field in three steps: +
    +
  1. Subtract the input years from the year field
  2. +
  3. Check if the resulting date would be invalid
  4. +
  5. Adjust the day-of-month to the last valid day if necessary
  6. +
+ + For example, 2008-02-29 (leap year) minus one year would result in the + invalid date 2009-02-29 (standard year). Instead of returning an invalid + result, the last valid day of the month, 2009-02-28, is selected instead. + + This instance is immutable and unaffected by this method call. + + @param years the years to subtract, may be negative + @return a {@code LocalDateTime} based on this date-time with the years subtracted, not null + @throws DateTimeException if the result exceeds the supported date range" + {:arglists (quote (["java.time.LocalDateTime" "long"]))} + (^java.time.LocalDateTime [^java.time.LocalDateTime this ^long years] + (.minusYears this years))) + +(defn get-chronology + "Gets the chronology of this date-time. + + The {@code Chronology} represents the calendar system in use. + The era and other fields in {@link ChronoField} are defined by the chronology. + + @return the chronology, not null" + {:arglists (quote (["java.time.LocalDateTime"]))} + (^java.time.chrono.Chronology [^java.time.LocalDateTime this] + (.getChronology this))) + +(defn parse + {:arglists (quote (["java.lang.CharSequence"] + ["java.lang.CharSequence" + "java.time.format.DateTimeFormatter"]))} + (^java.time.LocalDateTime [^java.lang.CharSequence text] + (java.time.LocalDateTime/parse text)) + (^java.time.LocalDateTime + [^java.lang.CharSequence text ^java.time.format.DateTimeFormatter formatter] + (java.time.LocalDateTime/parse text formatter))) + +(defn with-second + "Returns a copy of this {@code LocalDateTime} with the second-of-minute altered. + + This instance is immutable and unaffected by this method call. + + @param second the second-of-minute to set in the result, from 0 to 59 + @return a {@code LocalDateTime} based on this date-time with the requested second, not null + @throws DateTimeException if the second value is invalid" + {:arglists (quote (["java.time.LocalDateTime" "int"]))} + (^java.time.LocalDateTime + [^java.time.LocalDateTime this ^java.lang.Integer second] + (.withSecond this second))) + +(defn to-local-date + "Gets the {@code LocalDate} part of this date-time. + + This returns a {@code LocalDate} with the same year, month and day + as this date-time. + + @return the date part of this date-time, not null" + {:arglists (quote (["java.time.LocalDateTime"]))} + (^java.time.LocalDate [^java.time.LocalDateTime this] (.toLocalDate this))) + +(defn get-minute + "Gets the minute-of-hour field. + + @return the minute-of-hour, from 0 to 59" + {:arglists (quote (["java.time.LocalDateTime"]))} + (^java.lang.Integer [^java.time.LocalDateTime this] (.getMinute this))) + +(defn hash-code + "A hash code for this date-time. + + @return a suitable hash code" + {:arglists (quote (["java.time.LocalDateTime"]))} + (^java.lang.Integer [^java.time.LocalDateTime this] (.hashCode this))) + +(defn adjust-into + "Adjusts the specified temporal object to have the same date and time as this object. + + This returns a temporal object of the same observable type as the input + with the date and time changed to be the same as this. + + The adjustment is equivalent to using {@link Temporal#with(TemporalField, long)} + twice, passing {@link ChronoField#EPOCH_DAY} and + {@link ChronoField#NANO_OF_DAY} as the fields. + + In most cases, it is clearer to reverse the calling pattern by using + {@link Temporal#with(TemporalAdjuster)}: +
+   // these two lines are equivalent, but the second approach is recommended
+   temporal = thisLocalDateTime.adjustInto(temporal);
+   temporal = temporal.with(thisLocalDateTime);
+ 
+ + This instance is immutable and unaffected by this method call. + + @param temporal the target object to be adjusted, not null + @return the adjusted object, not null + @throws DateTimeException if unable to make the adjustment + @throws ArithmeticException if numeric overflow occurs" + {:arglists (quote (["java.time.LocalDateTime" + "java.time.temporal.Temporal"]))} + (^java.time.temporal.Temporal + [^java.time.LocalDateTime this ^java.time.temporal.Temporal temporal] + (.adjustInto this temporal))) + +(defn with + {:arglists (quote (["java.time.LocalDateTime" + "java.time.temporal.TemporalAdjuster"] + ["java.time.LocalDateTime" + "java.time.temporal.TemporalField" "long"]))} + (^java.time.LocalDateTime + [^java.time.LocalDateTime this ^java.time.temporal.TemporalAdjuster adjuster] + (.with this adjuster)) + (^java.time.LocalDateTime + [^java.time.LocalDateTime this ^java.time.temporal.TemporalField field + ^long new-value] + (.with this field new-value))) + +(defn now + {:arglists (quote ([] ["java.time.Clock"] ["java.time.ZoneId"]))} + (^java.time.LocalDateTime [] (java.time.LocalDateTime/now)) + (^java.time.LocalDateTime [arg0] + (cond (instance? java.time.Clock arg0) (let [^java.time.Clock clock arg0] + (java.time.LocalDateTime/now clock)) + (instance? java.time.ZoneId arg0) (let [^java.time.ZoneId zone arg0] + (java.time.LocalDateTime/now zone)) + :else (throw (java.lang.IllegalArgumentException. + "no corresponding java.time method with these args"))))) + +(defn get-month-value + "Gets the month-of-year field from 1 to 12. + + This method returns the month as an {@code int} from 1 to 12. + Application code is frequently clearer if the enum {@link Month} + is used by calling {@link #getMonth()}. + + @return the month-of-year, from 1 to 12 + @see #getMonth()" + {:arglists (quote (["java.time.LocalDateTime"]))} + (^java.lang.Integer [^java.time.LocalDateTime this] (.getMonthValue this))) + +(defn with-day-of-year + "Returns a copy of this {@code LocalDateTime} with the day-of-year altered. + + If the resulting date-time is invalid, an exception is thrown. + + This instance is immutable and unaffected by this method call. + + @param dayOfYear the day-of-year to set in the result, from 1 to 365-366 + @return a {@code LocalDateTime} based on this date with the requested day, not null + @throws DateTimeException if the day-of-year value is invalid, + or if the day-of-year is invalid for the year" + {:arglists (quote (["java.time.LocalDateTime" "int"]))} + (^java.time.LocalDateTime + [^java.time.LocalDateTime this ^java.lang.Integer day-of-year] + (.withDayOfYear this day-of-year))) + +(defn compare-to + "Compares this date-time to another date-time. + + The comparison is primarily based on the date-time, from earliest to latest. + It is \"consistent with equals\", as defined by {@link Comparable}. + + If all the date-times being compared are instances of {@code LocalDateTime}, + then the comparison will be entirely based on the date-time. + If some dates being compared are in different chronologies, then the + chronology is also considered, see {@link ChronoLocalDateTime#compareTo}. + + @param other the other date-time to compare to, not null + @return the comparator value, negative if less, positive if greater" + {:arglists (quote (["java.time.LocalDateTime" + "java.time.chrono.ChronoLocalDateTime"]))} + (^java.lang.Integer + [^java.time.LocalDateTime this ^java.time.chrono.ChronoLocalDateTime other] + (.compareTo this other))) + +(defn get-month + "Gets the month-of-year field using the {@code Month} enum. + + This method returns the enum {@link Month} for the month. + This avoids confusion as to what {@code int} values mean. + If you need access to the primitive {@code int} value then the enum + provides the {@link Month#getValue() int value}. + + @return the month-of-year, not null + @see #getMonthValue()" + {:arglists (quote (["java.time.LocalDateTime"]))} + (^java.time.Month [^java.time.LocalDateTime this] (.getMonth this))) + +(defn of-instant + "Obtains an instance of {@code LocalDateTime} from an {@code Instant} and zone ID. + + This creates a local date-time based on the specified instant. + First, the offset from UTC/Greenwich is obtained using the zone ID and instant, + which is simple as there is only one valid offset for each instant. + Then, the instant and offset are used to calculate the local date-time. + + @param instant the instant to create the date-time from, not null + @param zone the time-zone, which may be an offset, not null + @return the local date-time, not null + @throws DateTimeException if the result exceeds the supported range" + {:arglists (quote (["java.time.Instant" "java.time.ZoneId"]))} + (^java.time.LocalDateTime [^java.time.Instant instant ^java.time.ZoneId zone] + (java.time.LocalDateTime/ofInstant instant zone))) + +(defn plus-seconds + "Returns a copy of this {@code LocalDateTime} with the specified number of seconds added. + + This instance is immutable and unaffected by this method call. + + @param seconds the seconds to add, may be negative + @return a {@code LocalDateTime} based on this date-time with the seconds added, not null + @throws DateTimeException if the result exceeds the supported date range" + {:arglists (quote (["java.time.LocalDateTime" "long"]))} + (^java.time.LocalDateTime [^java.time.LocalDateTime this ^long seconds] + (.plusSeconds this seconds))) + +(defn get + "Gets the value of the specified field from this date-time as an {@code int}. + + This queries this date-time for the value of the specified field. + The returned value will always be within the valid range of values for the field. + If it is not possible to return the value, because the field is not supported + or for some other reason, an exception is thrown. + + If the field is a {@link ChronoField} then the query is implemented here. + The {@link #isSupported(TemporalField) supported fields} will return valid + values based on this date-time, except {@code NANO_OF_DAY}, {@code MICRO_OF_DAY}, + {@code EPOCH_DAY} and {@code PROLEPTIC_MONTH} which are too large to fit in + an {@code int} and throw a {@code DateTimeException}. + All other {@code ChronoField} instances will throw an {@code UnsupportedTemporalTypeException}. + + If the field is not a {@code ChronoField}, then the result of this method + is obtained by invoking {@code TemporalField.getFrom(TemporalAccessor)} + passing {@code this} as the argument. Whether the value can be obtained, + and what the value represents, is determined by the field. + + @param field the field to get, not null + @return the value for the field + @throws DateTimeException if a value for the field cannot be obtained or + the value is outside the range of valid values for the field + @throws UnsupportedTemporalTypeException if the field is not supported or + the range of values exceeds an {@code int} + @throws ArithmeticException if numeric overflow occurs" + {:arglists (quote (["java.time.LocalDateTime" + "java.time.temporal.TemporalField"]))} + (^java.lang.Integer + [^java.time.LocalDateTime this ^java.time.temporal.TemporalField field] + (.get this field))) + +(defn equals + "Checks if this date-time is equal to another date-time. + + Compares this {@code LocalDateTime} with another ensuring that the date-time is the same. + Only objects of type {@code LocalDateTime} are compared, other types return false. + + @param obj the object to check, null returns false + @return true if this is equal to the other date-time" + {:arglists (quote (["java.time.LocalDateTime" "java.lang.Object"]))} + (^java.lang.Boolean [^java.time.LocalDateTime this ^java.lang.Object obj] + (.equals this obj))) + +(defn format + "Formats this date-time using the specified formatter. + + This date-time will be passed to the formatter to produce a string. + + @param formatter the formatter to use, not null + @return the formatted date-time string, not null + @throws DateTimeException if an error occurs during printing" + {:arglists (quote (["java.time.LocalDateTime" + "java.time.format.DateTimeFormatter"]))} + (^java.lang.String + [^java.time.LocalDateTime this ^java.time.format.DateTimeFormatter formatter] + (.format this formatter))) + +(defn plus-years + "Returns a copy of this {@code LocalDateTime} with the specified number of years added. + + This method adds the specified amount to the years field in three steps: +
    +
  1. Add the input years to the year field
  2. +
  3. Check if the resulting date would be invalid
  4. +
  5. Adjust the day-of-month to the last valid day if necessary
  6. +
+ + For example, 2008-02-29 (leap year) plus one year would result in the + invalid date 2009-02-29 (standard year). Instead of returning an invalid + result, the last valid day of the month, 2009-02-28, is selected instead. + + This instance is immutable and unaffected by this method call. + + @param years the years to add, may be negative + @return a {@code LocalDateTime} based on this date-time with the years added, not null + @throws DateTimeException if the result exceeds the supported date range" + {:arglists (quote (["java.time.LocalDateTime" "long"]))} + (^java.time.LocalDateTime [^java.time.LocalDateTime this ^long years] + (.plusYears this years))) + +(defn minus-days + "Returns a copy of this {@code LocalDateTime} with the specified number of days subtracted. + + This method subtracts the specified amount from the days field decrementing the + month and year fields as necessary to ensure the result remains valid. + The result is only invalid if the maximum/minimum year is exceeded. + + For example, 2009-01-01 minus one day would result in 2008-12-31. + + This instance is immutable and unaffected by this method call. + + @param days the days to subtract, may be negative + @return a {@code LocalDateTime} based on this date-time with the days subtracted, not null + @throws DateTimeException if the result exceeds the supported date range" + {:arglists (quote (["java.time.LocalDateTime" "long"]))} + (^java.time.LocalDateTime [^java.time.LocalDateTime this ^long days] + (.minusDays this days))) diff --git a/src/cljc/java_time/local_date_time.cljs b/src/cljc/java_time/local_date_time.cljs index 3f10c48..80f0818 100644 --- a/src/cljc/java_time/local_date_time.cljs +++ b/src/cljc/java_time/local_date_time.cljs @@ -1,69 +1,1101 @@ -(ns cljc.java-time.local-date-time (:refer-clojure :exclude [abs get range format min max next name resolve short]) (:require [cljc.java-time.extn.calendar-awareness] [goog.object] [java.time :refer [LocalDateTime]])) -(def max (goog.object/get java.time.LocalDateTime "MAX")) -(def min (goog.object/get java.time.LocalDateTime "MIN")) -(clojure.core/defn minus-minutes {:arglists (quote (["java.time.LocalDateTime" "long"]))} (^js/JSJoda.LocalDateTime [^js/JSJoda.LocalDateTime this13415 ^long long13416] (.minusMinutes this13415 long13416))) -(clojure.core/defn truncated-to {:arglists (quote (["java.time.LocalDateTime" "java.time.temporal.TemporalUnit"]))} (^js/JSJoda.LocalDateTime [^js/JSJoda.LocalDateTime this13417 ^js/JSJoda.TemporalUnit java-time-temporal-TemporalUnit13418] (.truncatedTo this13417 java-time-temporal-TemporalUnit13418))) -(clojure.core/defn minus-weeks {:arglists (quote (["java.time.LocalDateTime" "long"]))} (^js/JSJoda.LocalDateTime [^js/JSJoda.LocalDateTime this13419 ^long long13420] (.minusWeeks this13419 long13420))) -(clojure.core/defn to-instant {:arglists (quote (["java.time.LocalDateTime" "java.time.ZoneOffset"]))} (^js/JSJoda.Instant [^js/JSJoda.LocalDateTime this13421 ^js/JSJoda.ZoneOffset java-time-ZoneOffset13422] (.toInstant this13421 java-time-ZoneOffset13422))) -(clojure.core/defn plus-weeks {:arglists (quote (["java.time.LocalDateTime" "long"]))} (^js/JSJoda.LocalDateTime [^js/JSJoda.LocalDateTime this13423 ^long long13424] (.plusWeeks this13423 long13424))) -(clojure.core/defn range {:arglists (quote (["java.time.LocalDateTime" "java.time.temporal.TemporalField"]))} (^js/JSJoda.ValueRange [^js/JSJoda.LocalDateTime this13425 ^js/JSJoda.TemporalField java-time-temporal-TemporalField13426] (.range this13425 java-time-temporal-TemporalField13426))) -(clojure.core/defn of-epoch-second {:arglists (quote (["long" "int" "java.time.ZoneOffset"]))} (^js/JSJoda.LocalDateTime [^long long13427 ^int int13428 ^js/JSJoda.ZoneOffset java-time-ZoneOffset13429] (js-invoke java.time.LocalDateTime "ofEpochSecond" long13427 int13428 java-time-ZoneOffset13429))) -(clojure.core/defn get-hour {:arglists (quote (["java.time.LocalDateTime"]))} (^int [^js/JSJoda.LocalDateTime this13430] (.hour this13430))) -(clojure.core/defn at-offset {:arglists (quote (["java.time.LocalDateTime" "java.time.ZoneOffset"]))} (^js/JSJoda.OffsetDateTime [^js/JSJoda.LocalDateTime this13431 ^js/JSJoda.ZoneOffset java-time-ZoneOffset13432] (.atOffset this13431 java-time-ZoneOffset13432))) -(clojure.core/defn minus-hours {:arglists (quote (["java.time.LocalDateTime" "long"]))} (^js/JSJoda.LocalDateTime [^js/JSJoda.LocalDateTime this13433 ^long long13434] (.minusHours this13433 long13434))) -(clojure.core/defn of {:arglists (quote (["int" "java.time.Month" "int" "int" "int" "int"] ["int" "java.time.Month" "int" "int" "int" "int" "int"] ["int" "java.time.Month" "int" "int" "int"] ["java.time.LocalDate" "java.time.LocalTime"] ["int" "int" "int" "int" "int"] ["int" "int" "int" "int" "int" "int"] ["int" "int" "int" "int" "int" "int" "int"]))} (^js/JSJoda.LocalDateTime [G__13436 G__13437 G__13438 G__13439 G__13440 G__13441] (js-invoke java.time.LocalDateTime "of" G__13436 G__13437 G__13438 G__13439 G__13440 G__13441)) (^js/JSJoda.LocalDateTime [G__13443 G__13444 G__13445 G__13446 G__13447 G__13448 G__13449] (js-invoke java.time.LocalDateTime "of" G__13443 G__13444 G__13445 G__13446 G__13447 G__13448 G__13449)) (^js/JSJoda.LocalDateTime [G__13451 G__13452 G__13453 G__13454 G__13455] (js-invoke java.time.LocalDateTime "of" G__13451 G__13452 G__13453 G__13454 G__13455)) (^js/JSJoda.LocalDateTime [^js/JSJoda.LocalDate java-time-LocalDate13456 ^js/JSJoda.LocalTime java-time-LocalTime13457] (js-invoke java.time.LocalDateTime "of" java-time-LocalDate13456 java-time-LocalTime13457))) -(clojure.core/defn with-month {:arglists (quote (["java.time.LocalDateTime" "int"]))} (^js/JSJoda.LocalDateTime [^js/JSJoda.LocalDateTime this13458 ^int int13459] (.withMonth this13458 int13459))) -(clojure.core/defn is-equal {:arglists (quote (["java.time.LocalDateTime" "java.time.chrono.ChronoLocalDateTime"]))} (^boolean [^js/JSJoda.LocalDateTime this13460 ^js/JSJoda.ChronoLocalDateTime java-time-chrono-ChronoLocalDateTime13461] (.isEqual this13460 java-time-chrono-ChronoLocalDateTime13461))) -(clojure.core/defn get-nano {:arglists (quote (["java.time.LocalDateTime"]))} (^int [^js/JSJoda.LocalDateTime this13462] (.nano this13462))) -(clojure.core/defn get-year {:arglists (quote (["java.time.LocalDateTime"]))} (^int [^js/JSJoda.LocalDateTime this13463] (.year this13463))) -(clojure.core/defn minus-seconds {:arglists (quote (["java.time.LocalDateTime" "long"]))} (^js/JSJoda.LocalDateTime [^js/JSJoda.LocalDateTime this13464 ^long long13465] (.minusSeconds this13464 long13465))) -(clojure.core/defn get-second {:arglists (quote (["java.time.LocalDateTime"]))} (^int [^js/JSJoda.LocalDateTime this13466] (.second this13466))) -(clojure.core/defn plus-nanos {:arglists (quote (["java.time.LocalDateTime" "long"]))} (^js/JSJoda.LocalDateTime [^js/JSJoda.LocalDateTime this13467 ^long long13468] (.plusNanos this13467 long13468))) -(clojure.core/defn get-day-of-year {:arglists (quote (["java.time.LocalDateTime"]))} (^int [^js/JSJoda.LocalDateTime this13469] (.dayOfYear this13469))) -(clojure.core/defn plus {:arglists (quote (["java.time.LocalDateTime" "java.time.temporal.TemporalAmount"] ["java.time.LocalDateTime" "long" "java.time.temporal.TemporalUnit"]))} (^js/JSJoda.LocalDateTime [^js/JSJoda.LocalDateTime this13470 ^js/JSJoda.TemporalAmount java-time-temporal-TemporalAmount13471] (.plus this13470 java-time-temporal-TemporalAmount13471)) (^js/JSJoda.LocalDateTime [^js/JSJoda.LocalDateTime this13472 ^long long13473 ^js/JSJoda.TemporalUnit java-time-temporal-TemporalUnit13474] (.plus this13472 long13473 java-time-temporal-TemporalUnit13474))) -(clojure.core/defn with-hour {:arglists (quote (["java.time.LocalDateTime" "int"]))} (^js/JSJoda.LocalDateTime [^js/JSJoda.LocalDateTime this13475 ^int int13476] (.withHour this13475 int13476))) -(clojure.core/defn with-minute {:arglists (quote (["java.time.LocalDateTime" "int"]))} (^js/JSJoda.LocalDateTime [^js/JSJoda.LocalDateTime this13477 ^int int13478] (.withMinute this13477 int13478))) -(clojure.core/defn plus-minutes {:arglists (quote (["java.time.LocalDateTime" "long"]))} (^js/JSJoda.LocalDateTime [^js/JSJoda.LocalDateTime this13479 ^long long13480] (.plusMinutes this13479 long13480))) -(clojure.core/defn query {:arglists (quote (["java.time.LocalDateTime" "java.time.temporal.TemporalQuery"]))} (^java.lang.Object [^js/JSJoda.LocalDateTime this13481 ^js/JSJoda.TemporalQuery java-time-temporal-TemporalQuery13482] (.query this13481 java-time-temporal-TemporalQuery13482))) -(clojure.core/defn get-day-of-week {:arglists (quote (["java.time.LocalDateTime"]))} (^js/JSJoda.DayOfWeek [^js/JSJoda.LocalDateTime this13483] (.dayOfWeek this13483))) -(clojure.core/defn to-string {:arglists (quote (["java.time.LocalDateTime"]))} (^java.lang.String [^js/JSJoda.LocalDateTime this13484] (.toString this13484))) -(clojure.core/defn plus-months {:arglists (quote (["java.time.LocalDateTime" "long"]))} (^js/JSJoda.LocalDateTime [^js/JSJoda.LocalDateTime this13485 ^long long13486] (.plusMonths this13485 long13486))) -(clojure.core/defn is-before {:arglists (quote (["java.time.LocalDateTime" "java.time.chrono.ChronoLocalDateTime"]))} (^boolean [^js/JSJoda.LocalDateTime this13487 ^js/JSJoda.ChronoLocalDateTime java-time-chrono-ChronoLocalDateTime13488] (.isBefore this13487 java-time-chrono-ChronoLocalDateTime13488))) -(clojure.core/defn minus-months {:arglists (quote (["java.time.LocalDateTime" "long"]))} (^js/JSJoda.LocalDateTime [^js/JSJoda.LocalDateTime this13489 ^long long13490] (.minusMonths this13489 long13490))) -(clojure.core/defn minus {:arglists (quote (["java.time.LocalDateTime" "long" "java.time.temporal.TemporalUnit"] ["java.time.LocalDateTime" "java.time.temporal.TemporalAmount"]))} (^js/JSJoda.LocalDateTime [^js/JSJoda.LocalDateTime this13491 ^long long13492 ^js/JSJoda.TemporalUnit java-time-temporal-TemporalUnit13493] (.minus this13491 long13492 java-time-temporal-TemporalUnit13493)) (^js/JSJoda.LocalDateTime [^js/JSJoda.LocalDateTime this13494 ^js/JSJoda.TemporalAmount java-time-temporal-TemporalAmount13495] (.minus this13494 java-time-temporal-TemporalAmount13495))) -(clojure.core/defn at-zone {:arglists (quote (["java.time.LocalDateTime" "java.time.ZoneId"]))} (^js/JSJoda.ZonedDateTime [^js/JSJoda.LocalDateTime this13496 ^js/JSJoda.ZoneId java-time-ZoneId13497] (.atZone this13496 java-time-ZoneId13497))) -(clojure.core/defn plus-hours {:arglists (quote (["java.time.LocalDateTime" "long"]))} (^js/JSJoda.LocalDateTime [^js/JSJoda.LocalDateTime this13498 ^long long13499] (.plusHours this13498 long13499))) -(clojure.core/defn plus-days {:arglists (quote (["java.time.LocalDateTime" "long"]))} (^js/JSJoda.LocalDateTime [^js/JSJoda.LocalDateTime this13500 ^long long13501] (.plusDays this13500 long13501))) -(clojure.core/defn to-local-time {:arglists (quote (["java.time.LocalDateTime"]))} (^js/JSJoda.LocalTime [^js/JSJoda.LocalDateTime this13502] (.toLocalTime this13502))) -(clojure.core/defn get-long {:arglists (quote (["java.time.LocalDateTime" "java.time.temporal.TemporalField"]))} (^long [^js/JSJoda.LocalDateTime this13503 ^js/JSJoda.TemporalField java-time-temporal-TemporalField13504] (.getLong this13503 java-time-temporal-TemporalField13504))) -(clojure.core/defn with-year {:arglists (quote (["java.time.LocalDateTime" "int"]))} (^js/JSJoda.LocalDateTime [^js/JSJoda.LocalDateTime this13505 ^int int13506] (.withYear this13505 int13506))) -(clojure.core/defn with-nano {:arglists (quote (["java.time.LocalDateTime" "int"]))} (^js/JSJoda.LocalDateTime [^js/JSJoda.LocalDateTime this13507 ^int int13508] (.withNano this13507 int13508))) -(clojure.core/defn to-epoch-second {:arglists (quote (["java.time.LocalDateTime" "java.time.ZoneOffset"]))} (^long [^js/JSJoda.LocalDateTime this13509 ^js/JSJoda.ZoneOffset java-time-ZoneOffset13510] (.toEpochSecond this13509 java-time-ZoneOffset13510))) -(clojure.core/defn until {:arglists (quote (["java.time.LocalDateTime" "java.time.temporal.Temporal" "java.time.temporal.TemporalUnit"]))} (^long [^js/JSJoda.LocalDateTime this13511 ^js/JSJoda.Temporal java-time-temporal-Temporal13512 ^js/JSJoda.TemporalUnit java-time-temporal-TemporalUnit13513] (.until this13511 java-time-temporal-Temporal13512 java-time-temporal-TemporalUnit13513))) -(clojure.core/defn with-day-of-month {:arglists (quote (["java.time.LocalDateTime" "int"]))} (^js/JSJoda.LocalDateTime [^js/JSJoda.LocalDateTime this13514 ^int int13515] (.withDayOfMonth this13514 int13515))) -(clojure.core/defn get-day-of-month {:arglists (quote (["java.time.LocalDateTime"]))} (^int [^js/JSJoda.LocalDateTime this13516] (.dayOfMonth this13516))) -(clojure.core/defn from {:arglists (quote (["java.time.temporal.TemporalAccessor"]))} (^js/JSJoda.LocalDateTime [^js/JSJoda.TemporalAccessor java-time-temporal-TemporalAccessor13517] (js-invoke java.time.LocalDateTime "from" java-time-temporal-TemporalAccessor13517))) -(clojure.core/defn is-after {:arglists (quote (["java.time.LocalDateTime" "java.time.chrono.ChronoLocalDateTime"]))} (^boolean [^js/JSJoda.LocalDateTime this13518 ^js/JSJoda.ChronoLocalDateTime java-time-chrono-ChronoLocalDateTime13519] (.isAfter this13518 java-time-chrono-ChronoLocalDateTime13519))) -(clojure.core/defn minus-nanos {:arglists (quote (["java.time.LocalDateTime" "long"]))} (^js/JSJoda.LocalDateTime [^js/JSJoda.LocalDateTime this13520 ^long long13521] (.minusNanos this13520 long13521))) -(clojure.core/defn is-supported {:arglists (quote (["java.time.LocalDateTime" "java.time.temporal.TemporalField"] ["java.time.LocalDateTime" "java.time.temporal.TemporalUnit"]))} (^boolean [this13522 G__13523] (.isSupported ^js/JSJoda.LocalDateTime this13522 G__13523))) -(clojure.core/defn minus-years {:arglists (quote (["java.time.LocalDateTime" "long"]))} (^js/JSJoda.LocalDateTime [^js/JSJoda.LocalDateTime this13524 ^long long13525] (.minusYears this13524 long13525))) -(clojure.core/defn get-chronology {:arglists (quote (["java.time.LocalDateTime"]))} (^js/JSJoda.Chronology [^js/JSJoda.LocalDateTime this13526] (.chronology this13526))) -(clojure.core/defn parse {:arglists (quote (["java.lang.CharSequence" "java.time.format.DateTimeFormatter"] ["java.lang.CharSequence"]))} (^js/JSJoda.LocalDateTime [^java.lang.CharSequence java-lang-CharSequence13527 ^js/JSJoda.DateTimeFormatter java-time-format-DateTimeFormatter13528] (js-invoke java.time.LocalDateTime "parse" java-lang-CharSequence13527 java-time-format-DateTimeFormatter13528)) (^js/JSJoda.LocalDateTime [^java.lang.CharSequence java-lang-CharSequence13529] (js-invoke java.time.LocalDateTime "parse" java-lang-CharSequence13529))) -(clojure.core/defn with-second {:arglists (quote (["java.time.LocalDateTime" "int"]))} (^js/JSJoda.LocalDateTime [^js/JSJoda.LocalDateTime this13530 ^int int13531] (.withSecond this13530 int13531))) -(clojure.core/defn to-local-date {:arglists (quote (["java.time.LocalDateTime"]))} (^js/JSJoda.LocalDate [^js/JSJoda.LocalDateTime this13532] (.toLocalDate this13532))) -(clojure.core/defn get-minute {:arglists (quote (["java.time.LocalDateTime"]))} (^int [^js/JSJoda.LocalDateTime this13533] (.minute this13533))) -(clojure.core/defn hash-code {:arglists (quote (["java.time.LocalDateTime"]))} (^int [^js/JSJoda.LocalDateTime this13534] (.hashCode this13534))) -(clojure.core/defn adjust-into {:arglists (quote (["java.time.LocalDateTime" "java.time.temporal.Temporal"]))} (^js/JSJoda.Temporal [^js/JSJoda.LocalDateTime this13535 ^js/JSJoda.Temporal java-time-temporal-Temporal13536] (.adjustInto this13535 java-time-temporal-Temporal13536))) -(clojure.core/defn with {:arglists (quote (["java.time.LocalDateTime" "java.time.temporal.TemporalField" "long"] ["java.time.LocalDateTime" "java.time.temporal.TemporalAdjuster"]))} (^js/JSJoda.LocalDateTime [^js/JSJoda.LocalDateTime this13537 ^js/JSJoda.TemporalField java-time-temporal-TemporalField13538 ^long long13539] (.with this13537 java-time-temporal-TemporalField13538 long13539)) (^js/JSJoda.LocalDateTime [^js/JSJoda.LocalDateTime this13540 ^js/JSJoda.TemporalAdjuster java-time-temporal-TemporalAdjuster13541] (.with this13540 java-time-temporal-TemporalAdjuster13541))) -(clojure.core/defn now {:arglists (quote ([] ["java.time.ZoneId"] ["java.time.Clock"]))} (^js/JSJoda.LocalDateTime [] (js-invoke java.time.LocalDateTime "now")) (^js/JSJoda.LocalDateTime [G__13543] (js-invoke java.time.LocalDateTime "now" G__13543))) -(clojure.core/defn get-month-value {:arglists (quote (["java.time.LocalDateTime"]))} (^int [^js/JSJoda.LocalDateTime this13544] (.monthValue this13544))) -(clojure.core/defn with-day-of-year {:arglists (quote (["java.time.LocalDateTime" "int"]))} (^js/JSJoda.LocalDateTime [^js/JSJoda.LocalDateTime this13545 ^int int13546] (.withDayOfYear this13545 int13546))) -(clojure.core/defn compare-to {:arglists (quote (["java.time.LocalDateTime" "java.time.chrono.ChronoLocalDateTime"]))} (^int [^js/JSJoda.LocalDateTime this13547 ^js/JSJoda.ChronoLocalDateTime java-time-chrono-ChronoLocalDateTime13548] (.compareTo this13547 java-time-chrono-ChronoLocalDateTime13548))) -(clojure.core/defn get-month {:arglists (quote (["java.time.LocalDateTime"]))} (^js/JSJoda.Month [^js/JSJoda.LocalDateTime this13549] (.month this13549))) -(clojure.core/defn of-instant {:arglists (quote (["java.time.Instant" "java.time.ZoneId"]))} (^js/JSJoda.LocalDateTime [^js/JSJoda.Instant java-time-Instant13550 ^js/JSJoda.ZoneId java-time-ZoneId13551] (js-invoke java.time.LocalDateTime "ofInstant" java-time-Instant13550 java-time-ZoneId13551))) -(clojure.core/defn plus-seconds {:arglists (quote (["java.time.LocalDateTime" "long"]))} (^js/JSJoda.LocalDateTime [^js/JSJoda.LocalDateTime this13552 ^long long13553] (.plusSeconds this13552 long13553))) -(clojure.core/defn get {:arglists (quote (["java.time.LocalDateTime" "java.time.temporal.TemporalField"]))} (^int [^js/JSJoda.LocalDateTime this13554 ^js/JSJoda.TemporalField java-time-temporal-TemporalField13555] (.get this13554 java-time-temporal-TemporalField13555))) -(clojure.core/defn equals {:arglists (quote (["java.time.LocalDateTime" "java.lang.Object"]))} (^boolean [^js/JSJoda.LocalDateTime this13556 ^java.lang.Object java-lang-Object13557] (.equals this13556 java-lang-Object13557))) -(clojure.core/defn format {:arglists (quote (["java.time.LocalDateTime" "java.time.format.DateTimeFormatter"]))} (^java.lang.String [^js/JSJoda.LocalDateTime this13558 ^js/JSJoda.DateTimeFormatter java-time-format-DateTimeFormatter13559] (.format this13558 java-time-format-DateTimeFormatter13559))) -(clojure.core/defn plus-years {:arglists (quote (["java.time.LocalDateTime" "long"]))} (^js/JSJoda.LocalDateTime [^js/JSJoda.LocalDateTime this13560 ^long long13561] (.plusYears this13560 long13561))) -(clojure.core/defn minus-days {:arglists (quote (["java.time.LocalDateTime" "long"]))} (^js/JSJoda.LocalDateTime [^js/JSJoda.LocalDateTime this13562 ^long long13563] (.minusDays this13562 long13563))) +(ns cljc.java-time.local-date-time + (:refer-clojure :exclude + [abs get range format min max next name resolve short]) + (:require [cljc.java-time.extn.calendar-awareness] + [goog.object] + [java.time :refer [LocalDateTime]])) + +(def max + "The maximum supported {@code LocalDateTime}, '+999999999-12-31T23:59:59.999999999'. + This is the local date-time just before midnight at the end of the maximum date. + This combines {@link LocalDate#MAX} and {@link LocalTime#MAX}. + This could be used by an application as a \"far future\" date-time." + (goog.object/get java.time.LocalDateTime "MAX")) + +(def min + "The minimum supported {@code LocalDateTime}, '-999999999-01-01T00:00:00'. + This is the local date-time of midnight at the start of the minimum date. + This combines {@link LocalDate#MIN} and {@link LocalTime#MIN}. + This could be used by an application as a \"far past\" date-time." + (goog.object/get java.time.LocalDateTime "MIN")) + +(defn minus-minutes + "Returns a copy of this {@code LocalDateTime} with the specified number of minutes subtracted. + + This instance is immutable and unaffected by this method call. + + @param minutes the minutes to subtract, may be negative + @return a {@code LocalDateTime} based on this date-time with the minutes subtracted, not null + @throws DateTimeException if the result exceeds the supported date range" + {:arglists (quote (["java.time.LocalDateTime" "long"]))} + (^js/JSJoda.LocalDateTime [^js/JSJoda.LocalDateTime this ^long minutes] + (.minusMinutes this minutes))) + +(defn truncated-to + "Returns a copy of this {@code LocalDateTime} with the time truncated. + + Truncation returns a copy of the original date-time with fields + smaller than the specified unit set to zero. + For example, truncating with the {@link ChronoUnit#MINUTES minutes} unit + will set the second-of-minute and nano-of-second field to zero. + + The unit must have a {@linkplain TemporalUnit#getDuration() duration} + that divides into the length of a standard day without remainder. + This includes all supplied time units on {@link ChronoUnit} and + {@link ChronoUnit#DAYS DAYS}. Other units throw an exception. + + This instance is immutable and unaffected by this method call. + + @param unit the unit to truncate to, not null + @return a {@code LocalDateTime} based on this date-time with the time truncated, not null + @throws DateTimeException if unable to truncate + @throws UnsupportedTemporalTypeException if the unit is not supported" + {:arglists (quote (["java.time.LocalDateTime" + "java.time.temporal.TemporalUnit"]))} + (^js/JSJoda.LocalDateTime + [^js/JSJoda.LocalDateTime this ^js/JSJoda.TemporalUnit unit] + (.truncatedTo this unit))) + +(defn minus-weeks + "Returns a copy of this {@code LocalDateTime} with the specified number of weeks subtracted. + + This method subtracts the specified amount in weeks from the days field decrementing + the month and year fields as necessary to ensure the result remains valid. + The result is only invalid if the maximum/minimum year is exceeded. + + For example, 2009-01-07 minus one week would result in 2008-12-31. + + This instance is immutable and unaffected by this method call. + + @param weeks the weeks to subtract, may be negative + @return a {@code LocalDateTime} based on this date-time with the weeks subtracted, not null + @throws DateTimeException if the result exceeds the supported date range" + {:arglists (quote (["java.time.LocalDateTime" "long"]))} + (^js/JSJoda.LocalDateTime [^js/JSJoda.LocalDateTime this ^long weeks] + (.minusWeeks this weeks))) + +(defn to-instant + "Converts this date-time to an {@code Instant}. + + This combines this local date-time and the specified offset to form + an {@code Instant}. + + This default implementation calculates from the epoch-day of the date and the + second-of-day of the time. + + @param offset the offset to use for the conversion, not null + @return an {@code Instant} representing the same instant, not null" + {:arglists (quote (["java.time.LocalDateTime" "java.time.ZoneOffset"]))} + (^js/JSJoda.Instant + [^js/JSJoda.LocalDateTime this ^js/JSJoda.ZoneOffset offset] + (.toInstant this offset))) + +(defn plus-weeks + "Returns a copy of this {@code LocalDateTime} with the specified number of weeks added. + + This method adds the specified amount in weeks to the days field incrementing + the month and year fields as necessary to ensure the result remains valid. + The result is only invalid if the maximum/minimum year is exceeded. + + For example, 2008-12-31 plus one week would result in 2009-01-07. + + This instance is immutable and unaffected by this method call. + + @param weeks the weeks to add, may be negative + @return a {@code LocalDateTime} based on this date-time with the weeks added, not null + @throws DateTimeException if the result exceeds the supported date range" + {:arglists (quote (["java.time.LocalDateTime" "long"]))} + (^js/JSJoda.LocalDateTime [^js/JSJoda.LocalDateTime this ^long weeks] + (.plusWeeks this weeks))) + +(defn range + "Gets the range of valid values for the specified field. + + The range object expresses the minimum and maximum valid values for a field. + This date-time is used to enhance the accuracy of the returned range. + If it is not possible to return the range, because the field is not supported + or for some other reason, an exception is thrown. + + If the field is a {@link ChronoField} then the query is implemented here. + The {@link #isSupported(TemporalField) supported fields} will return + appropriate range instances. + All other {@code ChronoField} instances will throw an {@code UnsupportedTemporalTypeException}. + + If the field is not a {@code ChronoField}, then the result of this method + is obtained by invoking {@code TemporalField.rangeRefinedBy(TemporalAccessor)} + passing {@code this} as the argument. + Whether the range can be obtained is determined by the field. + + @param field the field to query the range for, not null + @return the range of valid values for the field, not null + @throws DateTimeException if the range for the field cannot be obtained + @throws UnsupportedTemporalTypeException if the field is not supported" + {:arglists (quote (["java.time.LocalDateTime" + "java.time.temporal.TemporalField"]))} + (^js/JSJoda.ValueRange + [^js/JSJoda.LocalDateTime this ^js/JSJoda.TemporalField field] + (.range this field))) + +(defn of-epoch-second + "Obtains an instance of {@code LocalDateTime} using seconds from the + epoch of 1970-01-01T00:00:00Z. + + This allows the {@link ChronoField#INSTANT_SECONDS epoch-second} field + to be converted to a local date-time. This is primarily intended for + low-level conversions rather than general application usage. + + @param epochSecond the number of seconds from the epoch of 1970-01-01T00:00:00Z + @param nanoOfSecond the nanosecond within the second, from 0 to 999,999,999 + @param offset the zone offset, not null + @return the local date-time, not null + @throws DateTimeException if the result exceeds the supported range, + or if the nano-of-second is invalid" + {:arglists (quote (["long" "int" "java.time.ZoneOffset"]))} + (^js/JSJoda.LocalDateTime + [^long epoch-second ^int nano-of-second ^js/JSJoda.ZoneOffset offset] + (js-invoke java.time.LocalDateTime + "ofEpochSecond" + epoch-second + nano-of-second + offset))) + +(defn get-hour + "Gets the hour-of-day field. + + @return the hour-of-day, from 0 to 23" + {:arglists (quote (["java.time.LocalDateTime"]))} + (^int [^js/JSJoda.LocalDateTime this] (.hour this))) + +(defn at-offset + "Combines this date-time with an offset to create an {@code OffsetDateTime}. + + This returns an {@code OffsetDateTime} formed from this date-time at the specified offset. + All possible combinations of date-time and offset are valid. + + @param offset the offset to combine with, not null + @return the offset date-time formed from this date-time and the specified offset, not null" + {:arglists (quote (["java.time.LocalDateTime" "java.time.ZoneOffset"]))} + (^js/JSJoda.OffsetDateTime + [^js/JSJoda.LocalDateTime this ^js/JSJoda.ZoneOffset offset] + (.atOffset this offset))) + +(defn minus-hours + "Returns a copy of this {@code LocalDateTime} with the specified number of hours subtracted. + + This instance is immutable and unaffected by this method call. + + @param hours the hours to subtract, may be negative + @return a {@code LocalDateTime} based on this date-time with the hours subtracted, not null + @throws DateTimeException if the result exceeds the supported date range" + {:arglists (quote (["java.time.LocalDateTime" "long"]))} + (^js/JSJoda.LocalDateTime [^js/JSJoda.LocalDateTime this ^long hours] + (.minusHours this hours))) + +(defn of + {:arglists (quote (["java.time.LocalDate" "java.time.LocalTime"] + ["int" "int" "int" "int" "int"] + ["int" "java.time.Month" "int" "int" "int"] + ["int" "int" "int" "int" "int" "int"] + ["int" "java.time.Month" "int" "int" "int" "int"] + ["int" "int" "int" "int" "int" "int" "int"] + ["int" "java.time.Month" "int" "int" "int" "int" "int"]))} + (^js/JSJoda.LocalDateTime + [^js/JSJoda.LocalDate date ^js/JSJoda.LocalTime time] + (js-invoke java.time.LocalDateTime "of" date time)) + (^js/JSJoda.LocalDateTime [arg0 arg1 arg2 arg3 arg4] + (js-invoke java.time.LocalDateTime "of" arg0 arg1 arg2 arg3 arg4)) + (^js/JSJoda.LocalDateTime [arg0 arg1 arg2 arg3 arg4 arg5] + (js-invoke java.time.LocalDateTime "of" arg0 arg1 arg2 arg3 arg4 arg5)) + (^js/JSJoda.LocalDateTime [arg0 arg1 arg2 arg3 arg4 arg5 arg6] + (js-invoke java.time.LocalDateTime "of" arg0 arg1 arg2 arg3 arg4 arg5 arg6))) + +(defn with-month + "Returns a copy of this {@code LocalDateTime} with the month-of-year altered. + + The time does not affect the calculation and will be the same in the result. + If the day-of-month is invalid for the year, it will be changed to the last valid day of the month. + + This instance is immutable and unaffected by this method call. + + @param month the month-of-year to set in the result, from 1 (January) to 12 (December) + @return a {@code LocalDateTime} based on this date-time with the requested month, not null + @throws DateTimeException if the month-of-year value is invalid" + {:arglists (quote (["java.time.LocalDateTime" "int"]))} + (^js/JSJoda.LocalDateTime [^js/JSJoda.LocalDateTime this ^int month] + (.withMonth this month))) + +(defn is-equal + "Checks if this date-time is equal to the specified date-time. + + This checks to see if this date-time represents the same point on the + local time-line as the other date-time. +
+   LocalDate a = LocalDateTime.of(2012, 6, 30, 12, 00);
+   LocalDate b = LocalDateTime.of(2012, 7, 1, 12, 00);
+   a.isEqual(b) == false
+   a.isEqual(a) == true
+   b.isEqual(a) == false
+ 
+ + This method only considers the position of the two date-times on the local time-line. + It does not take into account the chronology, or calendar system. + This is different from the comparison in {@link #compareTo(ChronoLocalDateTime)}, + but is the same approach as {@link ChronoLocalDateTime#timeLineOrder()}. + + @param other the other date-time to compare to, not null + @return true if this date-time is equal to the specified date-time" + {:arglists (quote (["java.time.LocalDateTime" + "java.time.chrono.ChronoLocalDateTime"]))} + (^boolean [^js/JSJoda.LocalDateTime this ^js/JSJoda.ChronoLocalDateTime other] + (.isEqual this other))) + +(defn get-nano + "Gets the nano-of-second field. + + @return the nano-of-second, from 0 to 999,999,999" + {:arglists (quote (["java.time.LocalDateTime"]))} + (^int [^js/JSJoda.LocalDateTime this] (.nano this))) + +(defn get-year + "Gets the year field. + + This method returns the primitive {@code int} value for the year. + + The year returned by this method is proleptic as per {@code get(YEAR)}. + To obtain the year-of-era, use {@code get(YEAR_OF_ERA)}. + + @return the year, from MIN_YEAR to MAX_YEAR" + {:arglists (quote (["java.time.LocalDateTime"]))} + (^int [^js/JSJoda.LocalDateTime this] (.year this))) + +(defn minus-seconds + "Returns a copy of this {@code LocalDateTime} with the specified number of seconds subtracted. + + This instance is immutable and unaffected by this method call. + + @param seconds the seconds to subtract, may be negative + @return a {@code LocalDateTime} based on this date-time with the seconds subtracted, not null + @throws DateTimeException if the result exceeds the supported date range" + {:arglists (quote (["java.time.LocalDateTime" "long"]))} + (^js/JSJoda.LocalDateTime [^js/JSJoda.LocalDateTime this ^long seconds] + (.minusSeconds this seconds))) + +(defn get-second + "Gets the second-of-minute field. + + @return the second-of-minute, from 0 to 59" + {:arglists (quote (["java.time.LocalDateTime"]))} + (^int [^js/JSJoda.LocalDateTime this] (.second this))) + +(defn plus-nanos + "Returns a copy of this {@code LocalDateTime} with the specified number of nanoseconds added. + + This instance is immutable and unaffected by this method call. + + @param nanos the nanos to add, may be negative + @return a {@code LocalDateTime} based on this date-time with the nanoseconds added, not null + @throws DateTimeException if the result exceeds the supported date range" + {:arglists (quote (["java.time.LocalDateTime" "long"]))} + (^js/JSJoda.LocalDateTime [^js/JSJoda.LocalDateTime this ^long nanos] + (.plusNanos this nanos))) + +(defn get-day-of-year + "Gets the day-of-year field. + + This method returns the primitive {@code int} value for the day-of-year. + + @return the day-of-year, from 1 to 365, or 366 in a leap year" + {:arglists (quote (["java.time.LocalDateTime"]))} + (^int [^js/JSJoda.LocalDateTime this] (.dayOfYear this))) + +(defn plus + {:arglists (quote (["java.time.LocalDateTime" + "java.time.temporal.TemporalAmount"] + ["java.time.LocalDateTime" "long" + "java.time.temporal.TemporalUnit"]))} + (^js/JSJoda.LocalDateTime + [^js/JSJoda.LocalDateTime this ^js/JSJoda.TemporalAmount amount-to-add] + (.plus this amount-to-add)) + (^js/JSJoda.LocalDateTime + [^js/JSJoda.LocalDateTime this ^long amount-to-add + ^js/JSJoda.TemporalUnit unit] + (.plus this amount-to-add unit))) + +(defn with-hour + "Returns a copy of this {@code LocalDateTime} with the hour-of-day altered. + + This instance is immutable and unaffected by this method call. + + @param hour the hour-of-day to set in the result, from 0 to 23 + @return a {@code LocalDateTime} based on this date-time with the requested hour, not null + @throws DateTimeException if the hour value is invalid" + {:arglists (quote (["java.time.LocalDateTime" "int"]))} + (^js/JSJoda.LocalDateTime [^js/JSJoda.LocalDateTime this ^int hour] + (.withHour this hour))) + +(defn with-minute + "Returns a copy of this {@code LocalDateTime} with the minute-of-hour altered. + + This instance is immutable and unaffected by this method call. + + @param minute the minute-of-hour to set in the result, from 0 to 59 + @return a {@code LocalDateTime} based on this date-time with the requested minute, not null + @throws DateTimeException if the minute value is invalid" + {:arglists (quote (["java.time.LocalDateTime" "int"]))} + (^js/JSJoda.LocalDateTime [^js/JSJoda.LocalDateTime this ^int minute] + (.withMinute this minute))) + +(defn plus-minutes + "Returns a copy of this {@code LocalDateTime} with the specified number of minutes added. + + This instance is immutable and unaffected by this method call. + + @param minutes the minutes to add, may be negative + @return a {@code LocalDateTime} based on this date-time with the minutes added, not null + @throws DateTimeException if the result exceeds the supported date range" + {:arglists (quote (["java.time.LocalDateTime" "long"]))} + (^js/JSJoda.LocalDateTime [^js/JSJoda.LocalDateTime this ^long minutes] + (.plusMinutes this minutes))) + +(defn query + "Queries this date-time using the specified query. + + This queries this date-time using the specified query strategy object. + The {@code TemporalQuery} object defines the logic to be used to + obtain the result. Read the documentation of the query to understand + what the result of this method will be. + + The result of this method is obtained by invoking the + {@link TemporalQuery#queryFrom(TemporalAccessor)} method on the + specified query passing {@code this} as the argument. + + @param the type of the result + @param query the query to invoke, not null + @return the query result, null may be returned (defined by the query) + @throws DateTimeException if unable to query (defined by the query) + @throws ArithmeticException if numeric overflow occurs (defined by the query)" + {:arglists (quote (["java.time.LocalDateTime" + "java.time.temporal.TemporalQuery"]))} + (^java.lang.Object + [^js/JSJoda.LocalDateTime this ^js/JSJoda.TemporalQuery query] + (.query this query))) + +(defn get-day-of-week + "Gets the day-of-week field, which is an enum {@code DayOfWeek}. + + This method returns the enum {@link DayOfWeek} for the day-of-week. + This avoids confusion as to what {@code int} values mean. + If you need access to the primitive {@code int} value then the enum + provides the {@link DayOfWeek#getValue() int value}. + + Additional information can be obtained from the {@code DayOfWeek}. + This includes textual names of the values. + + @return the day-of-week, not null" + {:arglists (quote (["java.time.LocalDateTime"]))} + (^js/JSJoda.DayOfWeek [^js/JSJoda.LocalDateTime this] (.dayOfWeek this))) + +(defn to-string + "Outputs this date-time as a {@code String}, such as {@code 2007-12-03T10:15:30}. + + The output will be one of the following ISO-8601 formats: +
    +
  • {@code uuuu-MM-dd'T'HH:mm}
  • +
  • {@code uuuu-MM-dd'T'HH:mm:ss}
  • +
  • {@code uuuu-MM-dd'T'HH:mm:ss.SSS}
  • +
  • {@code uuuu-MM-dd'T'HH:mm:ss.SSSSSS}
  • +
  • {@code uuuu-MM-dd'T'HH:mm:ss.SSSSSSSSS}
  • +
+ The format used will be the shortest that outputs the full value of + the time where the omitted parts are implied to be zero. + + @return a string representation of this date-time, not null" + {:arglists (quote (["java.time.LocalDateTime"]))} + (^java.lang.String [^js/JSJoda.LocalDateTime this] (.toString this))) + +(defn plus-months + "Returns a copy of this {@code LocalDateTime} with the specified number of months added. + + This method adds the specified amount to the months field in three steps: +
    +
  1. Add the input months to the month-of-year field
  2. +
  3. Check if the resulting date would be invalid
  4. +
  5. Adjust the day-of-month to the last valid day if necessary
  6. +
+ + For example, 2007-03-31 plus one month would result in the invalid date + 2007-04-31. Instead of returning an invalid result, the last valid day + of the month, 2007-04-30, is selected instead. + + This instance is immutable and unaffected by this method call. + + @param months the months to add, may be negative + @return a {@code LocalDateTime} based on this date-time with the months added, not null + @throws DateTimeException if the result exceeds the supported date range" + {:arglists (quote (["java.time.LocalDateTime" "long"]))} + (^js/JSJoda.LocalDateTime [^js/JSJoda.LocalDateTime this ^long months] + (.plusMonths this months))) + +(defn is-before + "Checks if this date-time is before the specified date-time. + + This checks to see if this date-time represents a point on the + local time-line before the other date-time. +
+   LocalDate a = LocalDateTime.of(2012, 6, 30, 12, 00);
+   LocalDate b = LocalDateTime.of(2012, 7, 1, 12, 00);
+   a.isBefore(b) == true
+   a.isBefore(a) == false
+   b.isBefore(a) == false
+ 
+ + This method only considers the position of the two date-times on the local time-line. + It does not take into account the chronology, or calendar system. + This is different from the comparison in {@link #compareTo(ChronoLocalDateTime)}, + but is the same approach as {@link ChronoLocalDateTime#timeLineOrder()}. + + @param other the other date-time to compare to, not null + @return true if this date-time is before the specified date-time" + {:arglists (quote (["java.time.LocalDateTime" + "java.time.chrono.ChronoLocalDateTime"]))} + (^boolean [^js/JSJoda.LocalDateTime this ^js/JSJoda.ChronoLocalDateTime other] + (.isBefore this other))) + +(defn minus-months + "Returns a copy of this {@code LocalDateTime} with the specified number of months subtracted. + + This method subtracts the specified amount from the months field in three steps: +
    +
  1. Subtract the input months from the month-of-year field
  2. +
  3. Check if the resulting date would be invalid
  4. +
  5. Adjust the day-of-month to the last valid day if necessary
  6. +
+ + For example, 2007-03-31 minus one month would result in the invalid date + 2007-04-31. Instead of returning an invalid result, the last valid day + of the month, 2007-04-30, is selected instead. + + This instance is immutable and unaffected by this method call. + + @param months the months to subtract, may be negative + @return a {@code LocalDateTime} based on this date-time with the months subtracted, not null + @throws DateTimeException if the result exceeds the supported date range" + {:arglists (quote (["java.time.LocalDateTime" "long"]))} + (^js/JSJoda.LocalDateTime [^js/JSJoda.LocalDateTime this ^long months] + (.minusMonths this months))) + +(defn minus + {:arglists (quote (["java.time.LocalDateTime" + "java.time.temporal.TemporalAmount"] + ["java.time.LocalDateTime" "long" + "java.time.temporal.TemporalUnit"]))} + (^js/JSJoda.LocalDateTime + [^js/JSJoda.LocalDateTime this ^js/JSJoda.TemporalAmount amount-to-subtract] + (.minus this amount-to-subtract)) + (^js/JSJoda.LocalDateTime + [^js/JSJoda.LocalDateTime this ^long amount-to-subtract + ^js/JSJoda.TemporalUnit unit] + (.minus this amount-to-subtract unit))) + +(defn at-zone + "Combines this date-time with a time-zone to create a {@code ZonedDateTime}. + + This returns a {@code ZonedDateTime} formed from this date-time at the + specified time-zone. The result will match this date-time as closely as possible. + Time-zone rules, such as daylight savings, mean that not every local date-time + is valid for the specified zone, thus the local date-time may be adjusted. + + The local date-time is resolved to a single instant on the time-line. + This is achieved by finding a valid offset from UTC/Greenwich for the local + date-time as defined by the {@link ZoneRules rules} of the zone ID. + + In most cases, there is only one valid offset for a local date-time. + In the case of an overlap, where clocks are set back, there are two valid offsets. + This method uses the earlier offset typically corresponding to \"summer\". + + In the case of a gap, where clocks jump forward, there is no valid offset. + Instead, the local date-time is adjusted to be later by the length of the gap. + For a typical one hour daylight savings change, the local date-time will be + moved one hour later into the offset typically corresponding to \"summer\". + + To obtain the later offset during an overlap, call + {@link ZonedDateTime#withLaterOffsetAtOverlap()} on the result of this method. + To throw an exception when there is a gap or overlap, use + {@link ZonedDateTime#ofStrict(LocalDateTime, ZoneOffset, ZoneId)}. + + @param zone the time-zone to use, not null + @return the zoned date-time formed from this date-time, not null" + {:arglists (quote (["java.time.LocalDateTime" "java.time.ZoneId"]))} + (^js/JSJoda.ZonedDateTime + [^js/JSJoda.LocalDateTime this ^js/JSJoda.ZoneId zone] + (.atZone this zone))) + +(defn plus-hours + "Returns a copy of this {@code LocalDateTime} with the specified number of hours added. + + This instance is immutable and unaffected by this method call. + + @param hours the hours to add, may be negative + @return a {@code LocalDateTime} based on this date-time with the hours added, not null + @throws DateTimeException if the result exceeds the supported date range" + {:arglists (quote (["java.time.LocalDateTime" "long"]))} + (^js/JSJoda.LocalDateTime [^js/JSJoda.LocalDateTime this ^long hours] + (.plusHours this hours))) + +(defn plus-days + "Returns a copy of this {@code LocalDateTime} with the specified number of days added. + + This method adds the specified amount to the days field incrementing the + month and year fields as necessary to ensure the result remains valid. + The result is only invalid if the maximum/minimum year is exceeded. + + For example, 2008-12-31 plus one day would result in 2009-01-01. + + This instance is immutable and unaffected by this method call. + + @param days the days to add, may be negative + @return a {@code LocalDateTime} based on this date-time with the days added, not null + @throws DateTimeException if the result exceeds the supported date range" + {:arglists (quote (["java.time.LocalDateTime" "long"]))} + (^js/JSJoda.LocalDateTime [^js/JSJoda.LocalDateTime this ^long days] + (.plusDays this days))) + +(defn to-local-time + "Gets the {@code LocalTime} part of this date-time. + + This returns a {@code LocalTime} with the same hour, minute, second and + nanosecond as this date-time. + + @return the time part of this date-time, not null" + {:arglists (quote (["java.time.LocalDateTime"]))} + (^js/JSJoda.LocalTime [^js/JSJoda.LocalDateTime this] (.toLocalTime this))) + +(defn get-long + "Gets the value of the specified field from this date-time as a {@code long}. + + This queries this date-time for the value of the specified field. + If it is not possible to return the value, because the field is not supported + or for some other reason, an exception is thrown. + + If the field is a {@link ChronoField} then the query is implemented here. + The {@link #isSupported(TemporalField) supported fields} will return valid + values based on this date-time. + All other {@code ChronoField} instances will throw an {@code UnsupportedTemporalTypeException}. + + If the field is not a {@code ChronoField}, then the result of this method + is obtained by invoking {@code TemporalField.getFrom(TemporalAccessor)} + passing {@code this} as the argument. Whether the value can be obtained, + and what the value represents, is determined by the field. + + @param field the field to get, not null + @return the value for the field + @throws DateTimeException if a value for the field cannot be obtained + @throws UnsupportedTemporalTypeException if the field is not supported + @throws ArithmeticException if numeric overflow occurs" + {:arglists (quote (["java.time.LocalDateTime" + "java.time.temporal.TemporalField"]))} + (^long [^js/JSJoda.LocalDateTime this ^js/JSJoda.TemporalField field] + (.getLong this field))) + +(defn with-year + "Returns a copy of this {@code LocalDateTime} with the year altered. + + The time does not affect the calculation and will be the same in the result. + If the day-of-month is invalid for the year, it will be changed to the last valid day of the month. + + This instance is immutable and unaffected by this method call. + + @param year the year to set in the result, from MIN_YEAR to MAX_YEAR + @return a {@code LocalDateTime} based on this date-time with the requested year, not null + @throws DateTimeException if the year value is invalid" + {:arglists (quote (["java.time.LocalDateTime" "int"]))} + (^js/JSJoda.LocalDateTime [^js/JSJoda.LocalDateTime this ^int year] + (.withYear this year))) + +(defn with-nano + "Returns a copy of this {@code LocalDateTime} with the nano-of-second altered. + + This instance is immutable and unaffected by this method call. + + @param nanoOfSecond the nano-of-second to set in the result, from 0 to 999,999,999 + @return a {@code LocalDateTime} based on this date-time with the requested nanosecond, not null + @throws DateTimeException if the nano value is invalid" + {:arglists (quote (["java.time.LocalDateTime" "int"]))} + (^js/JSJoda.LocalDateTime [^js/JSJoda.LocalDateTime this ^int nano-of-second] + (.withNano this nano-of-second))) + +(defn to-epoch-second + "Converts this date-time to the number of seconds from the epoch + of 1970-01-01T00:00:00Z. + + This combines this local date-time and the specified offset to calculate the + epoch-second value, which is the number of elapsed seconds from 1970-01-01T00:00:00Z. + Instants on the time-line after the epoch are positive, earlier are negative. + + This default implementation calculates from the epoch-day of the date and the + second-of-day of the time. + + @param offset the offset to use for the conversion, not null + @return the number of seconds from the epoch of 1970-01-01T00:00:00Z" + {:arglists (quote (["java.time.LocalDateTime" "java.time.ZoneOffset"]))} + (^long [^js/JSJoda.LocalDateTime this ^js/JSJoda.ZoneOffset offset] + (.toEpochSecond this offset))) + +(defn until + "Calculates the amount of time until another date-time in terms of the specified unit. + + This calculates the amount of time between two {@code LocalDateTime} + objects in terms of a single {@code TemporalUnit}. + The start and end points are {@code this} and the specified date-time. + The result will be negative if the end is before the start. + The {@code Temporal} passed to this method is converted to a + {@code LocalDateTime} using {@link #from(TemporalAccessor)}. + For example, the amount in days between two date-times can be calculated + using {@code startDateTime.until(endDateTime, DAYS)}. + + The calculation returns a whole number, representing the number of + complete units between the two date-times. + For example, the amount in months between 2012-06-15T00:00 and 2012-08-14T23:59 + will only be one month as it is one minute short of two months. + + There are two equivalent ways of using this method. + The first is to invoke this method. + The second is to use {@link TemporalUnit#between(Temporal, Temporal)}: +
+   // these two lines are equivalent
+   amount = start.until(end, MONTHS);
+   amount = MONTHS.between(start, end);
+ 
+ The choice should be made based on which makes the code more readable. + + The calculation is implemented in this method for {@link ChronoUnit}. + The units {@code NANOS}, {@code MICROS}, {@code MILLIS}, {@code SECONDS}, + {@code MINUTES}, {@code HOURS} and {@code HALF_DAYS}, {@code DAYS}, + {@code WEEKS}, {@code MONTHS}, {@code YEARS}, {@code DECADES}, + {@code CENTURIES}, {@code MILLENNIA} and {@code ERAS} are supported. + Other {@code ChronoUnit} values will throw an exception. + + If the unit is not a {@code ChronoUnit}, then the result of this method + is obtained by invoking {@code TemporalUnit.between(Temporal, Temporal)} + passing {@code this} as the first argument and the converted input temporal + as the second argument. + + This instance is immutable and unaffected by this method call. + + @param endExclusive the end date, exclusive, which is converted to a {@code LocalDateTime}, not null + @param unit the unit to measure the amount in, not null + @return the amount of time between this date-time and the end date-time + @throws DateTimeException if the amount cannot be calculated, or the end + temporal cannot be converted to a {@code LocalDateTime} + @throws UnsupportedTemporalTypeException if the unit is not supported + @throws ArithmeticException if numeric overflow occurs" + {:arglists (quote (["java.time.LocalDateTime" "java.time.temporal.Temporal" + "java.time.temporal.TemporalUnit"]))} + (^long + [^js/JSJoda.LocalDateTime this ^js/JSJoda.Temporal end-exclusive + ^js/JSJoda.TemporalUnit unit] + (.until this end-exclusive unit))) + +(defn with-day-of-month + "Returns a copy of this {@code LocalDateTime} with the day-of-month altered. + + If the resulting date-time is invalid, an exception is thrown. + The time does not affect the calculation and will be the same in the result. + + This instance is immutable and unaffected by this method call. + + @param dayOfMonth the day-of-month to set in the result, from 1 to 28-31 + @return a {@code LocalDateTime} based on this date-time with the requested day, not null + @throws DateTimeException if the day-of-month value is invalid, + or if the day-of-month is invalid for the month-year" + {:arglists (quote (["java.time.LocalDateTime" "int"]))} + (^js/JSJoda.LocalDateTime [^js/JSJoda.LocalDateTime this ^int day-of-month] + (.withDayOfMonth this day-of-month))) + +(defn get-day-of-month + "Gets the day-of-month field. + + This method returns the primitive {@code int} value for the day-of-month. + + @return the day-of-month, from 1 to 31" + {:arglists (quote (["java.time.LocalDateTime"]))} + (^int [^js/JSJoda.LocalDateTime this] (.dayOfMonth this))) + +(defn from + "Obtains an instance of {@code LocalDateTime} from a temporal object. + + This obtains a local date-time based on the specified temporal. + A {@code TemporalAccessor} represents an arbitrary set of date and time information, + which this factory converts to an instance of {@code LocalDateTime}. + + The conversion extracts and combines the {@code LocalDate} and the + {@code LocalTime} from the temporal object. + Implementations are permitted to perform optimizations such as accessing + those fields that are equivalent to the relevant objects. + + This method matches the signature of the functional interface {@link TemporalQuery} + allowing it to be used as a query via method reference, {@code LocalDateTime::from}. + + @param temporal the temporal object to convert, not null + @return the local date-time, not null + @throws DateTimeException if unable to convert to a {@code LocalDateTime}" + {:arglists (quote (["java.time.temporal.TemporalAccessor"]))} + (^js/JSJoda.LocalDateTime [^js/JSJoda.TemporalAccessor temporal] + (js-invoke java.time.LocalDateTime "from" temporal))) + +(defn is-after + "Checks if this date-time is after the specified date-time. + + This checks to see if this date-time represents a point on the + local time-line after the other date-time. +
+   LocalDate a = LocalDateTime.of(2012, 6, 30, 12, 00);
+   LocalDate b = LocalDateTime.of(2012, 7, 1, 12, 00);
+   a.isAfter(b) == false
+   a.isAfter(a) == false
+   b.isAfter(a) == true
+ 
+ + This method only considers the position of the two date-times on the local time-line. + It does not take into account the chronology, or calendar system. + This is different from the comparison in {@link #compareTo(ChronoLocalDateTime)}, + but is the same approach as {@link ChronoLocalDateTime#timeLineOrder()}. + + @param other the other date-time to compare to, not null + @return true if this date-time is after the specified date-time" + {:arglists (quote (["java.time.LocalDateTime" + "java.time.chrono.ChronoLocalDateTime"]))} + (^boolean [^js/JSJoda.LocalDateTime this ^js/JSJoda.ChronoLocalDateTime other] + (.isAfter this other))) + +(defn minus-nanos + "Returns a copy of this {@code LocalDateTime} with the specified number of nanoseconds subtracted. + + This instance is immutable and unaffected by this method call. + + @param nanos the nanos to subtract, may be negative + @return a {@code LocalDateTime} based on this date-time with the nanoseconds subtracted, not null + @throws DateTimeException if the result exceeds the supported date range" + {:arglists (quote (["java.time.LocalDateTime" "long"]))} + (^js/JSJoda.LocalDateTime [^js/JSJoda.LocalDateTime this ^long nanos] + (.minusNanos this nanos))) + +(defn is-supported + {:arglists (quote + (["java.time.LocalDateTime" "java.time.temporal.TemporalField"] + ["java.time.LocalDateTime" "java.time.temporal.TemporalUnit"]))} + (^boolean [^js/JSJoda.LocalDateTime this arg0] + (.isSupported ^js/JSJoda.LocalDateTime this arg0))) + +(defn minus-years + "Returns a copy of this {@code LocalDateTime} with the specified number of years subtracted. + + This method subtracts the specified amount from the years field in three steps: +
    +
  1. Subtract the input years from the year field
  2. +
  3. Check if the resulting date would be invalid
  4. +
  5. Adjust the day-of-month to the last valid day if necessary
  6. +
+ + For example, 2008-02-29 (leap year) minus one year would result in the + invalid date 2009-02-29 (standard year). Instead of returning an invalid + result, the last valid day of the month, 2009-02-28, is selected instead. + + This instance is immutable and unaffected by this method call. + + @param years the years to subtract, may be negative + @return a {@code LocalDateTime} based on this date-time with the years subtracted, not null + @throws DateTimeException if the result exceeds the supported date range" + {:arglists (quote (["java.time.LocalDateTime" "long"]))} + (^js/JSJoda.LocalDateTime [^js/JSJoda.LocalDateTime this ^long years] + (.minusYears this years))) + +(defn get-chronology + "Gets the chronology of this date-time. + + The {@code Chronology} represents the calendar system in use. + The era and other fields in {@link ChronoField} are defined by the chronology. + + @return the chronology, not null" + {:arglists (quote (["java.time.LocalDateTime"]))} + (^js/JSJoda.Chronology [^js/JSJoda.LocalDateTime this] (.chronology this))) + +(defn parse + {:arglists (quote (["java.lang.CharSequence"] + ["java.lang.CharSequence" + "java.time.format.DateTimeFormatter"]))} + (^js/JSJoda.LocalDateTime [^java.lang.CharSequence text] + (js-invoke java.time.LocalDateTime "parse" text)) + (^js/JSJoda.LocalDateTime + [^java.lang.CharSequence text ^js/JSJoda.DateTimeFormatter formatter] + (js-invoke java.time.LocalDateTime "parse" text formatter))) + +(defn with-second + "Returns a copy of this {@code LocalDateTime} with the second-of-minute altered. + + This instance is immutable and unaffected by this method call. + + @param second the second-of-minute to set in the result, from 0 to 59 + @return a {@code LocalDateTime} based on this date-time with the requested second, not null + @throws DateTimeException if the second value is invalid" + {:arglists (quote (["java.time.LocalDateTime" "int"]))} + (^js/JSJoda.LocalDateTime [^js/JSJoda.LocalDateTime this ^int second] + (.withSecond this second))) + +(defn to-local-date + "Gets the {@code LocalDate} part of this date-time. + + This returns a {@code LocalDate} with the same year, month and day + as this date-time. + + @return the date part of this date-time, not null" + {:arglists (quote (["java.time.LocalDateTime"]))} + (^js/JSJoda.LocalDate [^js/JSJoda.LocalDateTime this] (.toLocalDate this))) + +(defn get-minute + "Gets the minute-of-hour field. + + @return the minute-of-hour, from 0 to 59" + {:arglists (quote (["java.time.LocalDateTime"]))} + (^int [^js/JSJoda.LocalDateTime this] (.minute this))) + +(defn hash-code + "A hash code for this date-time. + + @return a suitable hash code" + {:arglists (quote (["java.time.LocalDateTime"]))} + (^int [^js/JSJoda.LocalDateTime this] (.hashCode this))) + +(defn adjust-into + "Adjusts the specified temporal object to have the same date and time as this object. + + This returns a temporal object of the same observable type as the input + with the date and time changed to be the same as this. + + The adjustment is equivalent to using {@link Temporal#with(TemporalField, long)} + twice, passing {@link ChronoField#EPOCH_DAY} and + {@link ChronoField#NANO_OF_DAY} as the fields. + + In most cases, it is clearer to reverse the calling pattern by using + {@link Temporal#with(TemporalAdjuster)}: +
+   // these two lines are equivalent, but the second approach is recommended
+   temporal = thisLocalDateTime.adjustInto(temporal);
+   temporal = temporal.with(thisLocalDateTime);
+ 
+ + This instance is immutable and unaffected by this method call. + + @param temporal the target object to be adjusted, not null + @return the adjusted object, not null + @throws DateTimeException if unable to make the adjustment + @throws ArithmeticException if numeric overflow occurs" + {:arglists (quote (["java.time.LocalDateTime" + "java.time.temporal.Temporal"]))} + (^js/JSJoda.Temporal + [^js/JSJoda.LocalDateTime this ^js/JSJoda.Temporal temporal] + (.adjustInto this temporal))) + +(defn with + {:arglists (quote (["java.time.LocalDateTime" + "java.time.temporal.TemporalAdjuster"] + ["java.time.LocalDateTime" + "java.time.temporal.TemporalField" "long"]))} + (^js/JSJoda.LocalDateTime + [^js/JSJoda.LocalDateTime this ^js/JSJoda.TemporalAdjuster adjuster] + (.with this adjuster)) + (^js/JSJoda.LocalDateTime + [^js/JSJoda.LocalDateTime this ^js/JSJoda.TemporalField field + ^long new-value] + (.with this field new-value))) + +(defn now + {:arglists (quote ([] ["java.time.Clock"] ["java.time.ZoneId"]))} + (^js/JSJoda.LocalDateTime [] (js-invoke java.time.LocalDateTime "now")) + (^js/JSJoda.LocalDateTime [arg0] + (js-invoke java.time.LocalDateTime "now" arg0))) + +(defn get-month-value + "Gets the month-of-year field from 1 to 12. + + This method returns the month as an {@code int} from 1 to 12. + Application code is frequently clearer if the enum {@link Month} + is used by calling {@link #getMonth()}. + + @return the month-of-year, from 1 to 12 + @see #getMonth()" + {:arglists (quote (["java.time.LocalDateTime"]))} + (^int [^js/JSJoda.LocalDateTime this] (.monthValue this))) + +(defn with-day-of-year + "Returns a copy of this {@code LocalDateTime} with the day-of-year altered. + + If the resulting date-time is invalid, an exception is thrown. + + This instance is immutable and unaffected by this method call. + + @param dayOfYear the day-of-year to set in the result, from 1 to 365-366 + @return a {@code LocalDateTime} based on this date with the requested day, not null + @throws DateTimeException if the day-of-year value is invalid, + or if the day-of-year is invalid for the year" + {:arglists (quote (["java.time.LocalDateTime" "int"]))} + (^js/JSJoda.LocalDateTime [^js/JSJoda.LocalDateTime this ^int day-of-year] + (.withDayOfYear this day-of-year))) + +(defn compare-to + "Compares this date-time to another date-time. + + The comparison is primarily based on the date-time, from earliest to latest. + It is \"consistent with equals\", as defined by {@link Comparable}. + + If all the date-times being compared are instances of {@code LocalDateTime}, + then the comparison will be entirely based on the date-time. + If some dates being compared are in different chronologies, then the + chronology is also considered, see {@link ChronoLocalDateTime#compareTo}. + + @param other the other date-time to compare to, not null + @return the comparator value, negative if less, positive if greater" + {:arglists (quote (["java.time.LocalDateTime" + "java.time.chrono.ChronoLocalDateTime"]))} + (^int [^js/JSJoda.LocalDateTime this ^js/JSJoda.ChronoLocalDateTime other] + (.compareTo this other))) + +(defn get-month + "Gets the month-of-year field using the {@code Month} enum. + + This method returns the enum {@link Month} for the month. + This avoids confusion as to what {@code int} values mean. + If you need access to the primitive {@code int} value then the enum + provides the {@link Month#getValue() int value}. + + @return the month-of-year, not null + @see #getMonthValue()" + {:arglists (quote (["java.time.LocalDateTime"]))} + (^js/JSJoda.Month [^js/JSJoda.LocalDateTime this] (.month this))) + +(defn of-instant + "Obtains an instance of {@code LocalDateTime} from an {@code Instant} and zone ID. + + This creates a local date-time based on the specified instant. + First, the offset from UTC/Greenwich is obtained using the zone ID and instant, + which is simple as there is only one valid offset for each instant. + Then, the instant and offset are used to calculate the local date-time. + + @param instant the instant to create the date-time from, not null + @param zone the time-zone, which may be an offset, not null + @return the local date-time, not null + @throws DateTimeException if the result exceeds the supported range" + {:arglists (quote (["java.time.Instant" "java.time.ZoneId"]))} + (^js/JSJoda.LocalDateTime [^js/JSJoda.Instant instant ^js/JSJoda.ZoneId zone] + (js-invoke java.time.LocalDateTime "ofInstant" instant zone))) + +(defn plus-seconds + "Returns a copy of this {@code LocalDateTime} with the specified number of seconds added. + + This instance is immutable and unaffected by this method call. + + @param seconds the seconds to add, may be negative + @return a {@code LocalDateTime} based on this date-time with the seconds added, not null + @throws DateTimeException if the result exceeds the supported date range" + {:arglists (quote (["java.time.LocalDateTime" "long"]))} + (^js/JSJoda.LocalDateTime [^js/JSJoda.LocalDateTime this ^long seconds] + (.plusSeconds this seconds))) + +(defn get + "Gets the value of the specified field from this date-time as an {@code int}. + + This queries this date-time for the value of the specified field. + The returned value will always be within the valid range of values for the field. + If it is not possible to return the value, because the field is not supported + or for some other reason, an exception is thrown. + + If the field is a {@link ChronoField} then the query is implemented here. + The {@link #isSupported(TemporalField) supported fields} will return valid + values based on this date-time, except {@code NANO_OF_DAY}, {@code MICRO_OF_DAY}, + {@code EPOCH_DAY} and {@code PROLEPTIC_MONTH} which are too large to fit in + an {@code int} and throw a {@code DateTimeException}. + All other {@code ChronoField} instances will throw an {@code UnsupportedTemporalTypeException}. + + If the field is not a {@code ChronoField}, then the result of this method + is obtained by invoking {@code TemporalField.getFrom(TemporalAccessor)} + passing {@code this} as the argument. Whether the value can be obtained, + and what the value represents, is determined by the field. + + @param field the field to get, not null + @return the value for the field + @throws DateTimeException if a value for the field cannot be obtained or + the value is outside the range of valid values for the field + @throws UnsupportedTemporalTypeException if the field is not supported or + the range of values exceeds an {@code int} + @throws ArithmeticException if numeric overflow occurs" + {:arglists (quote (["java.time.LocalDateTime" + "java.time.temporal.TemporalField"]))} + (^int [^js/JSJoda.LocalDateTime this ^js/JSJoda.TemporalField field] + (.get this field))) + +(defn equals + "Checks if this date-time is equal to another date-time. + + Compares this {@code LocalDateTime} with another ensuring that the date-time is the same. + Only objects of type {@code LocalDateTime} are compared, other types return false. + + @param obj the object to check, null returns false + @return true if this is equal to the other date-time" + {:arglists (quote (["java.time.LocalDateTime" "java.lang.Object"]))} + (^boolean [^js/JSJoda.LocalDateTime this ^java.lang.Object obj] + (.equals this obj))) + +(defn format + "Formats this date-time using the specified formatter. + + This date-time will be passed to the formatter to produce a string. + + @param formatter the formatter to use, not null + @return the formatted date-time string, not null + @throws DateTimeException if an error occurs during printing" + {:arglists (quote (["java.time.LocalDateTime" + "java.time.format.DateTimeFormatter"]))} + (^java.lang.String + [^js/JSJoda.LocalDateTime this ^js/JSJoda.DateTimeFormatter formatter] + (.format this formatter))) + +(defn plus-years + "Returns a copy of this {@code LocalDateTime} with the specified number of years added. + + This method adds the specified amount to the years field in three steps: +
    +
  1. Add the input years to the year field
  2. +
  3. Check if the resulting date would be invalid
  4. +
  5. Adjust the day-of-month to the last valid day if necessary
  6. +
+ + For example, 2008-02-29 (leap year) plus one year would result in the + invalid date 2009-02-29 (standard year). Instead of returning an invalid + result, the last valid day of the month, 2009-02-28, is selected instead. + + This instance is immutable and unaffected by this method call. + + @param years the years to add, may be negative + @return a {@code LocalDateTime} based on this date-time with the years added, not null + @throws DateTimeException if the result exceeds the supported date range" + {:arglists (quote (["java.time.LocalDateTime" "long"]))} + (^js/JSJoda.LocalDateTime [^js/JSJoda.LocalDateTime this ^long years] + (.plusYears this years))) + +(defn minus-days + "Returns a copy of this {@code LocalDateTime} with the specified number of days subtracted. + + This method subtracts the specified amount from the days field decrementing the + month and year fields as necessary to ensure the result remains valid. + The result is only invalid if the maximum/minimum year is exceeded. + + For example, 2009-01-01 minus one day would result in 2008-12-31. + + This instance is immutable and unaffected by this method call. + + @param days the days to subtract, may be negative + @return a {@code LocalDateTime} based on this date-time with the days subtracted, not null + @throws DateTimeException if the result exceeds the supported date range" + {:arglists (quote (["java.time.LocalDateTime" "long"]))} + (^js/JSJoda.LocalDateTime [^js/JSJoda.LocalDateTime this ^long days] + (.minusDays this days))) diff --git a/src/cljc/java_time/local_time.clj b/src/cljc/java_time/local_time.clj index 9ebb78f..051d1ef 100644 --- a/src/cljc/java_time/local_time.clj +++ b/src/cljc/java_time/local_time.clj @@ -1,49 +1,692 @@ -(ns cljc.java-time.local-time (:refer-clojure :exclude [abs get range format min max next name resolve short]) (:require [cljc.java-time.extn.calendar-awareness]) (:import [java.time LocalTime])) -(def max java.time.LocalTime/MAX) -(def noon java.time.LocalTime/NOON) -(def midnight java.time.LocalTime/MIDNIGHT) -(def min java.time.LocalTime/MIN) -(clojure.core/defn minus-minutes {:arglists (quote (["java.time.LocalTime" "long"]))} (^java.time.LocalTime [^java.time.LocalTime this14572 ^long long14573] (.minusMinutes this14572 long14573))) -(clojure.core/defn truncated-to {:arglists (quote (["java.time.LocalTime" "java.time.temporal.TemporalUnit"]))} (^java.time.LocalTime [^java.time.LocalTime this14574 ^java.time.temporal.ChronoUnit java-time-temporal-TemporalUnit14575] (.truncatedTo this14574 java-time-temporal-TemporalUnit14575))) -(clojure.core/defn range {:arglists (quote (["java.time.LocalTime" "java.time.temporal.TemporalField"]))} (^java.time.temporal.ValueRange [^java.time.LocalTime this14576 ^java.time.temporal.TemporalField java-time-temporal-TemporalField14577] (.range this14576 java-time-temporal-TemporalField14577))) -(clojure.core/defn get-hour {:arglists (quote (["java.time.LocalTime"]))} (^java.lang.Integer [^java.time.LocalTime this14578] (.getHour this14578))) -(clojure.core/defn at-offset {:arglists (quote (["java.time.LocalTime" "java.time.ZoneOffset"]))} (^java.time.OffsetTime [^java.time.LocalTime this14579 ^java.time.ZoneOffset java-time-ZoneOffset14580] (.atOffset this14579 java-time-ZoneOffset14580))) -(clojure.core/defn minus-hours {:arglists (quote (["java.time.LocalTime" "long"]))} (^java.time.LocalTime [^java.time.LocalTime this14581 ^long long14582] (.minusHours this14581 long14582))) -(clojure.core/defn of {:arglists (quote (["int" "int" "int"] ["int" "int"] ["int" "int" "int" "int"]))} (^java.time.LocalTime [^java.lang.Integer int14583 ^java.lang.Integer int14584 ^java.lang.Integer int14585] (java.time.LocalTime/of int14583 int14584 int14585)) (^java.time.LocalTime [^java.lang.Integer int14586 ^java.lang.Integer int14587] (java.time.LocalTime/of int14586 int14587)) (^java.time.LocalTime [^java.lang.Integer int14588 ^java.lang.Integer int14589 ^java.lang.Integer int14590 ^java.lang.Integer int14591] (java.time.LocalTime/of int14588 int14589 int14590 int14591))) -(clojure.core/defn get-nano {:arglists (quote (["java.time.LocalTime"]))} (^java.lang.Integer [^java.time.LocalTime this14592] (.getNano this14592))) -(clojure.core/defn minus-seconds {:arglists (quote (["java.time.LocalTime" "long"]))} (^java.time.LocalTime [^java.time.LocalTime this14593 ^long long14594] (.minusSeconds this14593 long14594))) -(clojure.core/defn get-second {:arglists (quote (["java.time.LocalTime"]))} (^java.lang.Integer [^java.time.LocalTime this14595] (.getSecond this14595))) -(clojure.core/defn plus-nanos {:arglists (quote (["java.time.LocalTime" "long"]))} (^java.time.LocalTime [^java.time.LocalTime this14596 ^long long14597] (.plusNanos this14596 long14597))) -(clojure.core/defn plus {:arglists (quote (["java.time.LocalTime" "java.time.temporal.TemporalAmount"] ["java.time.LocalTime" "long" "java.time.temporal.TemporalUnit"]))} (^java.time.LocalTime [^java.time.LocalTime this14598 ^java.time.temporal.TemporalAmount java-time-temporal-TemporalAmount14599] (.plus this14598 java-time-temporal-TemporalAmount14599)) (^java.time.LocalTime [^java.time.LocalTime this14600 ^long long14601 ^java.time.temporal.ChronoUnit java-time-temporal-TemporalUnit14602] (.plus this14600 long14601 java-time-temporal-TemporalUnit14602))) -(clojure.core/defn with-hour {:arglists (quote (["java.time.LocalTime" "int"]))} (^java.time.LocalTime [^java.time.LocalTime this14603 ^java.lang.Integer int14604] (.withHour this14603 int14604))) -(clojure.core/defn with-minute {:arglists (quote (["java.time.LocalTime" "int"]))} (^java.time.LocalTime [^java.time.LocalTime this14605 ^java.lang.Integer int14606] (.withMinute this14605 int14606))) -(clojure.core/defn plus-minutes {:arglists (quote (["java.time.LocalTime" "long"]))} (^java.time.LocalTime [^java.time.LocalTime this14607 ^long long14608] (.plusMinutes this14607 long14608))) -(clojure.core/defn query {:arglists (quote (["java.time.LocalTime" "java.time.temporal.TemporalQuery"]))} (^java.lang.Object [^java.time.LocalTime this14609 ^java.time.temporal.TemporalQuery java-time-temporal-TemporalQuery14610] (.query this14609 java-time-temporal-TemporalQuery14610))) -(clojure.core/defn at-date {:arglists (quote (["java.time.LocalTime" "java.time.LocalDate"]))} (^java.time.LocalDateTime [^java.time.LocalTime this14611 ^java.time.LocalDate java-time-LocalDate14612] (.atDate this14611 java-time-LocalDate14612))) -(clojure.core/defn to-string {:arglists (quote (["java.time.LocalTime"]))} (^java.lang.String [^java.time.LocalTime this14613] (.toString this14613))) -(clojure.core/defn is-before {:arglists (quote (["java.time.LocalTime" "java.time.LocalTime"]))} (^java.lang.Boolean [^java.time.LocalTime this14614 ^java.time.LocalTime java-time-LocalTime14615] (.isBefore this14614 java-time-LocalTime14615))) -(clojure.core/defn minus {:arglists (quote (["java.time.LocalTime" "long" "java.time.temporal.TemporalUnit"] ["java.time.LocalTime" "java.time.temporal.TemporalAmount"]))} (^java.time.LocalTime [^java.time.LocalTime this14616 ^long long14617 ^java.time.temporal.ChronoUnit java-time-temporal-TemporalUnit14618] (.minus this14616 long14617 java-time-temporal-TemporalUnit14618)) (^java.time.LocalTime [^java.time.LocalTime this14619 ^java.time.temporal.TemporalAmount java-time-temporal-TemporalAmount14620] (.minus this14619 java-time-temporal-TemporalAmount14620))) -(clojure.core/defn plus-hours {:arglists (quote (["java.time.LocalTime" "long"]))} (^java.time.LocalTime [^java.time.LocalTime this14621 ^long long14622] (.plusHours this14621 long14622))) -(clojure.core/defn to-second-of-day {:arglists (quote (["java.time.LocalTime"]))} (^java.lang.Integer [^java.time.LocalTime this14623] (.toSecondOfDay this14623))) -(clojure.core/defn get-long {:arglists (quote (["java.time.LocalTime" "java.time.temporal.TemporalField"]))} (^long [^java.time.LocalTime this14624 ^java.time.temporal.TemporalField java-time-temporal-TemporalField14625] (.getLong this14624 java-time-temporal-TemporalField14625))) -(clojure.core/defn with-nano {:arglists (quote (["java.time.LocalTime" "int"]))} (^java.time.LocalTime [^java.time.LocalTime this14626 ^java.lang.Integer int14627] (.withNano this14626 int14627))) -(clojure.core/defn until {:arglists (quote (["java.time.LocalTime" "java.time.temporal.Temporal" "java.time.temporal.TemporalUnit"]))} (^long [^java.time.LocalTime this14628 ^java.time.temporal.Temporal java-time-temporal-Temporal14629 ^java.time.temporal.ChronoUnit java-time-temporal-TemporalUnit14630] (.until this14628 java-time-temporal-Temporal14629 java-time-temporal-TemporalUnit14630))) -(clojure.core/defn of-nano-of-day {:arglists (quote (["long"]))} (^java.time.LocalTime [^long long14631] (java.time.LocalTime/ofNanoOfDay long14631))) -(clojure.core/defn from {:arglists (quote (["java.time.temporal.TemporalAccessor"]))} (^java.time.LocalTime [^java.time.temporal.TemporalAccessor java-time-temporal-TemporalAccessor14632] (java.time.LocalTime/from java-time-temporal-TemporalAccessor14632))) -(clojure.core/defn is-after {:arglists (quote (["java.time.LocalTime" "java.time.LocalTime"]))} (^java.lang.Boolean [^java.time.LocalTime this14633 ^java.time.LocalTime java-time-LocalTime14634] (.isAfter this14633 java-time-LocalTime14634))) -(clojure.core/defn minus-nanos {:arglists (quote (["java.time.LocalTime" "long"]))} (^java.time.LocalTime [^java.time.LocalTime this14635 ^long long14636] (.minusNanos this14635 long14636))) -(clojure.core/defn is-supported {:arglists (quote (["java.time.LocalTime" "java.time.temporal.TemporalUnit"] ["java.time.LocalTime" "java.time.temporal.TemporalField"]))} (^java.lang.Boolean [this14637 G__14638] (clojure.core/cond (clojure.core/and (clojure.core/instance? java.time.temporal.ChronoUnit G__14638)) (clojure.core/let [G__14638 ^"java.time.temporal.ChronoUnit" G__14638] (.isSupported ^java.time.LocalTime this14637 G__14638)) (clojure.core/and (clojure.core/instance? java.time.temporal.TemporalField G__14638)) (clojure.core/let [G__14638 ^"java.time.temporal.TemporalField" G__14638] (.isSupported ^java.time.LocalTime this14637 G__14638)) :else (throw (java.lang.IllegalArgumentException. "no corresponding java.time method with these args"))))) -(clojure.core/defn parse {:arglists (quote (["java.lang.CharSequence"] ["java.lang.CharSequence" "java.time.format.DateTimeFormatter"]))} (^java.time.LocalTime [^java.lang.CharSequence java-lang-CharSequence14639] (java.time.LocalTime/parse java-lang-CharSequence14639)) (^java.time.LocalTime [^java.lang.CharSequence java-lang-CharSequence14640 ^java.time.format.DateTimeFormatter java-time-format-DateTimeFormatter14641] (java.time.LocalTime/parse java-lang-CharSequence14640 java-time-format-DateTimeFormatter14641))) -(clojure.core/defn with-second {:arglists (quote (["java.time.LocalTime" "int"]))} (^java.time.LocalTime [^java.time.LocalTime this14642 ^java.lang.Integer int14643] (.withSecond this14642 int14643))) -(clojure.core/defn get-minute {:arglists (quote (["java.time.LocalTime"]))} (^java.lang.Integer [^java.time.LocalTime this14644] (.getMinute this14644))) -(clojure.core/defn hash-code {:arglists (quote (["java.time.LocalTime"]))} (^java.lang.Integer [^java.time.LocalTime this14645] (.hashCode this14645))) -(clojure.core/defn adjust-into {:arglists (quote (["java.time.LocalTime" "java.time.temporal.Temporal"]))} (^java.time.temporal.Temporal [^java.time.LocalTime this14646 ^java.time.temporal.Temporal java-time-temporal-Temporal14647] (.adjustInto this14646 java-time-temporal-Temporal14647))) -(clojure.core/defn with {:arglists (quote (["java.time.LocalTime" "java.time.temporal.TemporalField" "long"] ["java.time.LocalTime" "java.time.temporal.TemporalAdjuster"]))} (^java.time.LocalTime [^java.time.LocalTime this14648 ^java.time.temporal.TemporalField java-time-temporal-TemporalField14649 ^long long14650] (.with this14648 java-time-temporal-TemporalField14649 long14650)) (^java.time.LocalTime [^java.time.LocalTime this14651 ^java.time.temporal.TemporalAdjuster java-time-temporal-TemporalAdjuster14652] (.with this14651 java-time-temporal-TemporalAdjuster14652))) -(clojure.core/defn now {:arglists (quote ([] ["java.time.ZoneId"] ["java.time.Clock"]))} (^java.time.LocalTime [] (java.time.LocalTime/now)) (^java.time.LocalTime [G__14654] (clojure.core/cond (clojure.core/and (clojure.core/instance? java.time.ZoneId G__14654)) (clojure.core/let [G__14654 ^"java.time.ZoneId" G__14654] (java.time.LocalTime/now G__14654)) (clojure.core/and (clojure.core/instance? java.time.Clock G__14654)) (clojure.core/let [G__14654 ^"java.time.Clock" G__14654] (java.time.LocalTime/now G__14654)) :else (throw (java.lang.IllegalArgumentException. "no corresponding java.time method with these args"))))) -(clojure.core/defn compare-to {:arglists (quote (["java.time.LocalTime" "java.time.LocalTime"]))} (^java.lang.Integer [^java.time.LocalTime this14655 ^java.time.LocalTime java-time-LocalTime14656] (.compareTo this14655 java-time-LocalTime14656))) -(clojure.core/defn to-nano-of-day {:arglists (quote (["java.time.LocalTime"]))} (^long [^java.time.LocalTime this14657] (.toNanoOfDay this14657))) -(clojure.core/defn plus-seconds {:arglists (quote (["java.time.LocalTime" "long"]))} (^java.time.LocalTime [^java.time.LocalTime this14658 ^long long14659] (.plusSeconds this14658 long14659))) -(clojure.core/defn get {:arglists (quote (["java.time.LocalTime" "java.time.temporal.TemporalField"]))} (^java.lang.Integer [^java.time.LocalTime this14660 ^java.time.temporal.TemporalField java-time-temporal-TemporalField14661] (.get this14660 java-time-temporal-TemporalField14661))) -(clojure.core/defn of-second-of-day {:arglists (quote (["long"]))} (^java.time.LocalTime [^long long14662] (java.time.LocalTime/ofSecondOfDay long14662))) -(clojure.core/defn equals {:arglists (quote (["java.time.LocalTime" "java.lang.Object"]))} (^java.lang.Boolean [^java.time.LocalTime this14663 ^java.lang.Object java-lang-Object14664] (.equals this14663 java-lang-Object14664))) -(clojure.core/defn format {:arglists (quote (["java.time.LocalTime" "java.time.format.DateTimeFormatter"]))} (^java.lang.String [^java.time.LocalTime this14665 ^java.time.format.DateTimeFormatter java-time-format-DateTimeFormatter14666] (.format this14665 java-time-format-DateTimeFormatter14666))) +(ns cljc.java-time.local-time + (:refer-clojure :exclude + [abs get range format min max next name resolve short]) + (:require [cljc.java-time.extn.calendar-awareness]) + (:import [java.time LocalTime])) + +(def max + "The maximum supported {@code LocalTime}, '23:59:59.999999999'. + This is the time just before midnight at the end of the day." + java.time.LocalTime/MAX) + +(def noon + "The time of noon in the middle of the day, '12:00'." + java.time.LocalTime/NOON) + +(def midnight + "The time of midnight at the start of the day, '00:00'." + java.time.LocalTime/MIDNIGHT) + +(def min + "The minimum supported {@code LocalTime}, '00:00'. + This is the time of midnight at the start of the day." + java.time.LocalTime/MIN) + +(defn minus-minutes + "Returns a copy of this {@code LocalTime} with the specified number of minutes subtracted. + + This subtracts the specified number of minutes from this time, returning a new time. + The calculation wraps around midnight. + + This instance is immutable and unaffected by this method call. + + @param minutesToSubtract the minutes to subtract, may be negative + @return a {@code LocalTime} based on this time with the minutes subtracted, not null" + {:arglists (quote (["java.time.LocalTime" "long"]))} + (^java.time.LocalTime [^java.time.LocalTime this ^long minutes-to-subtract] + (.minusMinutes this minutes-to-subtract))) + +(defn truncated-to + "Returns a copy of this {@code LocalTime} with the time truncated. + + Truncation returns a copy of the original time with fields + smaller than the specified unit set to zero. + For example, truncating with the {@link ChronoUnit#MINUTES minutes} unit + will set the second-of-minute and nano-of-second field to zero. + + The unit must have a {@linkplain TemporalUnit#getDuration() duration} + that divides into the length of a standard day without remainder. + This includes all supplied time units on {@link ChronoUnit} and + {@link ChronoUnit#DAYS DAYS}. Other units throw an exception. + + This instance is immutable and unaffected by this method call. + + @param unit the unit to truncate to, not null + @return a {@code LocalTime} based on this time with the time truncated, not null + @throws DateTimeException if unable to truncate + @throws UnsupportedTemporalTypeException if the unit is not supported" + {:arglists (quote (["java.time.LocalTime" + "java.time.temporal.TemporalUnit"]))} + (^java.time.LocalTime + [^java.time.LocalTime this ^java.time.temporal.ChronoUnit unit] + (.truncatedTo this unit))) + +(defn range + "Gets the range of valid values for the specified field. + + The range object expresses the minimum and maximum valid values for a field. + This time is used to enhance the accuracy of the returned range. + If it is not possible to return the range, because the field is not supported + or for some other reason, an exception is thrown. + + If the field is a {@link ChronoField} then the query is implemented here. + The {@link #isSupported(TemporalField) supported fields} will return + appropriate range instances. + All other {@code ChronoField} instances will throw an {@code UnsupportedTemporalTypeException}. + + If the field is not a {@code ChronoField}, then the result of this method + is obtained by invoking {@code TemporalField.rangeRefinedBy(TemporalAccessor)} + passing {@code this} as the argument. + Whether the range can be obtained is determined by the field. + + @param field the field to query the range for, not null + @return the range of valid values for the field, not null + @throws DateTimeException if the range for the field cannot be obtained + @throws UnsupportedTemporalTypeException if the field is not supported" + {:arglists (quote (["java.time.LocalTime" + "java.time.temporal.TemporalField"]))} + (^java.time.temporal.ValueRange + [^java.time.LocalTime this ^java.time.temporal.TemporalField field] + (.range this field))) + +(defn get-hour + "Gets the hour-of-day field. + + @return the hour-of-day, from 0 to 23" + {:arglists (quote (["java.time.LocalTime"]))} + (^java.lang.Integer [^java.time.LocalTime this] (.getHour this))) + +(defn at-offset + "Combines this time with an offset to create an {@code OffsetTime}. + + This returns an {@code OffsetTime} formed from this time at the specified offset. + All possible combinations of time and offset are valid. + + @param offset the offset to combine with, not null + @return the offset time formed from this time and the specified offset, not null" + {:arglists (quote (["java.time.LocalTime" "java.time.ZoneOffset"]))} + (^java.time.OffsetTime + [^java.time.LocalTime this ^java.time.ZoneOffset offset] + (.atOffset this offset))) + +(defn minus-hours + "Returns a copy of this {@code LocalTime} with the specified number of hours subtracted. + + This subtracts the specified number of hours from this time, returning a new time. + The calculation wraps around midnight. + + This instance is immutable and unaffected by this method call. + + @param hoursToSubtract the hours to subtract, may be negative + @return a {@code LocalTime} based on this time with the hours subtracted, not null" + {:arglists (quote (["java.time.LocalTime" "long"]))} + (^java.time.LocalTime [^java.time.LocalTime this ^long hours-to-subtract] + (.minusHours this hours-to-subtract))) + +(defn of + {:arglists (quote + (["int" "int"] ["int" "int" "int"] ["int" "int" "int" "int"]))} + (^java.time.LocalTime [^java.lang.Integer hour ^java.lang.Integer minute] + (java.time.LocalTime/of hour minute)) + (^java.time.LocalTime + [^java.lang.Integer hour ^java.lang.Integer minute ^java.lang.Integer second] + (java.time.LocalTime/of hour minute second)) + (^java.time.LocalTime + [^java.lang.Integer hour ^java.lang.Integer minute ^java.lang.Integer second + ^java.lang.Integer nano-of-second] + (java.time.LocalTime/of hour minute second nano-of-second))) + +(defn get-nano + "Gets the nano-of-second field. + + @return the nano-of-second, from 0 to 999,999,999" + {:arglists (quote (["java.time.LocalTime"]))} + (^java.lang.Integer [^java.time.LocalTime this] (.getNano this))) + +(defn minus-seconds + "Returns a copy of this {@code LocalTime} with the specified number of seconds subtracted. + + This subtracts the specified number of seconds from this time, returning a new time. + The calculation wraps around midnight. + + This instance is immutable and unaffected by this method call. + + @param secondsToSubtract the seconds to subtract, may be negative + @return a {@code LocalTime} based on this time with the seconds subtracted, not null" + {:arglists (quote (["java.time.LocalTime" "long"]))} + (^java.time.LocalTime [^java.time.LocalTime this ^long seconds-to-subtract] + (.minusSeconds this seconds-to-subtract))) + +(defn get-second + "Gets the second-of-minute field. + + @return the second-of-minute, from 0 to 59" + {:arglists (quote (["java.time.LocalTime"]))} + (^java.lang.Integer [^java.time.LocalTime this] (.getSecond this))) + +(defn plus-nanos + "Returns a copy of this {@code LocalTime} with the specified number of nanoseconds added. + + This adds the specified number of nanoseconds to this time, returning a new time. + The calculation wraps around midnight. + + This instance is immutable and unaffected by this method call. + + @param nanosToAdd the nanos to add, may be negative + @return a {@code LocalTime} based on this time with the nanoseconds added, not null" + {:arglists (quote (["java.time.LocalTime" "long"]))} + (^java.time.LocalTime [^java.time.LocalTime this ^long nanos-to-add] + (.plusNanos this nanos-to-add))) + +(defn plus + {:arglists (quote (["java.time.LocalTime" "java.time.temporal.TemporalAmount"] + ["java.time.LocalTime" "long" + "java.time.temporal.TemporalUnit"]))} + (^java.time.LocalTime + [^java.time.LocalTime this ^java.time.temporal.TemporalAmount amount-to-add] + (.plus this amount-to-add)) + (^java.time.LocalTime + [^java.time.LocalTime this ^long amount-to-add + ^java.time.temporal.ChronoUnit unit] + (.plus this amount-to-add unit))) + +(defn with-hour + "Returns a copy of this {@code LocalTime} with the hour-of-day altered. + + This instance is immutable and unaffected by this method call. + + @param hour the hour-of-day to set in the result, from 0 to 23 + @return a {@code LocalTime} based on this time with the requested hour, not null + @throws DateTimeException if the hour value is invalid" + {:arglists (quote (["java.time.LocalTime" "int"]))} + (^java.time.LocalTime [^java.time.LocalTime this ^java.lang.Integer hour] + (.withHour this hour))) + +(defn with-minute + "Returns a copy of this {@code LocalTime} with the minute-of-hour altered. + + This instance is immutable and unaffected by this method call. + + @param minute the minute-of-hour to set in the result, from 0 to 59 + @return a {@code LocalTime} based on this time with the requested minute, not null + @throws DateTimeException if the minute value is invalid" + {:arglists (quote (["java.time.LocalTime" "int"]))} + (^java.time.LocalTime [^java.time.LocalTime this ^java.lang.Integer minute] + (.withMinute this minute))) + +(defn plus-minutes + "Returns a copy of this {@code LocalTime} with the specified number of minutes added. + + This adds the specified number of minutes to this time, returning a new time. + The calculation wraps around midnight. + + This instance is immutable and unaffected by this method call. + + @param minutesToAdd the minutes to add, may be negative + @return a {@code LocalTime} based on this time with the minutes added, not null" + {:arglists (quote (["java.time.LocalTime" "long"]))} + (^java.time.LocalTime [^java.time.LocalTime this ^long minutes-to-add] + (.plusMinutes this minutes-to-add))) + +(defn query + "Queries this time using the specified query. + + This queries this time using the specified query strategy object. + The {@code TemporalQuery} object defines the logic to be used to + obtain the result. Read the documentation of the query to understand + what the result of this method will be. + + The result of this method is obtained by invoking the + {@link TemporalQuery#queryFrom(TemporalAccessor)} method on the + specified query passing {@code this} as the argument. + + @param the type of the result + @param query the query to invoke, not null + @return the query result, null may be returned (defined by the query) + @throws DateTimeException if unable to query (defined by the query) + @throws ArithmeticException if numeric overflow occurs (defined by the query)" + {:arglists (quote (["java.time.LocalTime" + "java.time.temporal.TemporalQuery"]))} + (^java.lang.Object + [^java.time.LocalTime this ^java.time.temporal.TemporalQuery query] + (.query this query))) + +(defn at-date + "Combines this time with a date to create a {@code LocalDateTime}. + + This returns a {@code LocalDateTime} formed from this time at the specified date. + All possible combinations of date and time are valid. + + @param date the date to combine with, not null + @return the local date-time formed from this time and the specified date, not null" + {:arglists (quote (["java.time.LocalTime" "java.time.LocalDate"]))} + (^java.time.LocalDateTime + [^java.time.LocalTime this ^java.time.LocalDate date] + (.atDate this date))) + +(defn to-string + "Outputs this time as a {@code String}, such as {@code 10:15}. + + The output will be one of the following ISO-8601 formats: +
    +
  • {@code HH:mm}
  • +
  • {@code HH:mm:ss}
  • +
  • {@code HH:mm:ss.SSS}
  • +
  • {@code HH:mm:ss.SSSSSS}
  • +
  • {@code HH:mm:ss.SSSSSSSSS}
  • +
+ The format used will be the shortest that outputs the full value of + the time where the omitted parts are implied to be zero. + + @return a string representation of this time, not null" + {:arglists (quote (["java.time.LocalTime"]))} + (^java.lang.String [^java.time.LocalTime this] (.toString this))) + +(defn is-before + "Checks if this time is before the specified time. + + The comparison is based on the time-line position of the time within a day. + + @param other the other time to compare to, not null + @return true if this point is before the specified time + @throws NullPointerException if {@code other} is null" + {:arglists (quote (["java.time.LocalTime" "java.time.LocalTime"]))} + (^java.lang.Boolean [^java.time.LocalTime this ^java.time.LocalTime other] + (.isBefore this other))) + +(defn minus + {:arglists (quote (["java.time.LocalTime" "java.time.temporal.TemporalAmount"] + ["java.time.LocalTime" "long" + "java.time.temporal.TemporalUnit"]))} + (^java.time.LocalTime + [^java.time.LocalTime this + ^java.time.temporal.TemporalAmount amount-to-subtract] + (.minus this amount-to-subtract)) + (^java.time.LocalTime + [^java.time.LocalTime this ^long amount-to-subtract + ^java.time.temporal.ChronoUnit unit] + (.minus this amount-to-subtract unit))) + +(defn plus-hours + "Returns a copy of this {@code LocalTime} with the specified number of hours added. + + This adds the specified number of hours to this time, returning a new time. + The calculation wraps around midnight. + + This instance is immutable and unaffected by this method call. + + @param hoursToAdd the hours to add, may be negative + @return a {@code LocalTime} based on this time with the hours added, not null" + {:arglists (quote (["java.time.LocalTime" "long"]))} + (^java.time.LocalTime [^java.time.LocalTime this ^long hours-to-add] + (.plusHours this hours-to-add))) + +(defn to-second-of-day + "Extracts the time as seconds of day, + from {@code 0} to {@code 24 * 60 * 60 - 1}. + + @return the second-of-day equivalent to this time" + {:arglists (quote (["java.time.LocalTime"]))} + (^java.lang.Integer [^java.time.LocalTime this] (.toSecondOfDay this))) + +(defn get-long + "Gets the value of the specified field from this time as a {@code long}. + + This queries this time for the value of the specified field. + If it is not possible to return the value, because the field is not supported + or for some other reason, an exception is thrown. + + If the field is a {@link ChronoField} then the query is implemented here. + The {@link #isSupported(TemporalField) supported fields} will return valid + values based on this time. + All other {@code ChronoField} instances will throw an {@code UnsupportedTemporalTypeException}. + + If the field is not a {@code ChronoField}, then the result of this method + is obtained by invoking {@code TemporalField.getFrom(TemporalAccessor)} + passing {@code this} as the argument. Whether the value can be obtained, + and what the value represents, is determined by the field. + + @param field the field to get, not null + @return the value for the field + @throws DateTimeException if a value for the field cannot be obtained + @throws UnsupportedTemporalTypeException if the field is not supported + @throws ArithmeticException if numeric overflow occurs" + {:arglists (quote (["java.time.LocalTime" + "java.time.temporal.TemporalField"]))} + (^long [^java.time.LocalTime this ^java.time.temporal.TemporalField field] + (.getLong this field))) + +(defn with-nano + "Returns a copy of this {@code LocalTime} with the nano-of-second altered. + + This instance is immutable and unaffected by this method call. + + @param nanoOfSecond the nano-of-second to set in the result, from 0 to 999,999,999 + @return a {@code LocalTime} based on this time with the requested nanosecond, not null + @throws DateTimeException if the nanos value is invalid" + {:arglists (quote (["java.time.LocalTime" "int"]))} + (^java.time.LocalTime + [^java.time.LocalTime this ^java.lang.Integer nano-of-second] + (.withNano this nano-of-second))) + +(defn until + "Calculates the amount of time until another time in terms of the specified unit. + + This calculates the amount of time between two {@code LocalTime} + objects in terms of a single {@code TemporalUnit}. + The start and end points are {@code this} and the specified time. + The result will be negative if the end is before the start. + The {@code Temporal} passed to this method is converted to a + {@code LocalTime} using {@link #from(TemporalAccessor)}. + For example, the amount in hours between two times can be calculated + using {@code startTime.until(endTime, HOURS)}. + + The calculation returns a whole number, representing the number of + complete units between the two times. + For example, the amount in hours between 11:30 and 13:29 will only + be one hour as it is one minute short of two hours. + + There are two equivalent ways of using this method. + The first is to invoke this method. + The second is to use {@link TemporalUnit#between(Temporal, Temporal)}: +
+   // these two lines are equivalent
+   amount = start.until(end, MINUTES);
+   amount = MINUTES.between(start, end);
+ 
+ The choice should be made based on which makes the code more readable. + + The calculation is implemented in this method for {@link ChronoUnit}. + The units {@code NANOS}, {@code MICROS}, {@code MILLIS}, {@code SECONDS}, + {@code MINUTES}, {@code HOURS} and {@code HALF_DAYS} are supported. + Other {@code ChronoUnit} values will throw an exception. + + If the unit is not a {@code ChronoUnit}, then the result of this method + is obtained by invoking {@code TemporalUnit.between(Temporal, Temporal)} + passing {@code this} as the first argument and the converted input temporal + as the second argument. + + This instance is immutable and unaffected by this method call. + + @param endExclusive the end time, exclusive, which is converted to a {@code LocalTime}, not null + @param unit the unit to measure the amount in, not null + @return the amount of time between this time and the end time + @throws DateTimeException if the amount cannot be calculated, or the end + temporal cannot be converted to a {@code LocalTime} + @throws UnsupportedTemporalTypeException if the unit is not supported + @throws ArithmeticException if numeric overflow occurs" + {:arglists (quote (["java.time.LocalTime" "java.time.temporal.Temporal" + "java.time.temporal.TemporalUnit"]))} + (^long + [^java.time.LocalTime this ^java.time.temporal.Temporal end-exclusive + ^java.time.temporal.ChronoUnit unit] + (.until this end-exclusive unit))) + +(defn of-nano-of-day + "Obtains an instance of {@code LocalTime} from a nanos-of-day value. + + This returns a {@code LocalTime} with the specified nanosecond-of-day. + + @param nanoOfDay the nano of day, from {@code 0} to {@code 24 * 60 * 60 * 1,000,000,000 - 1} + @return the local time, not null + @throws DateTimeException if the nanos of day value is invalid" + {:arglists (quote (["long"]))} + (^java.time.LocalTime [^long nano-of-day] + (java.time.LocalTime/ofNanoOfDay nano-of-day))) + +(defn from + "Obtains an instance of {@code LocalTime} from a temporal object. + + This obtains a local time based on the specified temporal. + A {@code TemporalAccessor} represents an arbitrary set of date and time information, + which this factory converts to an instance of {@code LocalTime}. + + The conversion uses the {@link TemporalQueries#localTime()} query, which relies + on extracting the {@link ChronoField#NANO_OF_DAY NANO_OF_DAY} field. + + This method matches the signature of the functional interface {@link TemporalQuery} + allowing it to be used as a query via method reference, {@code LocalTime::from}. + + @param temporal the temporal object to convert, not null + @return the local time, not null + @throws DateTimeException if unable to convert to a {@code LocalTime}" + {:arglists (quote (["java.time.temporal.TemporalAccessor"]))} + (^java.time.LocalTime [^java.time.temporal.TemporalAccessor temporal] + (java.time.LocalTime/from temporal))) + +(defn is-after + "Checks if this time is after the specified time. + + The comparison is based on the time-line position of the time within a day. + + @param other the other time to compare to, not null + @return true if this is after the specified time + @throws NullPointerException if {@code other} is null" + {:arglists (quote (["java.time.LocalTime" "java.time.LocalTime"]))} + (^java.lang.Boolean [^java.time.LocalTime this ^java.time.LocalTime other] + (.isAfter this other))) + +(defn minus-nanos + "Returns a copy of this {@code LocalTime} with the specified number of nanoseconds subtracted. + + This subtracts the specified number of nanoseconds from this time, returning a new time. + The calculation wraps around midnight. + + This instance is immutable and unaffected by this method call. + + @param nanosToSubtract the nanos to subtract, may be negative + @return a {@code LocalTime} based on this time with the nanoseconds subtracted, not null" + {:arglists (quote (["java.time.LocalTime" "long"]))} + (^java.time.LocalTime [^java.time.LocalTime this ^long nanos-to-subtract] + (.minusNanos this nanos-to-subtract))) + +(defn is-supported + {:arglists (quote (["java.time.LocalTime" "java.time.temporal.TemporalField"] + ["java.time.LocalTime" + "java.time.temporal.TemporalUnit"]))} + (^java.lang.Boolean [^java.time.LocalTime this arg0] + (cond (instance? java.time.temporal.TemporalField arg0) + (let [^java.time.temporal.TemporalField field arg0] + (.isSupported this field)) + (instance? java.time.temporal.ChronoUnit arg0) + (let [^java.time.temporal.TemporalUnit unit arg0] + (.isSupported this unit)) + :else (throw (java.lang.IllegalArgumentException. + "no corresponding java.time method with these args"))))) + +(defn parse + {:arglists (quote (["java.lang.CharSequence"] + ["java.lang.CharSequence" + "java.time.format.DateTimeFormatter"]))} + (^java.time.LocalTime [^java.lang.CharSequence text] + (java.time.LocalTime/parse text)) + (^java.time.LocalTime + [^java.lang.CharSequence text ^java.time.format.DateTimeFormatter formatter] + (java.time.LocalTime/parse text formatter))) + +(defn with-second + "Returns a copy of this {@code LocalTime} with the second-of-minute altered. + + This instance is immutable and unaffected by this method call. + + @param second the second-of-minute to set in the result, from 0 to 59 + @return a {@code LocalTime} based on this time with the requested second, not null + @throws DateTimeException if the second value is invalid" + {:arglists (quote (["java.time.LocalTime" "int"]))} + (^java.time.LocalTime [^java.time.LocalTime this ^java.lang.Integer second] + (.withSecond this second))) + +(defn get-minute + "Gets the minute-of-hour field. + + @return the minute-of-hour, from 0 to 59" + {:arglists (quote (["java.time.LocalTime"]))} + (^java.lang.Integer [^java.time.LocalTime this] (.getMinute this))) + +(defn hash-code + "A hash code for this time. + + @return a suitable hash code" + {:arglists (quote (["java.time.LocalTime"]))} + (^java.lang.Integer [^java.time.LocalTime this] (.hashCode this))) + +(defn adjust-into + "Adjusts the specified temporal object to have the same time as this object. + + This returns a temporal object of the same observable type as the input + with the time changed to be the same as this. + + The adjustment is equivalent to using {@link Temporal#with(TemporalField, long)} + passing {@link ChronoField#NANO_OF_DAY} as the field. + + In most cases, it is clearer to reverse the calling pattern by using + {@link Temporal#with(TemporalAdjuster)}: +
+   // these two lines are equivalent, but the second approach is recommended
+   temporal = thisLocalTime.adjustInto(temporal);
+   temporal = temporal.with(thisLocalTime);
+ 
+ + This instance is immutable and unaffected by this method call. + + @param temporal the target object to be adjusted, not null + @return the adjusted object, not null + @throws DateTimeException if unable to make the adjustment + @throws ArithmeticException if numeric overflow occurs" + {:arglists (quote (["java.time.LocalTime" "java.time.temporal.Temporal"]))} + (^java.time.temporal.Temporal + [^java.time.LocalTime this ^java.time.temporal.Temporal temporal] + (.adjustInto this temporal))) + +(defn with + {:arglists (quote (["java.time.LocalTime" + "java.time.temporal.TemporalAdjuster"] + ["java.time.LocalTime" "java.time.temporal.TemporalField" + "long"]))} + (^java.time.LocalTime + [^java.time.LocalTime this ^java.time.temporal.TemporalAdjuster adjuster] + (.with this adjuster)) + (^java.time.LocalTime + [^java.time.LocalTime this ^java.time.temporal.TemporalField field + ^long new-value] + (.with this field new-value))) + +(defn now + {:arglists (quote ([] ["java.time.Clock"] ["java.time.ZoneId"]))} + (^java.time.LocalTime [] (java.time.LocalTime/now)) + (^java.time.LocalTime [arg0] + (cond (instance? java.time.Clock arg0) (let [^java.time.Clock clock arg0] + (java.time.LocalTime/now clock)) + (instance? java.time.ZoneId arg0) (let [^java.time.ZoneId zone arg0] + (java.time.LocalTime/now zone)) + :else (throw (java.lang.IllegalArgumentException. + "no corresponding java.time method with these args"))))) + +(defn compare-to + "Compares this time to another time. + + The comparison is based on the time-line position of the local times within a day. + It is \"consistent with equals\", as defined by {@link Comparable}. + + @param other the other time to compare to, not null + @return the comparator value, negative if less, positive if greater + @throws NullPointerException if {@code other} is null" + {:arglists (quote (["java.time.LocalTime" "java.time.LocalTime"]))} + (^java.lang.Integer [^java.time.LocalTime this ^java.time.LocalTime other] + (.compareTo this other))) + +(defn to-nano-of-day + "Extracts the time as nanos of day, + from {@code 0} to {@code 24 * 60 * 60 * 1,000,000,000 - 1}. + + @return the nano of day equivalent to this time" + {:arglists (quote (["java.time.LocalTime"]))} + (^long [^java.time.LocalTime this] (.toNanoOfDay this))) + +(defn plus-seconds + "Returns a copy of this {@code LocalTime} with the specified number of seconds added. + + This adds the specified number of seconds to this time, returning a new time. + The calculation wraps around midnight. + + This instance is immutable and unaffected by this method call. + + @param secondstoAdd the seconds to add, may be negative + @return a {@code LocalTime} based on this time with the seconds added, not null" + {:arglists (quote (["java.time.LocalTime" "long"]))} + (^java.time.LocalTime [^java.time.LocalTime this ^long secondsto-add] + (.plusSeconds this secondsto-add))) + +(defn get + "Gets the value of the specified field from this time as an {@code int}. + + This queries this time for the value of the specified field. + The returned value will always be within the valid range of values for the field. + If it is not possible to return the value, because the field is not supported + or for some other reason, an exception is thrown. + + If the field is a {@link ChronoField} then the query is implemented here. + The {@link #isSupported(TemporalField) supported fields} will return valid + values based on this time, except {@code NANO_OF_DAY} and {@code MICRO_OF_DAY} + which are too large to fit in an {@code int} and throw a {@code DateTimeException}. + All other {@code ChronoField} instances will throw an {@code UnsupportedTemporalTypeException}. + + If the field is not a {@code ChronoField}, then the result of this method + is obtained by invoking {@code TemporalField.getFrom(TemporalAccessor)} + passing {@code this} as the argument. Whether the value can be obtained, + and what the value represents, is determined by the field. + + @param field the field to get, not null + @return the value for the field + @throws DateTimeException if a value for the field cannot be obtained or + the value is outside the range of valid values for the field + @throws UnsupportedTemporalTypeException if the field is not supported or + the range of values exceeds an {@code int} + @throws ArithmeticException if numeric overflow occurs" + {:arglists (quote (["java.time.LocalTime" + "java.time.temporal.TemporalField"]))} + (^java.lang.Integer + [^java.time.LocalTime this ^java.time.temporal.TemporalField field] + (.get this field))) + +(defn of-second-of-day + "Obtains an instance of {@code LocalTime} from a second-of-day value. + + This returns a {@code LocalTime} with the specified second-of-day. + The nanosecond field will be set to zero. + + @param secondOfDay the second-of-day, from {@code 0} to {@code 24 * 60 * 60 - 1} + @return the local time, not null + @throws DateTimeException if the second-of-day value is invalid" + {:arglists (quote (["long"]))} + (^java.time.LocalTime [^long second-of-day] + (java.time.LocalTime/ofSecondOfDay second-of-day))) + +(defn equals + "Checks if this time is equal to another time. + + The comparison is based on the time-line position of the time within a day. + + Only objects of type {@code LocalTime} are compared, other types return false. + To compare the date of two {@code TemporalAccessor} instances, use + {@link ChronoField#NANO_OF_DAY} as a comparator. + + @param obj the object to check, null returns false + @return true if this is equal to the other time" + {:arglists (quote (["java.time.LocalTime" "java.lang.Object"]))} + (^java.lang.Boolean [^java.time.LocalTime this ^java.lang.Object obj] + (.equals this obj))) + +(defn format + "Formats this time using the specified formatter. + + This time will be passed to the formatter to produce a string. + + @param formatter the formatter to use, not null + @return the formatted time string, not null + @throws DateTimeException if an error occurs during printing" + {:arglists (quote (["java.time.LocalTime" + "java.time.format.DateTimeFormatter"]))} + (^java.lang.String + [^java.time.LocalTime this ^java.time.format.DateTimeFormatter formatter] + (.format this formatter))) diff --git a/src/cljc/java_time/local_time.cljs b/src/cljc/java_time/local_time.cljs index 98a0487..ad4598c 100644 --- a/src/cljc/java_time/local_time.cljs +++ b/src/cljc/java_time/local_time.cljs @@ -1,49 +1,669 @@ -(ns cljc.java-time.local-time (:refer-clojure :exclude [abs get range format min max next name resolve short]) (:require [cljc.java-time.extn.calendar-awareness] [goog.object] [java.time :refer [LocalTime]])) -(def max (goog.object/get java.time.LocalTime "MAX")) -(def noon (goog.object/get java.time.LocalTime "NOON")) -(def midnight (goog.object/get java.time.LocalTime "MIDNIGHT")) -(def min (goog.object/get java.time.LocalTime "MIN")) -(clojure.core/defn minus-minutes {:arglists (quote (["java.time.LocalTime" "long"]))} (^js/JSJoda.LocalTime [^js/JSJoda.LocalTime this14667 ^long long14668] (.minusMinutes this14667 long14668))) -(clojure.core/defn truncated-to {:arglists (quote (["java.time.LocalTime" "java.time.temporal.TemporalUnit"]))} (^js/JSJoda.LocalTime [^js/JSJoda.LocalTime this14669 ^js/JSJoda.TemporalUnit java-time-temporal-TemporalUnit14670] (.truncatedTo this14669 java-time-temporal-TemporalUnit14670))) -(clojure.core/defn range {:arglists (quote (["java.time.LocalTime" "java.time.temporal.TemporalField"]))} (^js/JSJoda.ValueRange [^js/JSJoda.LocalTime this14671 ^js/JSJoda.TemporalField java-time-temporal-TemporalField14672] (.range this14671 java-time-temporal-TemporalField14672))) -(clojure.core/defn get-hour {:arglists (quote (["java.time.LocalTime"]))} (^int [^js/JSJoda.LocalTime this14673] (.hour this14673))) -(clojure.core/defn at-offset {:arglists (quote (["java.time.LocalTime" "java.time.ZoneOffset"]))} (^js/JSJoda.OffsetTime [^js/JSJoda.LocalTime this14674 ^js/JSJoda.ZoneOffset java-time-ZoneOffset14675] (.atOffset this14674 java-time-ZoneOffset14675))) -(clojure.core/defn minus-hours {:arglists (quote (["java.time.LocalTime" "long"]))} (^js/JSJoda.LocalTime [^js/JSJoda.LocalTime this14676 ^long long14677] (.minusHours this14676 long14677))) -(clojure.core/defn of {:arglists (quote (["int" "int" "int"] ["int" "int"] ["int" "int" "int" "int"]))} (^js/JSJoda.LocalTime [^int int14678 ^int int14679 ^int int14680] (js-invoke java.time.LocalTime "of" int14678 int14679 int14680)) (^js/JSJoda.LocalTime [^int int14681 ^int int14682] (js-invoke java.time.LocalTime "of" int14681 int14682)) (^js/JSJoda.LocalTime [^int int14683 ^int int14684 ^int int14685 ^int int14686] (js-invoke java.time.LocalTime "of" int14683 int14684 int14685 int14686))) -(clojure.core/defn get-nano {:arglists (quote (["java.time.LocalTime"]))} (^int [^js/JSJoda.LocalTime this14687] (.nano this14687))) -(clojure.core/defn minus-seconds {:arglists (quote (["java.time.LocalTime" "long"]))} (^js/JSJoda.LocalTime [^js/JSJoda.LocalTime this14688 ^long long14689] (.minusSeconds this14688 long14689))) -(clojure.core/defn get-second {:arglists (quote (["java.time.LocalTime"]))} (^int [^js/JSJoda.LocalTime this14690] (.second this14690))) -(clojure.core/defn plus-nanos {:arglists (quote (["java.time.LocalTime" "long"]))} (^js/JSJoda.LocalTime [^js/JSJoda.LocalTime this14691 ^long long14692] (.plusNanos this14691 long14692))) -(clojure.core/defn plus {:arglists (quote (["java.time.LocalTime" "java.time.temporal.TemporalAmount"] ["java.time.LocalTime" "long" "java.time.temporal.TemporalUnit"]))} (^js/JSJoda.LocalTime [^js/JSJoda.LocalTime this14693 ^js/JSJoda.TemporalAmount java-time-temporal-TemporalAmount14694] (.plus this14693 java-time-temporal-TemporalAmount14694)) (^js/JSJoda.LocalTime [^js/JSJoda.LocalTime this14695 ^long long14696 ^js/JSJoda.TemporalUnit java-time-temporal-TemporalUnit14697] (.plus this14695 long14696 java-time-temporal-TemporalUnit14697))) -(clojure.core/defn with-hour {:arglists (quote (["java.time.LocalTime" "int"]))} (^js/JSJoda.LocalTime [^js/JSJoda.LocalTime this14698 ^int int14699] (.withHour this14698 int14699))) -(clojure.core/defn with-minute {:arglists (quote (["java.time.LocalTime" "int"]))} (^js/JSJoda.LocalTime [^js/JSJoda.LocalTime this14700 ^int int14701] (.withMinute this14700 int14701))) -(clojure.core/defn plus-minutes {:arglists (quote (["java.time.LocalTime" "long"]))} (^js/JSJoda.LocalTime [^js/JSJoda.LocalTime this14702 ^long long14703] (.plusMinutes this14702 long14703))) -(clojure.core/defn query {:arglists (quote (["java.time.LocalTime" "java.time.temporal.TemporalQuery"]))} (^java.lang.Object [^js/JSJoda.LocalTime this14704 ^js/JSJoda.TemporalQuery java-time-temporal-TemporalQuery14705] (.query this14704 java-time-temporal-TemporalQuery14705))) -(clojure.core/defn at-date {:arglists (quote (["java.time.LocalTime" "java.time.LocalDate"]))} (^js/JSJoda.LocalDateTime [^js/JSJoda.LocalTime this14706 ^js/JSJoda.LocalDate java-time-LocalDate14707] (.atDate this14706 java-time-LocalDate14707))) -(clojure.core/defn to-string {:arglists (quote (["java.time.LocalTime"]))} (^java.lang.String [^js/JSJoda.LocalTime this14708] (.toString this14708))) -(clojure.core/defn is-before {:arglists (quote (["java.time.LocalTime" "java.time.LocalTime"]))} (^boolean [^js/JSJoda.LocalTime this14709 ^js/JSJoda.LocalTime java-time-LocalTime14710] (.isBefore this14709 java-time-LocalTime14710))) -(clojure.core/defn minus {:arglists (quote (["java.time.LocalTime" "long" "java.time.temporal.TemporalUnit"] ["java.time.LocalTime" "java.time.temporal.TemporalAmount"]))} (^js/JSJoda.LocalTime [^js/JSJoda.LocalTime this14711 ^long long14712 ^js/JSJoda.TemporalUnit java-time-temporal-TemporalUnit14713] (.minus this14711 long14712 java-time-temporal-TemporalUnit14713)) (^js/JSJoda.LocalTime [^js/JSJoda.LocalTime this14714 ^js/JSJoda.TemporalAmount java-time-temporal-TemporalAmount14715] (.minus this14714 java-time-temporal-TemporalAmount14715))) -(clojure.core/defn plus-hours {:arglists (quote (["java.time.LocalTime" "long"]))} (^js/JSJoda.LocalTime [^js/JSJoda.LocalTime this14716 ^long long14717] (.plusHours this14716 long14717))) -(clojure.core/defn to-second-of-day {:arglists (quote (["java.time.LocalTime"]))} (^int [^js/JSJoda.LocalTime this14718] (.toSecondOfDay this14718))) -(clojure.core/defn get-long {:arglists (quote (["java.time.LocalTime" "java.time.temporal.TemporalField"]))} (^long [^js/JSJoda.LocalTime this14719 ^js/JSJoda.TemporalField java-time-temporal-TemporalField14720] (.getLong this14719 java-time-temporal-TemporalField14720))) -(clojure.core/defn with-nano {:arglists (quote (["java.time.LocalTime" "int"]))} (^js/JSJoda.LocalTime [^js/JSJoda.LocalTime this14721 ^int int14722] (.withNano this14721 int14722))) -(clojure.core/defn until {:arglists (quote (["java.time.LocalTime" "java.time.temporal.Temporal" "java.time.temporal.TemporalUnit"]))} (^long [^js/JSJoda.LocalTime this14723 ^js/JSJoda.Temporal java-time-temporal-Temporal14724 ^js/JSJoda.TemporalUnit java-time-temporal-TemporalUnit14725] (.until this14723 java-time-temporal-Temporal14724 java-time-temporal-TemporalUnit14725))) -(clojure.core/defn of-nano-of-day {:arglists (quote (["long"]))} (^js/JSJoda.LocalTime [^long long14726] (js-invoke java.time.LocalTime "ofNanoOfDay" long14726))) -(clojure.core/defn from {:arglists (quote (["java.time.temporal.TemporalAccessor"]))} (^js/JSJoda.LocalTime [^js/JSJoda.TemporalAccessor java-time-temporal-TemporalAccessor14727] (js-invoke java.time.LocalTime "from" java-time-temporal-TemporalAccessor14727))) -(clojure.core/defn is-after {:arglists (quote (["java.time.LocalTime" "java.time.LocalTime"]))} (^boolean [^js/JSJoda.LocalTime this14728 ^js/JSJoda.LocalTime java-time-LocalTime14729] (.isAfter this14728 java-time-LocalTime14729))) -(clojure.core/defn minus-nanos {:arglists (quote (["java.time.LocalTime" "long"]))} (^js/JSJoda.LocalTime [^js/JSJoda.LocalTime this14730 ^long long14731] (.minusNanos this14730 long14731))) -(clojure.core/defn is-supported {:arglists (quote (["java.time.LocalTime" "java.time.temporal.TemporalUnit"] ["java.time.LocalTime" "java.time.temporal.TemporalField"]))} (^boolean [this14732 G__14733] (.isSupported ^js/JSJoda.LocalTime this14732 G__14733))) -(clojure.core/defn parse {:arglists (quote (["java.lang.CharSequence"] ["java.lang.CharSequence" "java.time.format.DateTimeFormatter"]))} (^js/JSJoda.LocalTime [^java.lang.CharSequence java-lang-CharSequence14734] (js-invoke java.time.LocalTime "parse" java-lang-CharSequence14734)) (^js/JSJoda.LocalTime [^java.lang.CharSequence java-lang-CharSequence14735 ^js/JSJoda.DateTimeFormatter java-time-format-DateTimeFormatter14736] (js-invoke java.time.LocalTime "parse" java-lang-CharSequence14735 java-time-format-DateTimeFormatter14736))) -(clojure.core/defn with-second {:arglists (quote (["java.time.LocalTime" "int"]))} (^js/JSJoda.LocalTime [^js/JSJoda.LocalTime this14737 ^int int14738] (.withSecond this14737 int14738))) -(clojure.core/defn get-minute {:arglists (quote (["java.time.LocalTime"]))} (^int [^js/JSJoda.LocalTime this14739] (.minute this14739))) -(clojure.core/defn hash-code {:arglists (quote (["java.time.LocalTime"]))} (^int [^js/JSJoda.LocalTime this14740] (.hashCode this14740))) -(clojure.core/defn adjust-into {:arglists (quote (["java.time.LocalTime" "java.time.temporal.Temporal"]))} (^js/JSJoda.Temporal [^js/JSJoda.LocalTime this14741 ^js/JSJoda.Temporal java-time-temporal-Temporal14742] (.adjustInto this14741 java-time-temporal-Temporal14742))) -(clojure.core/defn with {:arglists (quote (["java.time.LocalTime" "java.time.temporal.TemporalField" "long"] ["java.time.LocalTime" "java.time.temporal.TemporalAdjuster"]))} (^js/JSJoda.LocalTime [^js/JSJoda.LocalTime this14743 ^js/JSJoda.TemporalField java-time-temporal-TemporalField14744 ^long long14745] (.with this14743 java-time-temporal-TemporalField14744 long14745)) (^js/JSJoda.LocalTime [^js/JSJoda.LocalTime this14746 ^js/JSJoda.TemporalAdjuster java-time-temporal-TemporalAdjuster14747] (.with this14746 java-time-temporal-TemporalAdjuster14747))) -(clojure.core/defn now {:arglists (quote ([] ["java.time.ZoneId"] ["java.time.Clock"]))} (^js/JSJoda.LocalTime [] (js-invoke java.time.LocalTime "now")) (^js/JSJoda.LocalTime [G__14749] (js-invoke java.time.LocalTime "now" G__14749))) -(clojure.core/defn compare-to {:arglists (quote (["java.time.LocalTime" "java.time.LocalTime"]))} (^int [^js/JSJoda.LocalTime this14750 ^js/JSJoda.LocalTime java-time-LocalTime14751] (.compareTo this14750 java-time-LocalTime14751))) -(clojure.core/defn to-nano-of-day {:arglists (quote (["java.time.LocalTime"]))} (^long [^js/JSJoda.LocalTime this14752] (.toNanoOfDay this14752))) -(clojure.core/defn plus-seconds {:arglists (quote (["java.time.LocalTime" "long"]))} (^js/JSJoda.LocalTime [^js/JSJoda.LocalTime this14753 ^long long14754] (.plusSeconds this14753 long14754))) -(clojure.core/defn get {:arglists (quote (["java.time.LocalTime" "java.time.temporal.TemporalField"]))} (^int [^js/JSJoda.LocalTime this14755 ^js/JSJoda.TemporalField java-time-temporal-TemporalField14756] (.get this14755 java-time-temporal-TemporalField14756))) -(clojure.core/defn of-second-of-day {:arglists (quote (["long"]))} (^js/JSJoda.LocalTime [^long long14757] (js-invoke java.time.LocalTime "ofSecondOfDay" long14757))) -(clojure.core/defn equals {:arglists (quote (["java.time.LocalTime" "java.lang.Object"]))} (^boolean [^js/JSJoda.LocalTime this14758 ^java.lang.Object java-lang-Object14759] (.equals this14758 java-lang-Object14759))) -(clojure.core/defn format {:arglists (quote (["java.time.LocalTime" "java.time.format.DateTimeFormatter"]))} (^java.lang.String [^js/JSJoda.LocalTime this14760 ^js/JSJoda.DateTimeFormatter java-time-format-DateTimeFormatter14761] (.format this14760 java-time-format-DateTimeFormatter14761))) +(ns cljc.java-time.local-time + (:refer-clojure :exclude + [abs get range format min max next name resolve short]) + (:require [cljc.java-time.extn.calendar-awareness] + [goog.object] + [java.time :refer [LocalTime]])) + +(def max + "The maximum supported {@code LocalTime}, '23:59:59.999999999'. + This is the time just before midnight at the end of the day." + (goog.object/get java.time.LocalTime "MAX")) + +(def noon + "The time of noon in the middle of the day, '12:00'." + (goog.object/get java.time.LocalTime "NOON")) + +(def midnight + "The time of midnight at the start of the day, '00:00'." + (goog.object/get java.time.LocalTime "MIDNIGHT")) + +(def min + "The minimum supported {@code LocalTime}, '00:00'. + This is the time of midnight at the start of the day." + (goog.object/get java.time.LocalTime "MIN")) + +(defn minus-minutes + "Returns a copy of this {@code LocalTime} with the specified number of minutes subtracted. + + This subtracts the specified number of minutes from this time, returning a new time. + The calculation wraps around midnight. + + This instance is immutable and unaffected by this method call. + + @param minutesToSubtract the minutes to subtract, may be negative + @return a {@code LocalTime} based on this time with the minutes subtracted, not null" + {:arglists (quote (["java.time.LocalTime" "long"]))} + (^js/JSJoda.LocalTime [^js/JSJoda.LocalTime this ^long minutes-to-subtract] + (.minusMinutes this minutes-to-subtract))) + +(defn truncated-to + "Returns a copy of this {@code LocalTime} with the time truncated. + + Truncation returns a copy of the original time with fields + smaller than the specified unit set to zero. + For example, truncating with the {@link ChronoUnit#MINUTES minutes} unit + will set the second-of-minute and nano-of-second field to zero. + + The unit must have a {@linkplain TemporalUnit#getDuration() duration} + that divides into the length of a standard day without remainder. + This includes all supplied time units on {@link ChronoUnit} and + {@link ChronoUnit#DAYS DAYS}. Other units throw an exception. + + This instance is immutable and unaffected by this method call. + + @param unit the unit to truncate to, not null + @return a {@code LocalTime} based on this time with the time truncated, not null + @throws DateTimeException if unable to truncate + @throws UnsupportedTemporalTypeException if the unit is not supported" + {:arglists (quote (["java.time.LocalTime" + "java.time.temporal.TemporalUnit"]))} + (^js/JSJoda.LocalTime [^js/JSJoda.LocalTime this ^js/JSJoda.TemporalUnit unit] + (.truncatedTo this unit))) + +(defn range + "Gets the range of valid values for the specified field. + + The range object expresses the minimum and maximum valid values for a field. + This time is used to enhance the accuracy of the returned range. + If it is not possible to return the range, because the field is not supported + or for some other reason, an exception is thrown. + + If the field is a {@link ChronoField} then the query is implemented here. + The {@link #isSupported(TemporalField) supported fields} will return + appropriate range instances. + All other {@code ChronoField} instances will throw an {@code UnsupportedTemporalTypeException}. + + If the field is not a {@code ChronoField}, then the result of this method + is obtained by invoking {@code TemporalField.rangeRefinedBy(TemporalAccessor)} + passing {@code this} as the argument. + Whether the range can be obtained is determined by the field. + + @param field the field to query the range for, not null + @return the range of valid values for the field, not null + @throws DateTimeException if the range for the field cannot be obtained + @throws UnsupportedTemporalTypeException if the field is not supported" + {:arglists (quote (["java.time.LocalTime" + "java.time.temporal.TemporalField"]))} + (^js/JSJoda.ValueRange + [^js/JSJoda.LocalTime this ^js/JSJoda.TemporalField field] + (.range this field))) + +(defn get-hour + "Gets the hour-of-day field. + + @return the hour-of-day, from 0 to 23" + {:arglists (quote (["java.time.LocalTime"]))} + (^int [^js/JSJoda.LocalTime this] (.hour this))) + +(defn at-offset + "Combines this time with an offset to create an {@code OffsetTime}. + + This returns an {@code OffsetTime} formed from this time at the specified offset. + All possible combinations of time and offset are valid. + + @param offset the offset to combine with, not null + @return the offset time formed from this time and the specified offset, not null" + {:arglists (quote (["java.time.LocalTime" "java.time.ZoneOffset"]))} + (^js/JSJoda.OffsetTime + [^js/JSJoda.LocalTime this ^js/JSJoda.ZoneOffset offset] + (.atOffset this offset))) + +(defn minus-hours + "Returns a copy of this {@code LocalTime} with the specified number of hours subtracted. + + This subtracts the specified number of hours from this time, returning a new time. + The calculation wraps around midnight. + + This instance is immutable and unaffected by this method call. + + @param hoursToSubtract the hours to subtract, may be negative + @return a {@code LocalTime} based on this time with the hours subtracted, not null" + {:arglists (quote (["java.time.LocalTime" "long"]))} + (^js/JSJoda.LocalTime [^js/JSJoda.LocalTime this ^long hours-to-subtract] + (.minusHours this hours-to-subtract))) + +(defn of + {:arglists (quote + (["int" "int"] ["int" "int" "int"] ["int" "int" "int" "int"]))} + (^js/JSJoda.LocalTime [^int hour ^int minute] + (js-invoke java.time.LocalTime "of" hour minute)) + (^js/JSJoda.LocalTime [^int hour ^int minute ^int second] + (js-invoke java.time.LocalTime "of" hour minute second)) + (^js/JSJoda.LocalTime [^int hour ^int minute ^int second ^int nano-of-second] + (js-invoke java.time.LocalTime "of" hour minute second nano-of-second))) + +(defn get-nano + "Gets the nano-of-second field. + + @return the nano-of-second, from 0 to 999,999,999" + {:arglists (quote (["java.time.LocalTime"]))} + (^int [^js/JSJoda.LocalTime this] (.nano this))) + +(defn minus-seconds + "Returns a copy of this {@code LocalTime} with the specified number of seconds subtracted. + + This subtracts the specified number of seconds from this time, returning a new time. + The calculation wraps around midnight. + + This instance is immutable and unaffected by this method call. + + @param secondsToSubtract the seconds to subtract, may be negative + @return a {@code LocalTime} based on this time with the seconds subtracted, not null" + {:arglists (quote (["java.time.LocalTime" "long"]))} + (^js/JSJoda.LocalTime [^js/JSJoda.LocalTime this ^long seconds-to-subtract] + (.minusSeconds this seconds-to-subtract))) + +(defn get-second + "Gets the second-of-minute field. + + @return the second-of-minute, from 0 to 59" + {:arglists (quote (["java.time.LocalTime"]))} + (^int [^js/JSJoda.LocalTime this] (.second this))) + +(defn plus-nanos + "Returns a copy of this {@code LocalTime} with the specified number of nanoseconds added. + + This adds the specified number of nanoseconds to this time, returning a new time. + The calculation wraps around midnight. + + This instance is immutable and unaffected by this method call. + + @param nanosToAdd the nanos to add, may be negative + @return a {@code LocalTime} based on this time with the nanoseconds added, not null" + {:arglists (quote (["java.time.LocalTime" "long"]))} + (^js/JSJoda.LocalTime [^js/JSJoda.LocalTime this ^long nanos-to-add] + (.plusNanos this nanos-to-add))) + +(defn plus + {:arglists (quote (["java.time.LocalTime" "java.time.temporal.TemporalAmount"] + ["java.time.LocalTime" "long" + "java.time.temporal.TemporalUnit"]))} + (^js/JSJoda.LocalTime + [^js/JSJoda.LocalTime this ^js/JSJoda.TemporalAmount amount-to-add] + (.plus this amount-to-add)) + (^js/JSJoda.LocalTime + [^js/JSJoda.LocalTime this ^long amount-to-add ^js/JSJoda.TemporalUnit unit] + (.plus this amount-to-add unit))) + +(defn with-hour + "Returns a copy of this {@code LocalTime} with the hour-of-day altered. + + This instance is immutable and unaffected by this method call. + + @param hour the hour-of-day to set in the result, from 0 to 23 + @return a {@code LocalTime} based on this time with the requested hour, not null + @throws DateTimeException if the hour value is invalid" + {:arglists (quote (["java.time.LocalTime" "int"]))} + (^js/JSJoda.LocalTime [^js/JSJoda.LocalTime this ^int hour] + (.withHour this hour))) + +(defn with-minute + "Returns a copy of this {@code LocalTime} with the minute-of-hour altered. + + This instance is immutable and unaffected by this method call. + + @param minute the minute-of-hour to set in the result, from 0 to 59 + @return a {@code LocalTime} based on this time with the requested minute, not null + @throws DateTimeException if the minute value is invalid" + {:arglists (quote (["java.time.LocalTime" "int"]))} + (^js/JSJoda.LocalTime [^js/JSJoda.LocalTime this ^int minute] + (.withMinute this minute))) + +(defn plus-minutes + "Returns a copy of this {@code LocalTime} with the specified number of minutes added. + + This adds the specified number of minutes to this time, returning a new time. + The calculation wraps around midnight. + + This instance is immutable and unaffected by this method call. + + @param minutesToAdd the minutes to add, may be negative + @return a {@code LocalTime} based on this time with the minutes added, not null" + {:arglists (quote (["java.time.LocalTime" "long"]))} + (^js/JSJoda.LocalTime [^js/JSJoda.LocalTime this ^long minutes-to-add] + (.plusMinutes this minutes-to-add))) + +(defn query + "Queries this time using the specified query. + + This queries this time using the specified query strategy object. + The {@code TemporalQuery} object defines the logic to be used to + obtain the result. Read the documentation of the query to understand + what the result of this method will be. + + The result of this method is obtained by invoking the + {@link TemporalQuery#queryFrom(TemporalAccessor)} method on the + specified query passing {@code this} as the argument. + + @param the type of the result + @param query the query to invoke, not null + @return the query result, null may be returned (defined by the query) + @throws DateTimeException if unable to query (defined by the query) + @throws ArithmeticException if numeric overflow occurs (defined by the query)" + {:arglists (quote (["java.time.LocalTime" + "java.time.temporal.TemporalQuery"]))} + (^java.lang.Object [^js/JSJoda.LocalTime this ^js/JSJoda.TemporalQuery query] + (.query this query))) + +(defn at-date + "Combines this time with a date to create a {@code LocalDateTime}. + + This returns a {@code LocalDateTime} formed from this time at the specified date. + All possible combinations of date and time are valid. + + @param date the date to combine with, not null + @return the local date-time formed from this time and the specified date, not null" + {:arglists (quote (["java.time.LocalTime" "java.time.LocalDate"]))} + (^js/JSJoda.LocalDateTime + [^js/JSJoda.LocalTime this ^js/JSJoda.LocalDate date] + (.atDate this date))) + +(defn to-string + "Outputs this time as a {@code String}, such as {@code 10:15}. + + The output will be one of the following ISO-8601 formats: +
    +
  • {@code HH:mm}
  • +
  • {@code HH:mm:ss}
  • +
  • {@code HH:mm:ss.SSS}
  • +
  • {@code HH:mm:ss.SSSSSS}
  • +
  • {@code HH:mm:ss.SSSSSSSSS}
  • +
+ The format used will be the shortest that outputs the full value of + the time where the omitted parts are implied to be zero. + + @return a string representation of this time, not null" + {:arglists (quote (["java.time.LocalTime"]))} + (^java.lang.String [^js/JSJoda.LocalTime this] (.toString this))) + +(defn is-before + "Checks if this time is before the specified time. + + The comparison is based on the time-line position of the time within a day. + + @param other the other time to compare to, not null + @return true if this point is before the specified time + @throws NullPointerException if {@code other} is null" + {:arglists (quote (["java.time.LocalTime" "java.time.LocalTime"]))} + (^boolean [^js/JSJoda.LocalTime this ^js/JSJoda.LocalTime other] + (.isBefore this other))) + +(defn minus + {:arglists (quote (["java.time.LocalTime" "java.time.temporal.TemporalAmount"] + ["java.time.LocalTime" "long" + "java.time.temporal.TemporalUnit"]))} + (^js/JSJoda.LocalTime + [^js/JSJoda.LocalTime this ^js/JSJoda.TemporalAmount amount-to-subtract] + (.minus this amount-to-subtract)) + (^js/JSJoda.LocalTime + [^js/JSJoda.LocalTime this ^long amount-to-subtract + ^js/JSJoda.TemporalUnit unit] + (.minus this amount-to-subtract unit))) + +(defn plus-hours + "Returns a copy of this {@code LocalTime} with the specified number of hours added. + + This adds the specified number of hours to this time, returning a new time. + The calculation wraps around midnight. + + This instance is immutable and unaffected by this method call. + + @param hoursToAdd the hours to add, may be negative + @return a {@code LocalTime} based on this time with the hours added, not null" + {:arglists (quote (["java.time.LocalTime" "long"]))} + (^js/JSJoda.LocalTime [^js/JSJoda.LocalTime this ^long hours-to-add] + (.plusHours this hours-to-add))) + +(defn to-second-of-day + "Extracts the time as seconds of day, + from {@code 0} to {@code 24 * 60 * 60 - 1}. + + @return the second-of-day equivalent to this time" + {:arglists (quote (["java.time.LocalTime"]))} + (^int [^js/JSJoda.LocalTime this] (.toSecondOfDay this))) + +(defn get-long + "Gets the value of the specified field from this time as a {@code long}. + + This queries this time for the value of the specified field. + If it is not possible to return the value, because the field is not supported + or for some other reason, an exception is thrown. + + If the field is a {@link ChronoField} then the query is implemented here. + The {@link #isSupported(TemporalField) supported fields} will return valid + values based on this time. + All other {@code ChronoField} instances will throw an {@code UnsupportedTemporalTypeException}. + + If the field is not a {@code ChronoField}, then the result of this method + is obtained by invoking {@code TemporalField.getFrom(TemporalAccessor)} + passing {@code this} as the argument. Whether the value can be obtained, + and what the value represents, is determined by the field. + + @param field the field to get, not null + @return the value for the field + @throws DateTimeException if a value for the field cannot be obtained + @throws UnsupportedTemporalTypeException if the field is not supported + @throws ArithmeticException if numeric overflow occurs" + {:arglists (quote (["java.time.LocalTime" + "java.time.temporal.TemporalField"]))} + (^long [^js/JSJoda.LocalTime this ^js/JSJoda.TemporalField field] + (.getLong this field))) + +(defn with-nano + "Returns a copy of this {@code LocalTime} with the nano-of-second altered. + + This instance is immutable and unaffected by this method call. + + @param nanoOfSecond the nano-of-second to set in the result, from 0 to 999,999,999 + @return a {@code LocalTime} based on this time with the requested nanosecond, not null + @throws DateTimeException if the nanos value is invalid" + {:arglists (quote (["java.time.LocalTime" "int"]))} + (^js/JSJoda.LocalTime [^js/JSJoda.LocalTime this ^int nano-of-second] + (.withNano this nano-of-second))) + +(defn until + "Calculates the amount of time until another time in terms of the specified unit. + + This calculates the amount of time between two {@code LocalTime} + objects in terms of a single {@code TemporalUnit}. + The start and end points are {@code this} and the specified time. + The result will be negative if the end is before the start. + The {@code Temporal} passed to this method is converted to a + {@code LocalTime} using {@link #from(TemporalAccessor)}. + For example, the amount in hours between two times can be calculated + using {@code startTime.until(endTime, HOURS)}. + + The calculation returns a whole number, representing the number of + complete units between the two times. + For example, the amount in hours between 11:30 and 13:29 will only + be one hour as it is one minute short of two hours. + + There are two equivalent ways of using this method. + The first is to invoke this method. + The second is to use {@link TemporalUnit#between(Temporal, Temporal)}: +
+   // these two lines are equivalent
+   amount = start.until(end, MINUTES);
+   amount = MINUTES.between(start, end);
+ 
+ The choice should be made based on which makes the code more readable. + + The calculation is implemented in this method for {@link ChronoUnit}. + The units {@code NANOS}, {@code MICROS}, {@code MILLIS}, {@code SECONDS}, + {@code MINUTES}, {@code HOURS} and {@code HALF_DAYS} are supported. + Other {@code ChronoUnit} values will throw an exception. + + If the unit is not a {@code ChronoUnit}, then the result of this method + is obtained by invoking {@code TemporalUnit.between(Temporal, Temporal)} + passing {@code this} as the first argument and the converted input temporal + as the second argument. + + This instance is immutable and unaffected by this method call. + + @param endExclusive the end time, exclusive, which is converted to a {@code LocalTime}, not null + @param unit the unit to measure the amount in, not null + @return the amount of time between this time and the end time + @throws DateTimeException if the amount cannot be calculated, or the end + temporal cannot be converted to a {@code LocalTime} + @throws UnsupportedTemporalTypeException if the unit is not supported + @throws ArithmeticException if numeric overflow occurs" + {:arglists (quote (["java.time.LocalTime" "java.time.temporal.Temporal" + "java.time.temporal.TemporalUnit"]))} + (^long + [^js/JSJoda.LocalTime this ^js/JSJoda.Temporal end-exclusive + ^js/JSJoda.TemporalUnit unit] + (.until this end-exclusive unit))) + +(defn of-nano-of-day + "Obtains an instance of {@code LocalTime} from a nanos-of-day value. + + This returns a {@code LocalTime} with the specified nanosecond-of-day. + + @param nanoOfDay the nano of day, from {@code 0} to {@code 24 * 60 * 60 * 1,000,000,000 - 1} + @return the local time, not null + @throws DateTimeException if the nanos of day value is invalid" + {:arglists (quote (["long"]))} + (^js/JSJoda.LocalTime [^long nano-of-day] + (js-invoke java.time.LocalTime "ofNanoOfDay" nano-of-day))) + +(defn from + "Obtains an instance of {@code LocalTime} from a temporal object. + + This obtains a local time based on the specified temporal. + A {@code TemporalAccessor} represents an arbitrary set of date and time information, + which this factory converts to an instance of {@code LocalTime}. + + The conversion uses the {@link TemporalQueries#localTime()} query, which relies + on extracting the {@link ChronoField#NANO_OF_DAY NANO_OF_DAY} field. + + This method matches the signature of the functional interface {@link TemporalQuery} + allowing it to be used as a query via method reference, {@code LocalTime::from}. + + @param temporal the temporal object to convert, not null + @return the local time, not null + @throws DateTimeException if unable to convert to a {@code LocalTime}" + {:arglists (quote (["java.time.temporal.TemporalAccessor"]))} + (^js/JSJoda.LocalTime [^js/JSJoda.TemporalAccessor temporal] + (js-invoke java.time.LocalTime "from" temporal))) + +(defn is-after + "Checks if this time is after the specified time. + + The comparison is based on the time-line position of the time within a day. + + @param other the other time to compare to, not null + @return true if this is after the specified time + @throws NullPointerException if {@code other} is null" + {:arglists (quote (["java.time.LocalTime" "java.time.LocalTime"]))} + (^boolean [^js/JSJoda.LocalTime this ^js/JSJoda.LocalTime other] + (.isAfter this other))) + +(defn minus-nanos + "Returns a copy of this {@code LocalTime} with the specified number of nanoseconds subtracted. + + This subtracts the specified number of nanoseconds from this time, returning a new time. + The calculation wraps around midnight. + + This instance is immutable and unaffected by this method call. + + @param nanosToSubtract the nanos to subtract, may be negative + @return a {@code LocalTime} based on this time with the nanoseconds subtracted, not null" + {:arglists (quote (["java.time.LocalTime" "long"]))} + (^js/JSJoda.LocalTime [^js/JSJoda.LocalTime this ^long nanos-to-subtract] + (.minusNanos this nanos-to-subtract))) + +(defn is-supported + {:arglists (quote (["java.time.LocalTime" "java.time.temporal.TemporalField"] + ["java.time.LocalTime" + "java.time.temporal.TemporalUnit"]))} + (^boolean [^js/JSJoda.LocalTime this arg0] + (.isSupported ^js/JSJoda.LocalTime this arg0))) + +(defn parse + {:arglists (quote (["java.lang.CharSequence"] + ["java.lang.CharSequence" + "java.time.format.DateTimeFormatter"]))} + (^js/JSJoda.LocalTime [^java.lang.CharSequence text] + (js-invoke java.time.LocalTime "parse" text)) + (^js/JSJoda.LocalTime + [^java.lang.CharSequence text ^js/JSJoda.DateTimeFormatter formatter] + (js-invoke java.time.LocalTime "parse" text formatter))) + +(defn with-second + "Returns a copy of this {@code LocalTime} with the second-of-minute altered. + + This instance is immutable and unaffected by this method call. + + @param second the second-of-minute to set in the result, from 0 to 59 + @return a {@code LocalTime} based on this time with the requested second, not null + @throws DateTimeException if the second value is invalid" + {:arglists (quote (["java.time.LocalTime" "int"]))} + (^js/JSJoda.LocalTime [^js/JSJoda.LocalTime this ^int second] + (.withSecond this second))) + +(defn get-minute + "Gets the minute-of-hour field. + + @return the minute-of-hour, from 0 to 59" + {:arglists (quote (["java.time.LocalTime"]))} + (^int [^js/JSJoda.LocalTime this] (.minute this))) + +(defn hash-code + "A hash code for this time. + + @return a suitable hash code" + {:arglists (quote (["java.time.LocalTime"]))} + (^int [^js/JSJoda.LocalTime this] (.hashCode this))) + +(defn adjust-into + "Adjusts the specified temporal object to have the same time as this object. + + This returns a temporal object of the same observable type as the input + with the time changed to be the same as this. + + The adjustment is equivalent to using {@link Temporal#with(TemporalField, long)} + passing {@link ChronoField#NANO_OF_DAY} as the field. + + In most cases, it is clearer to reverse the calling pattern by using + {@link Temporal#with(TemporalAdjuster)}: +
+   // these two lines are equivalent, but the second approach is recommended
+   temporal = thisLocalTime.adjustInto(temporal);
+   temporal = temporal.with(thisLocalTime);
+ 
+ + This instance is immutable and unaffected by this method call. + + @param temporal the target object to be adjusted, not null + @return the adjusted object, not null + @throws DateTimeException if unable to make the adjustment + @throws ArithmeticException if numeric overflow occurs" + {:arglists (quote (["java.time.LocalTime" "java.time.temporal.Temporal"]))} + (^js/JSJoda.Temporal [^js/JSJoda.LocalTime this ^js/JSJoda.Temporal temporal] + (.adjustInto this temporal))) + +(defn with + {:arglists (quote (["java.time.LocalTime" + "java.time.temporal.TemporalAdjuster"] + ["java.time.LocalTime" "java.time.temporal.TemporalField" + "long"]))} + (^js/JSJoda.LocalTime + [^js/JSJoda.LocalTime this ^js/JSJoda.TemporalAdjuster adjuster] + (.with this adjuster)) + (^js/JSJoda.LocalTime + [^js/JSJoda.LocalTime this ^js/JSJoda.TemporalField field ^long new-value] + (.with this field new-value))) + +(defn now + {:arglists (quote ([] ["java.time.Clock"] ["java.time.ZoneId"]))} + (^js/JSJoda.LocalTime [] (js-invoke java.time.LocalTime "now")) + (^js/JSJoda.LocalTime [arg0] (js-invoke java.time.LocalTime "now" arg0))) + +(defn compare-to + "Compares this time to another time. + + The comparison is based on the time-line position of the local times within a day. + It is \"consistent with equals\", as defined by {@link Comparable}. + + @param other the other time to compare to, not null + @return the comparator value, negative if less, positive if greater + @throws NullPointerException if {@code other} is null" + {:arglists (quote (["java.time.LocalTime" "java.time.LocalTime"]))} + (^int [^js/JSJoda.LocalTime this ^js/JSJoda.LocalTime other] + (.compareTo this other))) + +(defn to-nano-of-day + "Extracts the time as nanos of day, + from {@code 0} to {@code 24 * 60 * 60 * 1,000,000,000 - 1}. + + @return the nano of day equivalent to this time" + {:arglists (quote (["java.time.LocalTime"]))} + (^long [^js/JSJoda.LocalTime this] (.toNanoOfDay this))) + +(defn plus-seconds + "Returns a copy of this {@code LocalTime} with the specified number of seconds added. + + This adds the specified number of seconds to this time, returning a new time. + The calculation wraps around midnight. + + This instance is immutable and unaffected by this method call. + + @param secondstoAdd the seconds to add, may be negative + @return a {@code LocalTime} based on this time with the seconds added, not null" + {:arglists (quote (["java.time.LocalTime" "long"]))} + (^js/JSJoda.LocalTime [^js/JSJoda.LocalTime this ^long secondsto-add] + (.plusSeconds this secondsto-add))) + +(defn get + "Gets the value of the specified field from this time as an {@code int}. + + This queries this time for the value of the specified field. + The returned value will always be within the valid range of values for the field. + If it is not possible to return the value, because the field is not supported + or for some other reason, an exception is thrown. + + If the field is a {@link ChronoField} then the query is implemented here. + The {@link #isSupported(TemporalField) supported fields} will return valid + values based on this time, except {@code NANO_OF_DAY} and {@code MICRO_OF_DAY} + which are too large to fit in an {@code int} and throw a {@code DateTimeException}. + All other {@code ChronoField} instances will throw an {@code UnsupportedTemporalTypeException}. + + If the field is not a {@code ChronoField}, then the result of this method + is obtained by invoking {@code TemporalField.getFrom(TemporalAccessor)} + passing {@code this} as the argument. Whether the value can be obtained, + and what the value represents, is determined by the field. + + @param field the field to get, not null + @return the value for the field + @throws DateTimeException if a value for the field cannot be obtained or + the value is outside the range of valid values for the field + @throws UnsupportedTemporalTypeException if the field is not supported or + the range of values exceeds an {@code int} + @throws ArithmeticException if numeric overflow occurs" + {:arglists (quote (["java.time.LocalTime" + "java.time.temporal.TemporalField"]))} + (^int [^js/JSJoda.LocalTime this ^js/JSJoda.TemporalField field] + (.get this field))) + +(defn of-second-of-day + "Obtains an instance of {@code LocalTime} from a second-of-day value. + + This returns a {@code LocalTime} with the specified second-of-day. + The nanosecond field will be set to zero. + + @param secondOfDay the second-of-day, from {@code 0} to {@code 24 * 60 * 60 - 1} + @return the local time, not null + @throws DateTimeException if the second-of-day value is invalid" + {:arglists (quote (["long"]))} + (^js/JSJoda.LocalTime [^long second-of-day] + (js-invoke java.time.LocalTime "ofSecondOfDay" second-of-day))) + +(defn equals + "Checks if this time is equal to another time. + + The comparison is based on the time-line position of the time within a day. + + Only objects of type {@code LocalTime} are compared, other types return false. + To compare the date of two {@code TemporalAccessor} instances, use + {@link ChronoField#NANO_OF_DAY} as a comparator. + + @param obj the object to check, null returns false + @return true if this is equal to the other time" + {:arglists (quote (["java.time.LocalTime" "java.lang.Object"]))} + (^boolean [^js/JSJoda.LocalTime this ^java.lang.Object obj] + (.equals this obj))) + +(defn format + "Formats this time using the specified formatter. + + This time will be passed to the formatter to produce a string. + + @param formatter the formatter to use, not null + @return the formatted time string, not null + @throws DateTimeException if an error occurs during printing" + {:arglists (quote (["java.time.LocalTime" + "java.time.format.DateTimeFormatter"]))} + (^java.lang.String + [^js/JSJoda.LocalTime this ^js/JSJoda.DateTimeFormatter formatter] + (.format this formatter))) diff --git a/src/cljc/java_time/month.clj b/src/cljc/java_time/month.clj index f1eb31d..5b686e3 100644 --- a/src/cljc/java_time/month.clj +++ b/src/cljc/java_time/month.clj @@ -1,39 +1,473 @@ -(ns cljc.java-time.month (:refer-clojure :exclude [abs get range format min max next name resolve short]) (:require [cljc.java-time.extn.calendar-awareness]) (:import [java.time Month])) -(def may java.time.Month/MAY) -(def december java.time.Month/DECEMBER) -(def june java.time.Month/JUNE) -(def september java.time.Month/SEPTEMBER) -(def february java.time.Month/FEBRUARY) -(def january java.time.Month/JANUARY) -(def november java.time.Month/NOVEMBER) -(def august java.time.Month/AUGUST) -(def july java.time.Month/JULY) -(def march java.time.Month/MARCH) -(def october java.time.Month/OCTOBER) -(def april java.time.Month/APRIL) -(clojure.core/defn range {:arglists (quote (["java.time.Month" "java.time.temporal.TemporalField"]))} (^java.time.temporal.ValueRange [^java.time.Month this14762 ^java.time.temporal.TemporalField java-time-temporal-TemporalField14763] (.range this14762 java-time-temporal-TemporalField14763))) -(clojure.core/defn values {:arglists (quote ([]))} (^"java.lang.Class" [] (java.time.Month/values))) -(clojure.core/defn value-of {:arglists (quote (["java.lang.String"] ["java.lang.Class" "java.lang.String"]))} (^java.time.Month [^java.lang.String java-lang-String14764] (java.time.Month/valueOf java-lang-String14764)) (^java.lang.Enum [^java.lang.Class java-lang-Class14765 ^java.lang.String java-lang-String14766] (java.time.Month/valueOf java-lang-Class14765 java-lang-String14766))) -(clojure.core/defn of {:arglists (quote (["int"]))} (^java.time.Month [^java.lang.Integer int14767] (java.time.Month/of int14767))) -(clojure.core/defn ordinal {:arglists (quote (["java.time.Month"]))} (^java.lang.Integer [^java.time.Month this14768] (.ordinal this14768))) -(clojure.core/defn first-month-of-quarter {:arglists (quote (["java.time.Month"]))} (^java.time.Month [^java.time.Month this14769] (.firstMonthOfQuarter this14769))) -(clojure.core/defn min-length {:arglists (quote (["java.time.Month"]))} (^java.lang.Integer [^java.time.Month this14770] (.minLength this14770))) -(clojure.core/defn plus {:arglists (quote (["java.time.Month" "long"]))} (^java.time.Month [^java.time.Month this14771 ^long long14772] (.plus this14771 long14772))) -(clojure.core/defn query {:arglists (quote (["java.time.Month" "java.time.temporal.TemporalQuery"]))} (^java.lang.Object [^java.time.Month this14773 ^java.time.temporal.TemporalQuery java-time-temporal-TemporalQuery14774] (.query this14773 java-time-temporal-TemporalQuery14774))) -(clojure.core/defn to-string {:arglists (quote (["java.time.Month"]))} (^java.lang.String [^java.time.Month this14775] (.toString this14775))) -(clojure.core/defn first-day-of-year {:arglists (quote (["java.time.Month" "boolean"]))} (^java.lang.Integer [^java.time.Month this14776 ^java.lang.Boolean boolean14777] (.firstDayOfYear this14776 boolean14777))) -(clojure.core/defn minus {:arglists (quote (["java.time.Month" "long"]))} (^java.time.Month [^java.time.Month this14778 ^long long14779] (.minus this14778 long14779))) -(clojure.core/defn get-display-name {:arglists (quote (["java.time.Month" "java.time.format.TextStyle" "java.util.Locale"]))} (^java.lang.String [^java.time.Month this14780 ^java.time.format.TextStyle java-time-format-TextStyle14781 ^java.util.Locale java-util-Locale14782] (.getDisplayName this14780 java-time-format-TextStyle14781 java-util-Locale14782))) -(clojure.core/defn get-value {:arglists (quote (["java.time.Month"]))} (^java.lang.Integer [^java.time.Month this14783] (.getValue this14783))) -(clojure.core/defn max-length {:arglists (quote (["java.time.Month"]))} (^java.lang.Integer [^java.time.Month this14784] (.maxLength this14784))) -(clojure.core/defn name {:arglists (quote (["java.time.Month"]))} (^java.lang.String [^java.time.Month this14785] (.name this14785))) -(clojure.core/defn get-long {:arglists (quote (["java.time.Month" "java.time.temporal.TemporalField"]))} (^long [^java.time.Month this14786 ^java.time.temporal.TemporalField java-time-temporal-TemporalField14787] (.getLong this14786 java-time-temporal-TemporalField14787))) -(clojure.core/defn length {:arglists (quote (["java.time.Month" "boolean"]))} (^java.lang.Integer [^java.time.Month this14788 ^java.lang.Boolean boolean14789] (.length this14788 boolean14789))) -(clojure.core/defn get-declaring-class {:arglists (quote (["java.time.Month"]))} (^java.lang.Class [^java.time.Month this14790] (.getDeclaringClass this14790))) -(clojure.core/defn from {:arglists (quote (["java.time.temporal.TemporalAccessor"]))} (^java.time.Month [^java.time.temporal.TemporalAccessor java-time-temporal-TemporalAccessor14791] (java.time.Month/from java-time-temporal-TemporalAccessor14791))) -(clojure.core/defn is-supported {:arglists (quote (["java.time.Month" "java.time.temporal.TemporalField"]))} (^java.lang.Boolean [^java.time.Month this14792 ^java.time.temporal.TemporalField java-time-temporal-TemporalField14793] (.isSupported this14792 java-time-temporal-TemporalField14793))) -(clojure.core/defn hash-code {:arglists (quote (["java.time.Month"]))} (^java.lang.Integer [^java.time.Month this14794] (.hashCode this14794))) -(clojure.core/defn adjust-into {:arglists (quote (["java.time.Month" "java.time.temporal.Temporal"]))} (^java.time.temporal.Temporal [^java.time.Month this14795 ^java.time.temporal.Temporal java-time-temporal-Temporal14796] (.adjustInto this14795 java-time-temporal-Temporal14796))) -(clojure.core/defn compare-to {:arglists (quote (["java.time.Month" "java.lang.Enum"]))} (^java.lang.Integer [^java.time.Month this14797 ^java.lang.Enum java-lang-Enum14798] (.compareTo this14797 java-lang-Enum14798))) -(clojure.core/defn get {:arglists (quote (["java.time.Month" "java.time.temporal.TemporalField"]))} (^java.lang.Integer [^java.time.Month this14799 ^java.time.temporal.TemporalField java-time-temporal-TemporalField14800] (.get this14799 java-time-temporal-TemporalField14800))) -(clojure.core/defn equals {:arglists (quote (["java.time.Month" "java.lang.Object"]))} (^java.lang.Boolean [^java.time.Month this14801 ^java.lang.Object java-lang-Object14802] (.equals this14801 java-lang-Object14802))) +(ns cljc.java-time.month + (:refer-clojure :exclude + [abs get range format min max next name resolve short]) + (:require [cljc.java-time.extn.calendar-awareness]) + (:import [java.time Month])) + +(def may + "The singleton instance for the month of May with 31 days. + This has the numeric value of {@code 5}." + java.time.Month/MAY) + +(def december + "The singleton instance for the month of December with 31 days. + This has the numeric value of {@code 12}." + java.time.Month/DECEMBER) + +(def june + "The singleton instance for the month of June with 30 days. + This has the numeric value of {@code 6}." + java.time.Month/JUNE) + +(def september + "The singleton instance for the month of September with 30 days. + This has the numeric value of {@code 9}." + java.time.Month/SEPTEMBER) + +(def february + "The singleton instance for the month of February with 28 days, or 29 in a leap year. + This has the numeric value of {@code 2}." + java.time.Month/FEBRUARY) + +(def january + "The singleton instance for the month of January with 31 days. + This has the numeric value of {@code 1}." + java.time.Month/JANUARY) + +(def november + "The singleton instance for the month of November with 30 days. + This has the numeric value of {@code 11}." + java.time.Month/NOVEMBER) + +(def august + "The singleton instance for the month of August with 31 days. + This has the numeric value of {@code 8}." + java.time.Month/AUGUST) + +(def july + "The singleton instance for the month of July with 31 days. + This has the numeric value of {@code 7}." + java.time.Month/JULY) + +(def march + "The singleton instance for the month of March with 31 days. + This has the numeric value of {@code 3}." + java.time.Month/MARCH) + +(def october + "The singleton instance for the month of October with 31 days. + This has the numeric value of {@code 10}." + java.time.Month/OCTOBER) + +(def april + "The singleton instance for the month of April with 30 days. + This has the numeric value of {@code 4}." + java.time.Month/APRIL) + +(defn range + "Gets the range of valid values for the specified field. + + The range object expresses the minimum and maximum valid values for a field. + This month is used to enhance the accuracy of the returned range. + If it is not possible to return the range, because the field is not supported + or for some other reason, an exception is thrown. + + If the field is {@link ChronoField#MONTH_OF_YEAR MONTH_OF_YEAR} then the + range of the month-of-year, from 1 to 12, will be returned. + All other {@code ChronoField} instances will throw an {@code UnsupportedTemporalTypeException}. + + If the field is not a {@code ChronoField}, then the result of this method + is obtained by invoking {@code TemporalField.rangeRefinedBy(TemporalAccessor)} + passing {@code this} as the argument. + Whether the range can be obtained is determined by the field. + + @param field the field to query the range for, not null + @return the range of valid values for the field, not null + @throws DateTimeException if the range for the field cannot be obtained + @throws UnsupportedTemporalTypeException if the field is not supported" + {:arglists (quote (["java.time.Month" "java.time.temporal.TemporalField"]))} + (^java.time.temporal.ValueRange + [^java.time.Month this ^java.time.temporal.TemporalField field] + (.range this field))) + +(defn values + {:arglists (quote ([]))} + (^"java.lang.Class" [] (java.time.Month/values))) + +(defn value-of + {:arglists (quote (["java.lang.String"] + ["java.lang.Class" "java.lang.String"]))} + (^java.time.Month [^java.lang.String name] (java.time.Month/valueOf name)) + (^java.lang.Enum [^java.lang.Class enum-type ^java.lang.String name] + (java.time.Month/valueOf enum-type name))) + +(defn of + "Obtains an instance of {@code Month} from an {@code int} value. + + {@code Month} is an enum representing the 12 months of the year. + This factory allows the enum to be obtained from the {@code int} value. + The {@code int} value follows the ISO-8601 standard, from 1 (January) to 12 (December). + + @param month the month-of-year to represent, from 1 (January) to 12 (December) + @return the month-of-year, not null + @throws DateTimeException if the month-of-year is invalid" + {:arglists (quote (["int"]))} + (^java.time.Month [^java.lang.Integer month] (java.time.Month/of month))) + +(defn ordinal + "Returns the ordinal of this enumeration constant (its position + in its enum declaration, where the initial constant is assigned + an ordinal of zero). + + Most programmers will have no use for this method. It is + designed for use by sophisticated enum-based data structures, such + as {@link java.util.EnumSet} and {@link java.util.EnumMap}. + + @return the ordinal of this enumeration constant" + {:arglists (quote (["java.time.Month"]))} + (^java.lang.Integer [^java.time.Month this] (.ordinal this))) + +(defn first-month-of-quarter + "Gets the month corresponding to the first month of this quarter. + + The year can be divided into four quarters. + This method returns the first month of the quarter for the base month. + January, February and March return January. + April, May and June return April. + July, August and September return July. + October, November and December return October. + + @return the first month of the quarter corresponding to this month, not null" + {:arglists (quote (["java.time.Month"]))} + (^java.time.Month [^java.time.Month this] (.firstMonthOfQuarter this))) + +(defn min-length + "Gets the minimum length of this month in days. + + February has a minimum length of 28 days. + April, June, September and November have 30 days. + All other months have 31 days. + + @return the minimum length of this month in days, from 28 to 31" + {:arglists (quote (["java.time.Month"]))} + (^java.lang.Integer [^java.time.Month this] (.minLength this))) + +(defn plus + "Returns the month-of-year that is the specified number of quarters after this one. + + The calculation rolls around the end of the year from December to January. + The specified period may be negative. + + This instance is immutable and unaffected by this method call. + + @param months the months to add, positive or negative + @return the resulting month, not null" + {:arglists (quote (["java.time.Month" "long"]))} + (^java.time.Month [^java.time.Month this ^long months] (.plus this months))) + +(defn query + "Queries this month-of-year using the specified query. + + This queries this month-of-year using the specified query strategy object. + The {@code TemporalQuery} object defines the logic to be used to + obtain the result. Read the documentation of the query to understand + what the result of this method will be. + + The result of this method is obtained by invoking the + {@link TemporalQuery#queryFrom(TemporalAccessor)} method on the + specified query passing {@code this} as the argument. + + @param the type of the result + @param query the query to invoke, not null + @return the query result, null may be returned (defined by the query) + @throws DateTimeException if unable to query (defined by the query) + @throws ArithmeticException if numeric overflow occurs (defined by the query)" + {:arglists (quote (["java.time.Month" "java.time.temporal.TemporalQuery"]))} + (^java.lang.Object + [^java.time.Month this ^java.time.temporal.TemporalQuery query] + (.query this query))) + +(defn to-string + "Returns the name of this enum constant, as contained in the + declaration. This method may be overridden, though it typically + isn't necessary or desirable. An enum type should override this + method when a more \"programmer-friendly\" string form exists. + + @return the name of this enum constant" + {:arglists (quote (["java.time.Month"]))} + (^java.lang.String [^java.time.Month this] (.toString this))) + +(defn first-day-of-year + "Gets the day-of-year corresponding to the first day of this month. + + This returns the day-of-year that this month begins on, using the leap + year flag to determine the length of February. + + @param leapYear true if the length is required for a leap year + @return the day of year corresponding to the first day of this month, from 1 to 336" + {:arglists (quote (["java.time.Month" "boolean"]))} + (^java.lang.Integer [^java.time.Month this ^java.lang.Boolean leap-year] + (.firstDayOfYear this leap-year))) + +(defn minus + "Returns the month-of-year that is the specified number of months before this one. + + The calculation rolls around the start of the year from January to December. + The specified period may be negative. + + This instance is immutable and unaffected by this method call. + + @param months the months to subtract, positive or negative + @return the resulting month, not null" + {:arglists (quote (["java.time.Month" "long"]))} + (^java.time.Month [^java.time.Month this ^long months] (.minus this months))) + +(defn get-display-name + "Gets the textual representation, such as 'Jan' or 'December'. + + This returns the textual name used to identify the month-of-year, + suitable for presentation to the user. + The parameters control the style of the returned text and the locale. + + If no textual mapping is found then the {@link #getValue() numeric value} is returned. + + @param style the length of the text required, not null + @param locale the locale to use, not null + @return the text value of the month-of-year, not null" + {:arglists (quote (["java.time.Month" "java.time.format.TextStyle" + "java.util.Locale"]))} + (^java.lang.String + [^java.time.Month this ^java.time.format.TextStyle style + ^java.util.Locale locale] + (.getDisplayName this style locale))) + +(defn get-value + "Gets the month-of-year {@code int} value. + + The values are numbered following the ISO-8601 standard, + from 1 (January) to 12 (December). + + @return the month-of-year, from 1 (January) to 12 (December)" + {:arglists (quote (["java.time.Month"]))} + (^java.lang.Integer [^java.time.Month this] (.getValue this))) + +(defn max-length + "Gets the maximum length of this month in days. + + February has a maximum length of 29 days. + April, June, September and November have 30 days. + All other months have 31 days. + + @return the maximum length of this month in days, from 29 to 31" + {:arglists (quote (["java.time.Month"]))} + (^java.lang.Integer [^java.time.Month this] (.maxLength this))) + +(defn name + "Returns the name of this enum constant, exactly as declared in its + enum declaration. + + Most programmers should use the {@link #toString} method in + preference to this one, as the toString method may return + a more user-friendly name. This method is designed primarily for + use in specialized situations where correctness depends on getting the + exact name, which will not vary from release to release. + + @return the name of this enum constant" + {:arglists (quote (["java.time.Month"]))} + (^java.lang.String [^java.time.Month this] (.name this))) + +(defn get-long + "Gets the value of the specified field from this month-of-year as a {@code long}. + + This queries this month for the value of the specified field. + If it is not possible to return the value, because the field is not supported + or for some other reason, an exception is thrown. + + If the field is {@link ChronoField#MONTH_OF_YEAR MONTH_OF_YEAR} then the + value of the month-of-year, from 1 to 12, will be returned. + All other {@code ChronoField} instances will throw an {@code UnsupportedTemporalTypeException}. + + If the field is not a {@code ChronoField}, then the result of this method + is obtained by invoking {@code TemporalField.getFrom(TemporalAccessor)} + passing {@code this} as the argument. Whether the value can be obtained, + and what the value represents, is determined by the field. + + @param field the field to get, not null + @return the value for the field + @throws DateTimeException if a value for the field cannot be obtained + @throws UnsupportedTemporalTypeException if the field is not supported + @throws ArithmeticException if numeric overflow occurs" + {:arglists (quote (["java.time.Month" "java.time.temporal.TemporalField"]))} + (^long [^java.time.Month this ^java.time.temporal.TemporalField field] + (.getLong this field))) + +(defn length + "Gets the length of this month in days. + + This takes a flag to determine whether to return the length for a leap year or not. + + February has 28 days in a standard year and 29 days in a leap year. + April, June, September and November have 30 days. + All other months have 31 days. + + @param leapYear true if the length is required for a leap year + @return the length of this month in days, from 28 to 31" + {:arglists (quote (["java.time.Month" "boolean"]))} + (^java.lang.Integer [^java.time.Month this ^java.lang.Boolean leap-year] + (.length this leap-year))) + +(defn get-declaring-class + "Returns the Class object corresponding to this enum constant's + enum type. Two enum constants e1 and e2 are of the + same enum type if and only if + e1.getDeclaringClass() == e2.getDeclaringClass(). + (The value returned by this method may differ from the one returned + by the {@link Object#getClass} method for enum constants with + constant-specific class bodies.) + + @return the Class object corresponding to this enum constant's + enum type" + {:arglists (quote (["java.time.Month"]))} + (^java.lang.Class [^java.time.Month this] (.getDeclaringClass this))) + +(defn from + "Obtains an instance of {@code Month} from a temporal object. + + This obtains a month based on the specified temporal. + A {@code TemporalAccessor} represents an arbitrary set of date and time information, + which this factory converts to an instance of {@code Month}. + + The conversion extracts the {@link ChronoField#MONTH_OF_YEAR MONTH_OF_YEAR} field. + The extraction is only permitted if the temporal object has an ISO + chronology, or can be converted to a {@code LocalDate}. + + This method matches the signature of the functional interface {@link TemporalQuery} + allowing it to be used as a query via method reference, {@code Month::from}. + + @param temporal the temporal object to convert, not null + @return the month-of-year, not null + @throws DateTimeException if unable to convert to a {@code Month}" + {:arglists (quote (["java.time.temporal.TemporalAccessor"]))} + (^java.time.Month [^java.time.temporal.TemporalAccessor temporal] + (java.time.Month/from temporal))) + +(defn is-supported + "Checks if the specified field is supported. + + This checks if this month-of-year can be queried for the specified field. + If false, then calling the {@link #range(TemporalField) range} and + {@link #get(TemporalField) get} methods will throw an exception. + + If the field is {@link ChronoField#MONTH_OF_YEAR MONTH_OF_YEAR} then + this method returns true. + All other {@code ChronoField} instances will return false. + + If the field is not a {@code ChronoField}, then the result of this method + is obtained by invoking {@code TemporalField.isSupportedBy(TemporalAccessor)} + passing {@code this} as the argument. + Whether the field is supported is determined by the field. + + @param field the field to check, null returns false + @return true if the field is supported on this month-of-year, false if not" + {:arglists (quote (["java.time.Month" "java.time.temporal.TemporalField"]))} + (^java.lang.Boolean + [^java.time.Month this ^java.time.temporal.TemporalField field] + (.isSupported this field))) + +(defn hash-code + "Returns a hash code for this enum constant. + + @return a hash code for this enum constant." + {:arglists (quote (["java.time.Month"]))} + (^java.lang.Integer [^java.time.Month this] (.hashCode this))) + +(defn adjust-into + "Adjusts the specified temporal object to have this month-of-year. + + This returns a temporal object of the same observable type as the input + with the month-of-year changed to be the same as this. + + The adjustment is equivalent to using {@link Temporal#with(TemporalField, long)} + passing {@link ChronoField#MONTH_OF_YEAR} as the field. + If the specified temporal object does not use the ISO calendar system then + a {@code DateTimeException} is thrown. + + In most cases, it is clearer to reverse the calling pattern by using + {@link Temporal#with(TemporalAdjuster)}: +
+   // these two lines are equivalent, but the second approach is recommended
+   temporal = thisMonth.adjustInto(temporal);
+   temporal = temporal.with(thisMonth);
+ 
+ + For example, given a date in May, the following are output: +
+   dateInMay.with(JANUARY);    // four months earlier
+   dateInMay.with(APRIL);      // one months earlier
+   dateInMay.with(MAY);        // same date
+   dateInMay.with(JUNE);       // one month later
+   dateInMay.with(DECEMBER);   // seven months later
+ 
+ + This instance is immutable and unaffected by this method call. + + @param temporal the target object to be adjusted, not null + @return the adjusted object, not null + @throws DateTimeException if unable to make the adjustment + @throws ArithmeticException if numeric overflow occurs" + {:arglists (quote (["java.time.Month" "java.time.temporal.Temporal"]))} + (^java.time.temporal.Temporal + [^java.time.Month this ^java.time.temporal.Temporal temporal] + (.adjustInto this temporal))) + +(defn compare-to + "Compares this enum with the specified object for order. Returns a + negative integer, zero, or a positive integer as this object is less + than, equal to, or greater than the specified object. + + Enum constants are only comparable to other enum constants of the + same enum type. The natural order implemented by this + method is the order in which the constants are declared." + {:arglists (quote (["java.time.Month" "java.lang.Enum"]))} + (^java.lang.Integer [^java.time.Month this ^java.lang.Enum o] + (.compareTo this o))) + +(defn get + "Gets the value of the specified field from this month-of-year as an {@code int}. + + This queries this month for the value of the specified field. + The returned value will always be within the valid range of values for the field. + If it is not possible to return the value, because the field is not supported + or for some other reason, an exception is thrown. + + If the field is {@link ChronoField#MONTH_OF_YEAR MONTH_OF_YEAR} then the + value of the month-of-year, from 1 to 12, will be returned. + All other {@code ChronoField} instances will throw an {@code UnsupportedTemporalTypeException}. + + If the field is not a {@code ChronoField}, then the result of this method + is obtained by invoking {@code TemporalField.getFrom(TemporalAccessor)} + passing {@code this} as the argument. Whether the value can be obtained, + and what the value represents, is determined by the field. + + @param field the field to get, not null + @return the value for the field, within the valid range of values + @throws DateTimeException if a value for the field cannot be obtained or + the value is outside the range of valid values for the field + @throws UnsupportedTemporalTypeException if the field is not supported or + the range of values exceeds an {@code int} + @throws ArithmeticException if numeric overflow occurs" + {:arglists (quote (["java.time.Month" "java.time.temporal.TemporalField"]))} + (^java.lang.Integer + [^java.time.Month this ^java.time.temporal.TemporalField field] + (.get this field))) + +(defn equals + "Returns true if the specified object is equal to this + enum constant. + + @param other the object to be compared for equality with this object. + @return true if the specified object is equal to this + enum constant." + {:arglists (quote (["java.time.Month" "java.lang.Object"]))} + (^java.lang.Boolean [^java.time.Month this ^java.lang.Object other] + (.equals this other))) diff --git a/src/cljc/java_time/month.cljs b/src/cljc/java_time/month.cljs index 1f7e5c3..7f569fc 100644 --- a/src/cljc/java_time/month.cljs +++ b/src/cljc/java_time/month.cljs @@ -1,39 +1,467 @@ -(ns cljc.java-time.month (:refer-clojure :exclude [abs get range format min max next name resolve short]) (:require [cljc.java-time.extn.calendar-awareness] [goog.object] [java.time :refer [Month]])) -(def may (goog.object/get java.time.Month "MAY")) -(def december (goog.object/get java.time.Month "DECEMBER")) -(def june (goog.object/get java.time.Month "JUNE")) -(def september (goog.object/get java.time.Month "SEPTEMBER")) -(def february (goog.object/get java.time.Month "FEBRUARY")) -(def january (goog.object/get java.time.Month "JANUARY")) -(def november (goog.object/get java.time.Month "NOVEMBER")) -(def august (goog.object/get java.time.Month "AUGUST")) -(def july (goog.object/get java.time.Month "JULY")) -(def march (goog.object/get java.time.Month "MARCH")) -(def october (goog.object/get java.time.Month "OCTOBER")) -(def april (goog.object/get java.time.Month "APRIL")) -(clojure.core/defn range {:arglists (quote (["java.time.Month" "java.time.temporal.TemporalField"]))} (^js/JSJoda.ValueRange [^js/JSJoda.Month this14803 ^js/JSJoda.TemporalField java-time-temporal-TemporalField14804] (.range this14803 java-time-temporal-TemporalField14804))) -(clojure.core/defn values {:arglists (quote ([]))} (^"java.lang.Class" [] (js-invoke java.time.Month "values"))) -(clojure.core/defn value-of {:arglists (quote (["java.lang.String"] ["java.lang.Class" "java.lang.String"]))} (^js/JSJoda.Month [^java.lang.String java-lang-String14805] (js-invoke java.time.Month "valueOf" java-lang-String14805)) (^java.lang.Enum [^java.lang.Class java-lang-Class14806 ^java.lang.String java-lang-String14807] (js-invoke java.time.Month "valueOf" java-lang-Class14806 java-lang-String14807))) -(clojure.core/defn of {:arglists (quote (["int"]))} (^js/JSJoda.Month [^int int14808] (js-invoke java.time.Month "of" int14808))) -(clojure.core/defn ordinal {:arglists (quote (["java.time.Month"]))} (^int [^js/JSJoda.Month this14809] (.ordinal this14809))) -(clojure.core/defn first-month-of-quarter {:arglists (quote (["java.time.Month"]))} (^js/JSJoda.Month [^js/JSJoda.Month this14810] (.firstMonthOfQuarter this14810))) -(clojure.core/defn min-length {:arglists (quote (["java.time.Month"]))} (^int [^js/JSJoda.Month this14811] (.minLength this14811))) -(clojure.core/defn plus {:arglists (quote (["java.time.Month" "long"]))} (^js/JSJoda.Month [^js/JSJoda.Month this14812 ^long long14813] (.plus this14812 long14813))) -(clojure.core/defn query {:arglists (quote (["java.time.Month" "java.time.temporal.TemporalQuery"]))} (^java.lang.Object [^js/JSJoda.Month this14814 ^js/JSJoda.TemporalQuery java-time-temporal-TemporalQuery14815] (.query this14814 java-time-temporal-TemporalQuery14815))) -(clojure.core/defn to-string {:arglists (quote (["java.time.Month"]))} (^java.lang.String [^js/JSJoda.Month this14816] (.toString this14816))) -(clojure.core/defn first-day-of-year {:arglists (quote (["java.time.Month" "boolean"]))} (^int [^js/JSJoda.Month this14817 ^boolean boolean14818] (.firstDayOfYear this14817 boolean14818))) -(clojure.core/defn minus {:arglists (quote (["java.time.Month" "long"]))} (^js/JSJoda.Month [^js/JSJoda.Month this14819 ^long long14820] (.minus this14819 long14820))) -(clojure.core/defn get-display-name {:arglists (quote (["java.time.Month" "java.time.format.TextStyle" "java.util.Locale"]))} (^java.lang.String [^js/JSJoda.Month this14821 ^js/JSJoda.TextStyle java-time-format-TextStyle14822 ^java.util.Locale java-util-Locale14823] (.displayName this14821 java-time-format-TextStyle14822 java-util-Locale14823))) -(clojure.core/defn get-value {:arglists (quote (["java.time.Month"]))} (^int [^js/JSJoda.Month this14824] (.value this14824))) -(clojure.core/defn max-length {:arglists (quote (["java.time.Month"]))} (^int [^js/JSJoda.Month this14825] (.maxLength this14825))) -(clojure.core/defn name {:arglists (quote (["java.time.Month"]))} (^java.lang.String [^js/JSJoda.Month this14826] (.name this14826))) -(clojure.core/defn get-long {:arglists (quote (["java.time.Month" "java.time.temporal.TemporalField"]))} (^long [^js/JSJoda.Month this14827 ^js/JSJoda.TemporalField java-time-temporal-TemporalField14828] (.getLong this14827 java-time-temporal-TemporalField14828))) -(clojure.core/defn length {:arglists (quote (["java.time.Month" "boolean"]))} (^int [^js/JSJoda.Month this14829 ^boolean boolean14830] (.length this14829 boolean14830))) -(clojure.core/defn get-declaring-class {:arglists (quote (["java.time.Month"]))} (^java.lang.Class [^js/JSJoda.Month this14831] (.declaringClass this14831))) -(clojure.core/defn from {:arglists (quote (["java.time.temporal.TemporalAccessor"]))} (^js/JSJoda.Month [^js/JSJoda.TemporalAccessor java-time-temporal-TemporalAccessor14832] (js-invoke java.time.Month "from" java-time-temporal-TemporalAccessor14832))) -(clojure.core/defn is-supported {:arglists (quote (["java.time.Month" "java.time.temporal.TemporalField"]))} (^boolean [^js/JSJoda.Month this14833 ^js/JSJoda.TemporalField java-time-temporal-TemporalField14834] (.isSupported this14833 java-time-temporal-TemporalField14834))) -(clojure.core/defn hash-code {:arglists (quote (["java.time.Month"]))} (^int [^js/JSJoda.Month this14835] (.hashCode this14835))) -(clojure.core/defn adjust-into {:arglists (quote (["java.time.Month" "java.time.temporal.Temporal"]))} (^js/JSJoda.Temporal [^js/JSJoda.Month this14836 ^js/JSJoda.Temporal java-time-temporal-Temporal14837] (.adjustInto this14836 java-time-temporal-Temporal14837))) -(clojure.core/defn compare-to {:arglists (quote (["java.time.Month" "java.lang.Enum"]))} (^int [^js/JSJoda.Month this14838 ^java.lang.Enum java-lang-Enum14839] (.compareTo this14838 java-lang-Enum14839))) -(clojure.core/defn get {:arglists (quote (["java.time.Month" "java.time.temporal.TemporalField"]))} (^int [^js/JSJoda.Month this14840 ^js/JSJoda.TemporalField java-time-temporal-TemporalField14841] (.get this14840 java-time-temporal-TemporalField14841))) -(clojure.core/defn equals {:arglists (quote (["java.time.Month" "java.lang.Object"]))} (^boolean [^js/JSJoda.Month this14842 ^java.lang.Object java-lang-Object14843] (.equals this14842 java-lang-Object14843))) +(ns cljc.java-time.month + (:refer-clojure :exclude + [abs get range format min max next name resolve short]) + (:require [cljc.java-time.extn.calendar-awareness] + [goog.object] + [java.time :refer [Month]])) + +(def may + "The singleton instance for the month of May with 31 days. + This has the numeric value of {@code 5}." + (goog.object/get java.time.Month "MAY")) + +(def december + "The singleton instance for the month of December with 31 days. + This has the numeric value of {@code 12}." + (goog.object/get java.time.Month "DECEMBER")) + +(def june + "The singleton instance for the month of June with 30 days. + This has the numeric value of {@code 6}." + (goog.object/get java.time.Month "JUNE")) + +(def september + "The singleton instance for the month of September with 30 days. + This has the numeric value of {@code 9}." + (goog.object/get java.time.Month "SEPTEMBER")) + +(def february + "The singleton instance for the month of February with 28 days, or 29 in a leap year. + This has the numeric value of {@code 2}." + (goog.object/get java.time.Month "FEBRUARY")) + +(def january + "The singleton instance for the month of January with 31 days. + This has the numeric value of {@code 1}." + (goog.object/get java.time.Month "JANUARY")) + +(def november + "The singleton instance for the month of November with 30 days. + This has the numeric value of {@code 11}." + (goog.object/get java.time.Month "NOVEMBER")) + +(def august + "The singleton instance for the month of August with 31 days. + This has the numeric value of {@code 8}." + (goog.object/get java.time.Month "AUGUST")) + +(def july + "The singleton instance for the month of July with 31 days. + This has the numeric value of {@code 7}." + (goog.object/get java.time.Month "JULY")) + +(def march + "The singleton instance for the month of March with 31 days. + This has the numeric value of {@code 3}." + (goog.object/get java.time.Month "MARCH")) + +(def october + "The singleton instance for the month of October with 31 days. + This has the numeric value of {@code 10}." + (goog.object/get java.time.Month "OCTOBER")) + +(def april + "The singleton instance for the month of April with 30 days. + This has the numeric value of {@code 4}." + (goog.object/get java.time.Month "APRIL")) + +(defn range + "Gets the range of valid values for the specified field. + + The range object expresses the minimum and maximum valid values for a field. + This month is used to enhance the accuracy of the returned range. + If it is not possible to return the range, because the field is not supported + or for some other reason, an exception is thrown. + + If the field is {@link ChronoField#MONTH_OF_YEAR MONTH_OF_YEAR} then the + range of the month-of-year, from 1 to 12, will be returned. + All other {@code ChronoField} instances will throw an {@code UnsupportedTemporalTypeException}. + + If the field is not a {@code ChronoField}, then the result of this method + is obtained by invoking {@code TemporalField.rangeRefinedBy(TemporalAccessor)} + passing {@code this} as the argument. + Whether the range can be obtained is determined by the field. + + @param field the field to query the range for, not null + @return the range of valid values for the field, not null + @throws DateTimeException if the range for the field cannot be obtained + @throws UnsupportedTemporalTypeException if the field is not supported" + {:arglists (quote (["java.time.Month" "java.time.temporal.TemporalField"]))} + (^js/JSJoda.ValueRange [^js/JSJoda.Month this ^js/JSJoda.TemporalField field] + (.range this field))) + +(defn values + {:arglists (quote ([]))} + (^"java.lang.Class" [] (js-invoke java.time.Month "values"))) + +(defn value-of + {:arglists (quote (["java.lang.String"] + ["java.lang.Class" "java.lang.String"]))} + (^js/JSJoda.Month [^java.lang.String name] + (js-invoke java.time.Month "valueOf" name)) + (^java.lang.Enum [^java.lang.Class enum-type ^java.lang.String name] + (js-invoke java.time.Month "valueOf" enum-type name))) + +(defn of + "Obtains an instance of {@code Month} from an {@code int} value. + + {@code Month} is an enum representing the 12 months of the year. + This factory allows the enum to be obtained from the {@code int} value. + The {@code int} value follows the ISO-8601 standard, from 1 (January) to 12 (December). + + @param month the month-of-year to represent, from 1 (January) to 12 (December) + @return the month-of-year, not null + @throws DateTimeException if the month-of-year is invalid" + {:arglists (quote (["int"]))} + (^js/JSJoda.Month [^int month] (js-invoke java.time.Month "of" month))) + +(defn ordinal + "Returns the ordinal of this enumeration constant (its position + in its enum declaration, where the initial constant is assigned + an ordinal of zero). + + Most programmers will have no use for this method. It is + designed for use by sophisticated enum-based data structures, such + as {@link java.util.EnumSet} and {@link java.util.EnumMap}. + + @return the ordinal of this enumeration constant" + {:arglists (quote (["java.time.Month"]))} + (^int [^js/JSJoda.Month this] (.ordinal this))) + +(defn first-month-of-quarter + "Gets the month corresponding to the first month of this quarter. + + The year can be divided into four quarters. + This method returns the first month of the quarter for the base month. + January, February and March return January. + April, May and June return April. + July, August and September return July. + October, November and December return October. + + @return the first month of the quarter corresponding to this month, not null" + {:arglists (quote (["java.time.Month"]))} + (^js/JSJoda.Month [^js/JSJoda.Month this] (.firstMonthOfQuarter this))) + +(defn min-length + "Gets the minimum length of this month in days. + + February has a minimum length of 28 days. + April, June, September and November have 30 days. + All other months have 31 days. + + @return the minimum length of this month in days, from 28 to 31" + {:arglists (quote (["java.time.Month"]))} + (^int [^js/JSJoda.Month this] (.minLength this))) + +(defn plus + "Returns the month-of-year that is the specified number of quarters after this one. + + The calculation rolls around the end of the year from December to January. + The specified period may be negative. + + This instance is immutable and unaffected by this method call. + + @param months the months to add, positive or negative + @return the resulting month, not null" + {:arglists (quote (["java.time.Month" "long"]))} + (^js/JSJoda.Month [^js/JSJoda.Month this ^long months] (.plus this months))) + +(defn query + "Queries this month-of-year using the specified query. + + This queries this month-of-year using the specified query strategy object. + The {@code TemporalQuery} object defines the logic to be used to + obtain the result. Read the documentation of the query to understand + what the result of this method will be. + + The result of this method is obtained by invoking the + {@link TemporalQuery#queryFrom(TemporalAccessor)} method on the + specified query passing {@code this} as the argument. + + @param the type of the result + @param query the query to invoke, not null + @return the query result, null may be returned (defined by the query) + @throws DateTimeException if unable to query (defined by the query) + @throws ArithmeticException if numeric overflow occurs (defined by the query)" + {:arglists (quote (["java.time.Month" "java.time.temporal.TemporalQuery"]))} + (^java.lang.Object [^js/JSJoda.Month this ^js/JSJoda.TemporalQuery query] + (.query this query))) + +(defn to-string + "Returns the name of this enum constant, as contained in the + declaration. This method may be overridden, though it typically + isn't necessary or desirable. An enum type should override this + method when a more \"programmer-friendly\" string form exists. + + @return the name of this enum constant" + {:arglists (quote (["java.time.Month"]))} + (^java.lang.String [^js/JSJoda.Month this] (.toString this))) + +(defn first-day-of-year + "Gets the day-of-year corresponding to the first day of this month. + + This returns the day-of-year that this month begins on, using the leap + year flag to determine the length of February. + + @param leapYear true if the length is required for a leap year + @return the day of year corresponding to the first day of this month, from 1 to 336" + {:arglists (quote (["java.time.Month" "boolean"]))} + (^int [^js/JSJoda.Month this ^boolean leap-year] + (.firstDayOfYear this leap-year))) + +(defn minus + "Returns the month-of-year that is the specified number of months before this one. + + The calculation rolls around the start of the year from January to December. + The specified period may be negative. + + This instance is immutable and unaffected by this method call. + + @param months the months to subtract, positive or negative + @return the resulting month, not null" + {:arglists (quote (["java.time.Month" "long"]))} + (^js/JSJoda.Month [^js/JSJoda.Month this ^long months] (.minus this months))) + +(defn get-display-name + "Gets the textual representation, such as 'Jan' or 'December'. + + This returns the textual name used to identify the month-of-year, + suitable for presentation to the user. + The parameters control the style of the returned text and the locale. + + If no textual mapping is found then the {@link #getValue() numeric value} is returned. + + @param style the length of the text required, not null + @param locale the locale to use, not null + @return the text value of the month-of-year, not null" + {:arglists (quote (["java.time.Month" "java.time.format.TextStyle" + "java.util.Locale"]))} + (^java.lang.String + [^js/JSJoda.Month this ^js/JSJoda.TextStyle style ^java.util.Locale locale] + (.displayName this style locale))) + +(defn get-value + "Gets the month-of-year {@code int} value. + + The values are numbered following the ISO-8601 standard, + from 1 (January) to 12 (December). + + @return the month-of-year, from 1 (January) to 12 (December)" + {:arglists (quote (["java.time.Month"]))} + (^int [^js/JSJoda.Month this] (.value this))) + +(defn max-length + "Gets the maximum length of this month in days. + + February has a maximum length of 29 days. + April, June, September and November have 30 days. + All other months have 31 days. + + @return the maximum length of this month in days, from 29 to 31" + {:arglists (quote (["java.time.Month"]))} + (^int [^js/JSJoda.Month this] (.maxLength this))) + +(defn name + "Returns the name of this enum constant, exactly as declared in its + enum declaration. + + Most programmers should use the {@link #toString} method in + preference to this one, as the toString method may return + a more user-friendly name. This method is designed primarily for + use in specialized situations where correctness depends on getting the + exact name, which will not vary from release to release. + + @return the name of this enum constant" + {:arglists (quote (["java.time.Month"]))} + (^java.lang.String [^js/JSJoda.Month this] (.name this))) + +(defn get-long + "Gets the value of the specified field from this month-of-year as a {@code long}. + + This queries this month for the value of the specified field. + If it is not possible to return the value, because the field is not supported + or for some other reason, an exception is thrown. + + If the field is {@link ChronoField#MONTH_OF_YEAR MONTH_OF_YEAR} then the + value of the month-of-year, from 1 to 12, will be returned. + All other {@code ChronoField} instances will throw an {@code UnsupportedTemporalTypeException}. + + If the field is not a {@code ChronoField}, then the result of this method + is obtained by invoking {@code TemporalField.getFrom(TemporalAccessor)} + passing {@code this} as the argument. Whether the value can be obtained, + and what the value represents, is determined by the field. + + @param field the field to get, not null + @return the value for the field + @throws DateTimeException if a value for the field cannot be obtained + @throws UnsupportedTemporalTypeException if the field is not supported + @throws ArithmeticException if numeric overflow occurs" + {:arglists (quote (["java.time.Month" "java.time.temporal.TemporalField"]))} + (^long [^js/JSJoda.Month this ^js/JSJoda.TemporalField field] + (.getLong this field))) + +(defn length + "Gets the length of this month in days. + + This takes a flag to determine whether to return the length for a leap year or not. + + February has 28 days in a standard year and 29 days in a leap year. + April, June, September and November have 30 days. + All other months have 31 days. + + @param leapYear true if the length is required for a leap year + @return the length of this month in days, from 28 to 31" + {:arglists (quote (["java.time.Month" "boolean"]))} + (^int [^js/JSJoda.Month this ^boolean leap-year] (.length this leap-year))) + +(defn get-declaring-class + "Returns the Class object corresponding to this enum constant's + enum type. Two enum constants e1 and e2 are of the + same enum type if and only if + e1.getDeclaringClass() == e2.getDeclaringClass(). + (The value returned by this method may differ from the one returned + by the {@link Object#getClass} method for enum constants with + constant-specific class bodies.) + + @return the Class object corresponding to this enum constant's + enum type" + {:arglists (quote (["java.time.Month"]))} + (^java.lang.Class [^js/JSJoda.Month this] (.declaringClass this))) + +(defn from + "Obtains an instance of {@code Month} from a temporal object. + + This obtains a month based on the specified temporal. + A {@code TemporalAccessor} represents an arbitrary set of date and time information, + which this factory converts to an instance of {@code Month}. + + The conversion extracts the {@link ChronoField#MONTH_OF_YEAR MONTH_OF_YEAR} field. + The extraction is only permitted if the temporal object has an ISO + chronology, or can be converted to a {@code LocalDate}. + + This method matches the signature of the functional interface {@link TemporalQuery} + allowing it to be used as a query via method reference, {@code Month::from}. + + @param temporal the temporal object to convert, not null + @return the month-of-year, not null + @throws DateTimeException if unable to convert to a {@code Month}" + {:arglists (quote (["java.time.temporal.TemporalAccessor"]))} + (^js/JSJoda.Month [^js/JSJoda.TemporalAccessor temporal] + (js-invoke java.time.Month "from" temporal))) + +(defn is-supported + "Checks if the specified field is supported. + + This checks if this month-of-year can be queried for the specified field. + If false, then calling the {@link #range(TemporalField) range} and + {@link #get(TemporalField) get} methods will throw an exception. + + If the field is {@link ChronoField#MONTH_OF_YEAR MONTH_OF_YEAR} then + this method returns true. + All other {@code ChronoField} instances will return false. + + If the field is not a {@code ChronoField}, then the result of this method + is obtained by invoking {@code TemporalField.isSupportedBy(TemporalAccessor)} + passing {@code this} as the argument. + Whether the field is supported is determined by the field. + + @param field the field to check, null returns false + @return true if the field is supported on this month-of-year, false if not" + {:arglists (quote (["java.time.Month" "java.time.temporal.TemporalField"]))} + (^boolean [^js/JSJoda.Month this ^js/JSJoda.TemporalField field] + (.isSupported this field))) + +(defn hash-code + "Returns a hash code for this enum constant. + + @return a hash code for this enum constant." + {:arglists (quote (["java.time.Month"]))} + (^int [^js/JSJoda.Month this] (.hashCode this))) + +(defn adjust-into + "Adjusts the specified temporal object to have this month-of-year. + + This returns a temporal object of the same observable type as the input + with the month-of-year changed to be the same as this. + + The adjustment is equivalent to using {@link Temporal#with(TemporalField, long)} + passing {@link ChronoField#MONTH_OF_YEAR} as the field. + If the specified temporal object does not use the ISO calendar system then + a {@code DateTimeException} is thrown. + + In most cases, it is clearer to reverse the calling pattern by using + {@link Temporal#with(TemporalAdjuster)}: +
+   // these two lines are equivalent, but the second approach is recommended
+   temporal = thisMonth.adjustInto(temporal);
+   temporal = temporal.with(thisMonth);
+ 
+ + For example, given a date in May, the following are output: +
+   dateInMay.with(JANUARY);    // four months earlier
+   dateInMay.with(APRIL);      // one months earlier
+   dateInMay.with(MAY);        // same date
+   dateInMay.with(JUNE);       // one month later
+   dateInMay.with(DECEMBER);   // seven months later
+ 
+ + This instance is immutable and unaffected by this method call. + + @param temporal the target object to be adjusted, not null + @return the adjusted object, not null + @throws DateTimeException if unable to make the adjustment + @throws ArithmeticException if numeric overflow occurs" + {:arglists (quote (["java.time.Month" "java.time.temporal.Temporal"]))} + (^js/JSJoda.Temporal [^js/JSJoda.Month this ^js/JSJoda.Temporal temporal] + (.adjustInto this temporal))) + +(defn compare-to + "Compares this enum with the specified object for order. Returns a + negative integer, zero, or a positive integer as this object is less + than, equal to, or greater than the specified object. + + Enum constants are only comparable to other enum constants of the + same enum type. The natural order implemented by this + method is the order in which the constants are declared." + {:arglists (quote (["java.time.Month" "java.lang.Enum"]))} + (^int [^js/JSJoda.Month this ^java.lang.Enum o] (.compareTo this o))) + +(defn get + "Gets the value of the specified field from this month-of-year as an {@code int}. + + This queries this month for the value of the specified field. + The returned value will always be within the valid range of values for the field. + If it is not possible to return the value, because the field is not supported + or for some other reason, an exception is thrown. + + If the field is {@link ChronoField#MONTH_OF_YEAR MONTH_OF_YEAR} then the + value of the month-of-year, from 1 to 12, will be returned. + All other {@code ChronoField} instances will throw an {@code UnsupportedTemporalTypeException}. + + If the field is not a {@code ChronoField}, then the result of this method + is obtained by invoking {@code TemporalField.getFrom(TemporalAccessor)} + passing {@code this} as the argument. Whether the value can be obtained, + and what the value represents, is determined by the field. + + @param field the field to get, not null + @return the value for the field, within the valid range of values + @throws DateTimeException if a value for the field cannot be obtained or + the value is outside the range of valid values for the field + @throws UnsupportedTemporalTypeException if the field is not supported or + the range of values exceeds an {@code int} + @throws ArithmeticException if numeric overflow occurs" + {:arglists (quote (["java.time.Month" "java.time.temporal.TemporalField"]))} + (^int [^js/JSJoda.Month this ^js/JSJoda.TemporalField field] + (.get this field))) + +(defn equals + "Returns true if the specified object is equal to this + enum constant. + + @param other the object to be compared for equality with this object. + @return true if the specified object is equal to this + enum constant." + {:arglists (quote (["java.time.Month" "java.lang.Object"]))} + (^boolean [^js/JSJoda.Month this ^java.lang.Object other] + (.equals this other))) diff --git a/src/cljc/java_time/month_day.clj b/src/cljc/java_time/month_day.clj index e7bb08e..f77970e 100644 --- a/src/cljc/java_time/month_day.clj +++ b/src/cljc/java_time/month_day.clj @@ -1,26 +1,415 @@ -(ns cljc.java-time.month-day (:refer-clojure :exclude [abs get range format min max next name resolve short]) (:require [cljc.java-time.extn.calendar-awareness]) (:import [java.time MonthDay])) -(clojure.core/defn at-year {:arglists (quote (["java.time.MonthDay" "int"]))} (^java.time.LocalDate [^java.time.MonthDay this14844 ^java.lang.Integer int14845] (.atYear this14844 int14845))) -(clojure.core/defn range {:arglists (quote (["java.time.MonthDay" "java.time.temporal.TemporalField"]))} (^java.time.temporal.ValueRange [^java.time.MonthDay this14846 ^java.time.temporal.TemporalField java-time-temporal-TemporalField14847] (.range this14846 java-time-temporal-TemporalField14847))) -(clojure.core/defn of {:arglists (quote (["int" "int"] ["java.time.Month" "int"]))} (^java.time.MonthDay [G__14849 G__14850] (clojure.core/cond (clojure.core/and (clojure.core/instance? java.lang.Number G__14849) (clojure.core/instance? java.lang.Number G__14850)) (clojure.core/let [G__14849 (clojure.core/int G__14849) G__14850 (clojure.core/int G__14850)] (java.time.MonthDay/of G__14849 G__14850)) (clojure.core/and (clojure.core/instance? java.time.Month G__14849) (clojure.core/instance? java.lang.Number G__14850)) (clojure.core/let [G__14849 ^"java.time.Month" G__14849 G__14850 (clojure.core/int G__14850)] (java.time.MonthDay/of G__14849 G__14850)) :else (throw (java.lang.IllegalArgumentException. "no corresponding java.time method with these args"))))) -(clojure.core/defn with-month {:arglists (quote (["java.time.MonthDay" "int"]))} (^java.time.MonthDay [^java.time.MonthDay this14851 ^java.lang.Integer int14852] (.withMonth this14851 int14852))) -(clojure.core/defn query {:arglists (quote (["java.time.MonthDay" "java.time.temporal.TemporalQuery"]))} (^java.lang.Object [^java.time.MonthDay this14853 ^java.time.temporal.TemporalQuery java-time-temporal-TemporalQuery14854] (.query this14853 java-time-temporal-TemporalQuery14854))) -(clojure.core/defn to-string {:arglists (quote (["java.time.MonthDay"]))} (^java.lang.String [^java.time.MonthDay this14855] (.toString this14855))) -(clojure.core/defn is-before {:arglists (quote (["java.time.MonthDay" "java.time.MonthDay"]))} (^java.lang.Boolean [^java.time.MonthDay this14856 ^java.time.MonthDay java-time-MonthDay14857] (.isBefore this14856 java-time-MonthDay14857))) -(clojure.core/defn get-long {:arglists (quote (["java.time.MonthDay" "java.time.temporal.TemporalField"]))} (^long [^java.time.MonthDay this14858 ^java.time.temporal.TemporalField java-time-temporal-TemporalField14859] (.getLong this14858 java-time-temporal-TemporalField14859))) -(clojure.core/defn with-day-of-month {:arglists (quote (["java.time.MonthDay" "int"]))} (^java.time.MonthDay [^java.time.MonthDay this14860 ^java.lang.Integer int14861] (.withDayOfMonth this14860 int14861))) -(clojure.core/defn get-day-of-month {:arglists (quote (["java.time.MonthDay"]))} (^java.lang.Integer [^java.time.MonthDay this14862] (.getDayOfMonth this14862))) -(clojure.core/defn from {:arglists (quote (["java.time.temporal.TemporalAccessor"]))} (^java.time.MonthDay [^java.time.temporal.TemporalAccessor java-time-temporal-TemporalAccessor14863] (java.time.MonthDay/from java-time-temporal-TemporalAccessor14863))) -(clojure.core/defn is-after {:arglists (quote (["java.time.MonthDay" "java.time.MonthDay"]))} (^java.lang.Boolean [^java.time.MonthDay this14864 ^java.time.MonthDay java-time-MonthDay14865] (.isAfter this14864 java-time-MonthDay14865))) -(clojure.core/defn is-supported {:arglists (quote (["java.time.MonthDay" "java.time.temporal.TemporalField"]))} (^java.lang.Boolean [^java.time.MonthDay this14866 ^java.time.temporal.TemporalField java-time-temporal-TemporalField14867] (.isSupported this14866 java-time-temporal-TemporalField14867))) -(clojure.core/defn parse {:arglists (quote (["java.lang.CharSequence" "java.time.format.DateTimeFormatter"] ["java.lang.CharSequence"]))} (^java.time.MonthDay [^java.lang.CharSequence java-lang-CharSequence14868 ^java.time.format.DateTimeFormatter java-time-format-DateTimeFormatter14869] (java.time.MonthDay/parse java-lang-CharSequence14868 java-time-format-DateTimeFormatter14869)) (^java.time.MonthDay [^java.lang.CharSequence java-lang-CharSequence14870] (java.time.MonthDay/parse java-lang-CharSequence14870))) -(clojure.core/defn is-valid-year {:arglists (quote (["java.time.MonthDay" "int"]))} (^java.lang.Boolean [^java.time.MonthDay this14871 ^java.lang.Integer int14872] (.isValidYear this14871 int14872))) -(clojure.core/defn hash-code {:arglists (quote (["java.time.MonthDay"]))} (^java.lang.Integer [^java.time.MonthDay this14873] (.hashCode this14873))) -(clojure.core/defn adjust-into {:arglists (quote (["java.time.MonthDay" "java.time.temporal.Temporal"]))} (^java.time.temporal.Temporal [^java.time.MonthDay this14874 ^java.time.temporal.Temporal java-time-temporal-Temporal14875] (.adjustInto this14874 java-time-temporal-Temporal14875))) -(clojure.core/defn with {:arglists (quote (["java.time.MonthDay" "java.time.Month"]))} (^java.time.MonthDay [^java.time.MonthDay this14876 ^java.time.Month java-time-Month14877] (.with this14876 java-time-Month14877))) -(clojure.core/defn now {:arglists (quote (["java.time.ZoneId"] ["java.time.Clock"] []))} (^java.time.MonthDay [G__14879] (clojure.core/cond (clojure.core/and (clojure.core/instance? java.time.ZoneId G__14879)) (clojure.core/let [G__14879 ^"java.time.ZoneId" G__14879] (java.time.MonthDay/now G__14879)) (clojure.core/and (clojure.core/instance? java.time.Clock G__14879)) (clojure.core/let [G__14879 ^"java.time.Clock" G__14879] (java.time.MonthDay/now G__14879)) :else (throw (java.lang.IllegalArgumentException. "no corresponding java.time method with these args")))) (^java.time.MonthDay [] (java.time.MonthDay/now))) -(clojure.core/defn get-month-value {:arglists (quote (["java.time.MonthDay"]))} (^java.lang.Integer [^java.time.MonthDay this14880] (.getMonthValue this14880))) -(clojure.core/defn compare-to {:arglists (quote (["java.time.MonthDay" "java.time.MonthDay"]))} (^java.lang.Integer [^java.time.MonthDay this14881 ^java.time.MonthDay java-time-MonthDay14882] (.compareTo this14881 java-time-MonthDay14882))) -(clojure.core/defn get-month {:arglists (quote (["java.time.MonthDay"]))} (^java.time.Month [^java.time.MonthDay this14883] (.getMonth this14883))) -(clojure.core/defn get {:arglists (quote (["java.time.MonthDay" "java.time.temporal.TemporalField"]))} (^java.lang.Integer [^java.time.MonthDay this14884 ^java.time.temporal.TemporalField java-time-temporal-TemporalField14885] (.get this14884 java-time-temporal-TemporalField14885))) -(clojure.core/defn equals {:arglists (quote (["java.time.MonthDay" "java.lang.Object"]))} (^java.lang.Boolean [^java.time.MonthDay this14886 ^java.lang.Object java-lang-Object14887] (.equals this14886 java-lang-Object14887))) -(clojure.core/defn format {:arglists (quote (["java.time.MonthDay" "java.time.format.DateTimeFormatter"]))} (^java.lang.String [^java.time.MonthDay this14888 ^java.time.format.DateTimeFormatter java-time-format-DateTimeFormatter14889] (.format this14888 java-time-format-DateTimeFormatter14889))) +(ns cljc.java-time.month-day + (:refer-clojure :exclude + [abs get range format min max next name resolve short]) + (:require [cljc.java-time.extn.calendar-awareness]) + (:import [java.time MonthDay])) + +(defn at-year + "Combines this month-day with a year to create a {@code LocalDate}. + + This returns a {@code LocalDate} formed from this month-day and the specified year. + + A month-day of February 29th will be adjusted to February 28th in the resulting + date if the year is not a leap year. + + This instance is immutable and unaffected by this method call. + + @param year the year to use, from MIN_YEAR to MAX_YEAR + @return the local date formed from this month-day and the specified year, not null + @throws DateTimeException if the year is outside the valid range of years" + {:arglists (quote (["java.time.MonthDay" "int"]))} + (^java.time.LocalDate [^java.time.MonthDay this ^java.lang.Integer year] + (.atYear this year))) + +(defn range + "Gets the range of valid values for the specified field. + + The range object expresses the minimum and maximum valid values for a field. + This month-day is used to enhance the accuracy of the returned range. + If it is not possible to return the range, because the field is not supported + or for some other reason, an exception is thrown. + + If the field is a {@link ChronoField} then the query is implemented here. + The {@link #isSupported(TemporalField) supported fields} will return + appropriate range instances. + All other {@code ChronoField} instances will throw an {@code UnsupportedTemporalTypeException}. + + If the field is not a {@code ChronoField}, then the result of this method + is obtained by invoking {@code TemporalField.rangeRefinedBy(TemporalAccessor)} + passing {@code this} as the argument. + Whether the range can be obtained is determined by the field. + + @param field the field to query the range for, not null + @return the range of valid values for the field, not null + @throws DateTimeException if the range for the field cannot be obtained + @throws UnsupportedTemporalTypeException if the field is not supported" + {:arglists (quote (["java.time.MonthDay" + "java.time.temporal.TemporalField"]))} + (^java.time.temporal.ValueRange + [^java.time.MonthDay this ^java.time.temporal.TemporalField field] + (.range this field))) + +(defn of + {:arglists (quote (["int" "int"] ["java.time.Month" "int"]))} + (^java.time.MonthDay [arg0 arg1] + (cond (and (instance? java.lang.Number arg0) + (instance? java.lang.Number arg1)) + (let [month (int arg0) + day-of-month (int arg1)] + (java.time.MonthDay/of month day-of-month)) + (and (instance? java.time.Month arg0) + (instance? java.lang.Number arg1)) + (let [^java.time.Month month arg0 + day-of-month (int arg1)] + (java.time.MonthDay/of month day-of-month)) + :else (throw (java.lang.IllegalArgumentException. + "no corresponding java.time method with these args"))))) + +(defn with-month + "Returns a copy of this {@code MonthDay} with the month-of-year altered. + + This returns a month-day with the specified month. + If the day-of-month is invalid for the specified month, the day will + be adjusted to the last valid day-of-month. + + This instance is immutable and unaffected by this method call. + + @param month the month-of-year to set in the returned month-day, from 1 (January) to 12 (December) + @return a {@code MonthDay} based on this month-day with the requested month, not null + @throws DateTimeException if the month-of-year value is invalid" + {:arglists (quote (["java.time.MonthDay" "int"]))} + (^java.time.MonthDay [^java.time.MonthDay this ^java.lang.Integer month] + (.withMonth this month))) + +(defn query + "Queries this month-day using the specified query. + + This queries this month-day using the specified query strategy object. + The {@code TemporalQuery} object defines the logic to be used to + obtain the result. Read the documentation of the query to understand + what the result of this method will be. + + The result of this method is obtained by invoking the + {@link TemporalQuery#queryFrom(TemporalAccessor)} method on the + specified query passing {@code this} as the argument. + + @param the type of the result + @param query the query to invoke, not null + @return the query result, null may be returned (defined by the query) + @throws DateTimeException if unable to query (defined by the query) + @throws ArithmeticException if numeric overflow occurs (defined by the query)" + {:arglists (quote (["java.time.MonthDay" + "java.time.temporal.TemporalQuery"]))} + (^java.lang.Object + [^java.time.MonthDay this ^java.time.temporal.TemporalQuery query] + (.query this query))) + +(defn to-string + "Outputs this month-day as a {@code String}, such as {@code --12-03}. + + The output will be in the format {@code --MM-dd}: + + @return a string representation of this month-day, not null" + {:arglists (quote (["java.time.MonthDay"]))} + (^java.lang.String [^java.time.MonthDay this] (.toString this))) + +(defn is-before + "Checks if this month-day is before the specified month-day. + + @param other the other month-day to compare to, not null + @return true if this point is before the specified month-day" + {:arglists (quote (["java.time.MonthDay" "java.time.MonthDay"]))} + (^java.lang.Boolean [^java.time.MonthDay this ^java.time.MonthDay other] + (.isBefore this other))) + +(defn get-long + "Gets the value of the specified field from this month-day as a {@code long}. + + This queries this month-day for the value of the specified field. + If it is not possible to return the value, because the field is not supported + or for some other reason, an exception is thrown. + + If the field is a {@link ChronoField} then the query is implemented here. + The {@link #isSupported(TemporalField) supported fields} will return valid + values based on this month-day. + All other {@code ChronoField} instances will throw an {@code UnsupportedTemporalTypeException}. + + If the field is not a {@code ChronoField}, then the result of this method + is obtained by invoking {@code TemporalField.getFrom(TemporalAccessor)} + passing {@code this} as the argument. Whether the value can be obtained, + and what the value represents, is determined by the field. + + @param field the field to get, not null + @return the value for the field + @throws DateTimeException if a value for the field cannot be obtained + @throws UnsupportedTemporalTypeException if the field is not supported + @throws ArithmeticException if numeric overflow occurs" + {:arglists (quote (["java.time.MonthDay" + "java.time.temporal.TemporalField"]))} + (^long [^java.time.MonthDay this ^java.time.temporal.TemporalField field] + (.getLong this field))) + +(defn with-day-of-month + "Returns a copy of this {@code MonthDay} with the day-of-month altered. + + This returns a month-day with the specified day-of-month. + If the day-of-month is invalid for the month, an exception is thrown. + + This instance is immutable and unaffected by this method call. + + @param dayOfMonth the day-of-month to set in the return month-day, from 1 to 31 + @return a {@code MonthDay} based on this month-day with the requested day, not null + @throws DateTimeException if the day-of-month value is invalid, + or if the day-of-month is invalid for the month" + {:arglists (quote (["java.time.MonthDay" "int"]))} + (^java.time.MonthDay + [^java.time.MonthDay this ^java.lang.Integer day-of-month] + (.withDayOfMonth this day-of-month))) + +(defn get-day-of-month + "Gets the day-of-month field. + + This method returns the primitive {@code int} value for the day-of-month. + + @return the day-of-month, from 1 to 31" + {:arglists (quote (["java.time.MonthDay"]))} + (^java.lang.Integer [^java.time.MonthDay this] (.getDayOfMonth this))) + +(defn from + "Obtains an instance of {@code MonthDay} from a temporal object. + + This obtains a month-day based on the specified temporal. + A {@code TemporalAccessor} represents an arbitrary set of date and time information, + which this factory converts to an instance of {@code MonthDay}. + + The conversion extracts the {@link ChronoField#MONTH_OF_YEAR MONTH_OF_YEAR} and + {@link ChronoField#DAY_OF_MONTH DAY_OF_MONTH} fields. + The extraction is only permitted if the temporal object has an ISO + chronology, or can be converted to a {@code LocalDate}. + + This method matches the signature of the functional interface {@link TemporalQuery} + allowing it to be used as a query via method reference, {@code MonthDay::from}. + + @param temporal the temporal object to convert, not null + @return the month-day, not null + @throws DateTimeException if unable to convert to a {@code MonthDay}" + {:arglists (quote (["java.time.temporal.TemporalAccessor"]))} + (^java.time.MonthDay [^java.time.temporal.TemporalAccessor temporal] + (java.time.MonthDay/from temporal))) + +(defn is-after + "Checks if this month-day is after the specified month-day. + + @param other the other month-day to compare to, not null + @return true if this is after the specified month-day" + {:arglists (quote (["java.time.MonthDay" "java.time.MonthDay"]))} + (^java.lang.Boolean [^java.time.MonthDay this ^java.time.MonthDay other] + (.isAfter this other))) + +(defn is-supported + "Checks if the specified field is supported. + + This checks if this month-day can be queried for the specified field. + If false, then calling the {@link #range(TemporalField) range} and + {@link #get(TemporalField) get} methods will throw an exception. + + If the field is a {@link ChronoField} then the query is implemented here. + The supported fields are: +
    +
  • {@code MONTH_OF_YEAR} +
  • {@code YEAR} +
+ All other {@code ChronoField} instances will return false. + + If the field is not a {@code ChronoField}, then the result of this method + is obtained by invoking {@code TemporalField.isSupportedBy(TemporalAccessor)} + passing {@code this} as the argument. + Whether the field is supported is determined by the field. + + @param field the field to check, null returns false + @return true if the field is supported on this month-day, false if not" + {:arglists (quote (["java.time.MonthDay" + "java.time.temporal.TemporalField"]))} + (^java.lang.Boolean + [^java.time.MonthDay this ^java.time.temporal.TemporalField field] + (.isSupported this field))) + +(defn parse + {:arglists (quote (["java.lang.CharSequence"] + ["java.lang.CharSequence" + "java.time.format.DateTimeFormatter"]))} + (^java.time.MonthDay [^java.lang.CharSequence text] + (java.time.MonthDay/parse text)) + (^java.time.MonthDay + [^java.lang.CharSequence text ^java.time.format.DateTimeFormatter formatter] + (java.time.MonthDay/parse text formatter))) + +(defn is-valid-year + "Checks if the year is valid for this month-day. + + This method checks whether this month and day and the input year form + a valid date. This can only return false for February 29th. + + @param year the year to validate + @return true if the year is valid for this month-day + @see Year#isValidMonthDay(MonthDay)" + {:arglists (quote (["java.time.MonthDay" "int"]))} + (^java.lang.Boolean [^java.time.MonthDay this ^java.lang.Integer year] + (.isValidYear this year))) + +(defn hash-code + "A hash code for this month-day. + + @return a suitable hash code" + {:arglists (quote (["java.time.MonthDay"]))} + (^java.lang.Integer [^java.time.MonthDay this] (.hashCode this))) + +(defn adjust-into + "Adjusts the specified temporal object to have this month-day. + + This returns a temporal object of the same observable type as the input + with the month and day-of-month changed to be the same as this. + + The adjustment is equivalent to using {@link Temporal#with(TemporalField, long)} + twice, passing {@link ChronoField#MONTH_OF_YEAR} and + {@link ChronoField#DAY_OF_MONTH} as the fields. + If the specified temporal object does not use the ISO calendar system then + a {@code DateTimeException} is thrown. + + In most cases, it is clearer to reverse the calling pattern by using + {@link Temporal#with(TemporalAdjuster)}: +
+   // these two lines are equivalent, but the second approach is recommended
+   temporal = thisMonthDay.adjustInto(temporal);
+   temporal = temporal.with(thisMonthDay);
+ 
+ + This instance is immutable and unaffected by this method call. + + @param temporal the target object to be adjusted, not null + @return the adjusted object, not null + @throws DateTimeException if unable to make the adjustment + @throws ArithmeticException if numeric overflow occurs" + {:arglists (quote (["java.time.MonthDay" "java.time.temporal.Temporal"]))} + (^java.time.temporal.Temporal + [^java.time.MonthDay this ^java.time.temporal.Temporal temporal] + (.adjustInto this temporal))) + +(defn with + "Returns a copy of this {@code MonthDay} with the month-of-year altered. + + This returns a month-day with the specified month. + If the day-of-month is invalid for the specified month, the day will + be adjusted to the last valid day-of-month. + + This instance is immutable and unaffected by this method call. + + @param month the month-of-year to set in the returned month-day, not null + @return a {@code MonthDay} based on this month-day with the requested month, not null" + {:arglists (quote (["java.time.MonthDay" "java.time.Month"]))} + (^java.time.MonthDay [^java.time.MonthDay this ^java.time.Month month] + (.with this month))) + +(defn now + {:arglists (quote ([] ["java.time.Clock"] ["java.time.ZoneId"]))} + (^java.time.MonthDay [] (java.time.MonthDay/now)) + (^java.time.MonthDay [arg0] + (cond (instance? java.time.Clock arg0) (let [^java.time.Clock clock arg0] + (java.time.MonthDay/now clock)) + (instance? java.time.ZoneId arg0) (let [^java.time.ZoneId zone arg0] + (java.time.MonthDay/now zone)) + :else (throw (java.lang.IllegalArgumentException. + "no corresponding java.time method with these args"))))) + +(defn get-month-value + "Gets the month-of-year field from 1 to 12. + + This method returns the month as an {@code int} from 1 to 12. + Application code is frequently clearer if the enum {@link Month} + is used by calling {@link #getMonth()}. + + @return the month-of-year, from 1 to 12 + @see #getMonth()" + {:arglists (quote (["java.time.MonthDay"]))} + (^java.lang.Integer [^java.time.MonthDay this] (.getMonthValue this))) + +(defn compare-to + "Compares this month-day to another month-day. + + The comparison is based first on value of the month, then on the value of the day. + It is \"consistent with equals\", as defined by {@link Comparable}. + + @param other the other month-day to compare to, not null + @return the comparator value, negative if less, positive if greater" + {:arglists (quote (["java.time.MonthDay" "java.time.MonthDay"]))} + (^java.lang.Integer [^java.time.MonthDay this ^java.time.MonthDay other] + (.compareTo this other))) + +(defn get-month + "Gets the month-of-year field using the {@code Month} enum. + + This method returns the enum {@link Month} for the month. + This avoids confusion as to what {@code int} values mean. + If you need access to the primitive {@code int} value then the enum + provides the {@link Month#getValue() int value}. + + @return the month-of-year, not null + @see #getMonthValue()" + {:arglists (quote (["java.time.MonthDay"]))} + (^java.time.Month [^java.time.MonthDay this] (.getMonth this))) + +(defn get + "Gets the value of the specified field from this month-day as an {@code int}. + + This queries this month-day for the value of the specified field. + The returned value will always be within the valid range of values for the field. + If it is not possible to return the value, because the field is not supported + or for some other reason, an exception is thrown. + + If the field is a {@link ChronoField} then the query is implemented here. + The {@link #isSupported(TemporalField) supported fields} will return valid + values based on this month-day. + All other {@code ChronoField} instances will throw an {@code UnsupportedTemporalTypeException}. + + If the field is not a {@code ChronoField}, then the result of this method + is obtained by invoking {@code TemporalField.getFrom(TemporalAccessor)} + passing {@code this} as the argument. Whether the value can be obtained, + and what the value represents, is determined by the field. + + @param field the field to get, not null + @return the value for the field + @throws DateTimeException if a value for the field cannot be obtained or + the value is outside the range of valid values for the field + @throws UnsupportedTemporalTypeException if the field is not supported or + the range of values exceeds an {@code int} + @throws ArithmeticException if numeric overflow occurs" + {:arglists (quote (["java.time.MonthDay" + "java.time.temporal.TemporalField"]))} + (^java.lang.Integer + [^java.time.MonthDay this ^java.time.temporal.TemporalField field] + (.get this field))) + +(defn equals + "Checks if this month-day is equal to another month-day. + + The comparison is based on the time-line position of the month-day within a year. + + @param obj the object to check, null returns false + @return true if this is equal to the other month-day" + {:arglists (quote (["java.time.MonthDay" "java.lang.Object"]))} + (^java.lang.Boolean [^java.time.MonthDay this ^java.lang.Object obj] + (.equals this obj))) + +(defn format + "Formats this month-day using the specified formatter. + + This month-day will be passed to the formatter to produce a string. + + @param formatter the formatter to use, not null + @return the formatted month-day string, not null + @throws DateTimeException if an error occurs during printing" + {:arglists (quote (["java.time.MonthDay" + "java.time.format.DateTimeFormatter"]))} + (^java.lang.String + [^java.time.MonthDay this ^java.time.format.DateTimeFormatter formatter] + (.format this formatter))) diff --git a/src/cljc/java_time/month_day.cljs b/src/cljc/java_time/month_day.cljs index f8bd135..91c0821 100644 --- a/src/cljc/java_time/month_day.cljs +++ b/src/cljc/java_time/month_day.cljs @@ -1,26 +1,393 @@ -(ns cljc.java-time.month-day (:refer-clojure :exclude [abs get range format min max next name resolve short]) (:require [cljc.java-time.extn.calendar-awareness] [goog.object] [java.time :refer [MonthDay]])) -(clojure.core/defn at-year {:arglists (quote (["java.time.MonthDay" "int"]))} (^js/JSJoda.LocalDate [^js/JSJoda.MonthDay this14890 ^int int14891] (.atYear this14890 int14891))) -(clojure.core/defn range {:arglists (quote (["java.time.MonthDay" "java.time.temporal.TemporalField"]))} (^js/JSJoda.ValueRange [^js/JSJoda.MonthDay this14892 ^js/JSJoda.TemporalField java-time-temporal-TemporalField14893] (.range this14892 java-time-temporal-TemporalField14893))) -(clojure.core/defn of {:arglists (quote (["int" "int"] ["java.time.Month" "int"]))} (^js/JSJoda.MonthDay [G__14895 G__14896] (js-invoke java.time.MonthDay "of" G__14895 G__14896))) -(clojure.core/defn with-month {:arglists (quote (["java.time.MonthDay" "int"]))} (^js/JSJoda.MonthDay [^js/JSJoda.MonthDay this14897 ^int int14898] (.withMonth this14897 int14898))) -(clojure.core/defn query {:arglists (quote (["java.time.MonthDay" "java.time.temporal.TemporalQuery"]))} (^java.lang.Object [^js/JSJoda.MonthDay this14899 ^js/JSJoda.TemporalQuery java-time-temporal-TemporalQuery14900] (.query this14899 java-time-temporal-TemporalQuery14900))) -(clojure.core/defn to-string {:arglists (quote (["java.time.MonthDay"]))} (^java.lang.String [^js/JSJoda.MonthDay this14901] (.toString this14901))) -(clojure.core/defn is-before {:arglists (quote (["java.time.MonthDay" "java.time.MonthDay"]))} (^boolean [^js/JSJoda.MonthDay this14902 ^js/JSJoda.MonthDay java-time-MonthDay14903] (.isBefore this14902 java-time-MonthDay14903))) -(clojure.core/defn get-long {:arglists (quote (["java.time.MonthDay" "java.time.temporal.TemporalField"]))} (^long [^js/JSJoda.MonthDay this14904 ^js/JSJoda.TemporalField java-time-temporal-TemporalField14905] (.getLong this14904 java-time-temporal-TemporalField14905))) -(clojure.core/defn with-day-of-month {:arglists (quote (["java.time.MonthDay" "int"]))} (^js/JSJoda.MonthDay [^js/JSJoda.MonthDay this14906 ^int int14907] (.withDayOfMonth this14906 int14907))) -(clojure.core/defn get-day-of-month {:arglists (quote (["java.time.MonthDay"]))} (^int [^js/JSJoda.MonthDay this14908] (.dayOfMonth this14908))) -(clojure.core/defn from {:arglists (quote (["java.time.temporal.TemporalAccessor"]))} (^js/JSJoda.MonthDay [^js/JSJoda.TemporalAccessor java-time-temporal-TemporalAccessor14909] (js-invoke java.time.MonthDay "from" java-time-temporal-TemporalAccessor14909))) -(clojure.core/defn is-after {:arglists (quote (["java.time.MonthDay" "java.time.MonthDay"]))} (^boolean [^js/JSJoda.MonthDay this14910 ^js/JSJoda.MonthDay java-time-MonthDay14911] (.isAfter this14910 java-time-MonthDay14911))) -(clojure.core/defn is-supported {:arglists (quote (["java.time.MonthDay" "java.time.temporal.TemporalField"]))} (^boolean [^js/JSJoda.MonthDay this14912 ^js/JSJoda.TemporalField java-time-temporal-TemporalField14913] (.isSupported this14912 java-time-temporal-TemporalField14913))) -(clojure.core/defn parse {:arglists (quote (["java.lang.CharSequence" "java.time.format.DateTimeFormatter"] ["java.lang.CharSequence"]))} (^js/JSJoda.MonthDay [^java.lang.CharSequence java-lang-CharSequence14914 ^js/JSJoda.DateTimeFormatter java-time-format-DateTimeFormatter14915] (js-invoke java.time.MonthDay "parse" java-lang-CharSequence14914 java-time-format-DateTimeFormatter14915)) (^js/JSJoda.MonthDay [^java.lang.CharSequence java-lang-CharSequence14916] (js-invoke java.time.MonthDay "parse" java-lang-CharSequence14916))) -(clojure.core/defn is-valid-year {:arglists (quote (["java.time.MonthDay" "int"]))} (^boolean [^js/JSJoda.MonthDay this14917 ^int int14918] (.isValidYear this14917 int14918))) -(clojure.core/defn hash-code {:arglists (quote (["java.time.MonthDay"]))} (^int [^js/JSJoda.MonthDay this14919] (.hashCode this14919))) -(clojure.core/defn adjust-into {:arglists (quote (["java.time.MonthDay" "java.time.temporal.Temporal"]))} (^js/JSJoda.Temporal [^js/JSJoda.MonthDay this14920 ^js/JSJoda.Temporal java-time-temporal-Temporal14921] (.adjustInto this14920 java-time-temporal-Temporal14921))) -(clojure.core/defn with {:arglists (quote (["java.time.MonthDay" "java.time.Month"]))} (^js/JSJoda.MonthDay [^js/JSJoda.MonthDay this14922 ^js/JSJoda.Month java-time-Month14923] (.with this14922 java-time-Month14923))) -(clojure.core/defn now {:arglists (quote (["java.time.ZoneId"] ["java.time.Clock"] []))} (^js/JSJoda.MonthDay [G__14925] (js-invoke java.time.MonthDay "now" G__14925)) (^js/JSJoda.MonthDay [] (js-invoke java.time.MonthDay "now"))) -(clojure.core/defn get-month-value {:arglists (quote (["java.time.MonthDay"]))} (^int [^js/JSJoda.MonthDay this14926] (.monthValue this14926))) -(clojure.core/defn compare-to {:arglists (quote (["java.time.MonthDay" "java.time.MonthDay"]))} (^int [^js/JSJoda.MonthDay this14927 ^js/JSJoda.MonthDay java-time-MonthDay14928] (.compareTo this14927 java-time-MonthDay14928))) -(clojure.core/defn get-month {:arglists (quote (["java.time.MonthDay"]))} (^js/JSJoda.Month [^js/JSJoda.MonthDay this14929] (.month this14929))) -(clojure.core/defn get {:arglists (quote (["java.time.MonthDay" "java.time.temporal.TemporalField"]))} (^int [^js/JSJoda.MonthDay this14930 ^js/JSJoda.TemporalField java-time-temporal-TemporalField14931] (.get this14930 java-time-temporal-TemporalField14931))) -(clojure.core/defn equals {:arglists (quote (["java.time.MonthDay" "java.lang.Object"]))} (^boolean [^js/JSJoda.MonthDay this14932 ^java.lang.Object java-lang-Object14933] (.equals this14932 java-lang-Object14933))) -(clojure.core/defn format {:arglists (quote (["java.time.MonthDay" "java.time.format.DateTimeFormatter"]))} (^java.lang.String [^js/JSJoda.MonthDay this14934 ^js/JSJoda.DateTimeFormatter java-time-format-DateTimeFormatter14935] (.format this14934 java-time-format-DateTimeFormatter14935))) +(ns cljc.java-time.month-day + (:refer-clojure :exclude + [abs get range format min max next name resolve short]) + (:require [cljc.java-time.extn.calendar-awareness] + [goog.object] + [java.time :refer [MonthDay]])) + +(defn at-year + "Combines this month-day with a year to create a {@code LocalDate}. + + This returns a {@code LocalDate} formed from this month-day and the specified year. + + A month-day of February 29th will be adjusted to February 28th in the resulting + date if the year is not a leap year. + + This instance is immutable and unaffected by this method call. + + @param year the year to use, from MIN_YEAR to MAX_YEAR + @return the local date formed from this month-day and the specified year, not null + @throws DateTimeException if the year is outside the valid range of years" + {:arglists (quote (["java.time.MonthDay" "int"]))} + (^js/JSJoda.LocalDate [^js/JSJoda.MonthDay this ^int year] + (.atYear this year))) + +(defn range + "Gets the range of valid values for the specified field. + + The range object expresses the minimum and maximum valid values for a field. + This month-day is used to enhance the accuracy of the returned range. + If it is not possible to return the range, because the field is not supported + or for some other reason, an exception is thrown. + + If the field is a {@link ChronoField} then the query is implemented here. + The {@link #isSupported(TemporalField) supported fields} will return + appropriate range instances. + All other {@code ChronoField} instances will throw an {@code UnsupportedTemporalTypeException}. + + If the field is not a {@code ChronoField}, then the result of this method + is obtained by invoking {@code TemporalField.rangeRefinedBy(TemporalAccessor)} + passing {@code this} as the argument. + Whether the range can be obtained is determined by the field. + + @param field the field to query the range for, not null + @return the range of valid values for the field, not null + @throws DateTimeException if the range for the field cannot be obtained + @throws UnsupportedTemporalTypeException if the field is not supported" + {:arglists (quote (["java.time.MonthDay" + "java.time.temporal.TemporalField"]))} + (^js/JSJoda.ValueRange + [^js/JSJoda.MonthDay this ^js/JSJoda.TemporalField field] + (.range this field))) + +(defn of + {:arglists (quote (["int" "int"] ["java.time.Month" "int"]))} + (^js/JSJoda.MonthDay [arg0 arg1] + (js-invoke java.time.MonthDay "of" arg0 arg1))) + +(defn with-month + "Returns a copy of this {@code MonthDay} with the month-of-year altered. + + This returns a month-day with the specified month. + If the day-of-month is invalid for the specified month, the day will + be adjusted to the last valid day-of-month. + + This instance is immutable and unaffected by this method call. + + @param month the month-of-year to set in the returned month-day, from 1 (January) to 12 (December) + @return a {@code MonthDay} based on this month-day with the requested month, not null + @throws DateTimeException if the month-of-year value is invalid" + {:arglists (quote (["java.time.MonthDay" "int"]))} + (^js/JSJoda.MonthDay [^js/JSJoda.MonthDay this ^int month] + (.withMonth this month))) + +(defn query + "Queries this month-day using the specified query. + + This queries this month-day using the specified query strategy object. + The {@code TemporalQuery} object defines the logic to be used to + obtain the result. Read the documentation of the query to understand + what the result of this method will be. + + The result of this method is obtained by invoking the + {@link TemporalQuery#queryFrom(TemporalAccessor)} method on the + specified query passing {@code this} as the argument. + + @param the type of the result + @param query the query to invoke, not null + @return the query result, null may be returned (defined by the query) + @throws DateTimeException if unable to query (defined by the query) + @throws ArithmeticException if numeric overflow occurs (defined by the query)" + {:arglists (quote (["java.time.MonthDay" + "java.time.temporal.TemporalQuery"]))} + (^java.lang.Object [^js/JSJoda.MonthDay this ^js/JSJoda.TemporalQuery query] + (.query this query))) + +(defn to-string + "Outputs this month-day as a {@code String}, such as {@code --12-03}. + + The output will be in the format {@code --MM-dd}: + + @return a string representation of this month-day, not null" + {:arglists (quote (["java.time.MonthDay"]))} + (^java.lang.String [^js/JSJoda.MonthDay this] (.toString this))) + +(defn is-before + "Checks if this month-day is before the specified month-day. + + @param other the other month-day to compare to, not null + @return true if this point is before the specified month-day" + {:arglists (quote (["java.time.MonthDay" "java.time.MonthDay"]))} + (^boolean [^js/JSJoda.MonthDay this ^js/JSJoda.MonthDay other] + (.isBefore this other))) + +(defn get-long + "Gets the value of the specified field from this month-day as a {@code long}. + + This queries this month-day for the value of the specified field. + If it is not possible to return the value, because the field is not supported + or for some other reason, an exception is thrown. + + If the field is a {@link ChronoField} then the query is implemented here. + The {@link #isSupported(TemporalField) supported fields} will return valid + values based on this month-day. + All other {@code ChronoField} instances will throw an {@code UnsupportedTemporalTypeException}. + + If the field is not a {@code ChronoField}, then the result of this method + is obtained by invoking {@code TemporalField.getFrom(TemporalAccessor)} + passing {@code this} as the argument. Whether the value can be obtained, + and what the value represents, is determined by the field. + + @param field the field to get, not null + @return the value for the field + @throws DateTimeException if a value for the field cannot be obtained + @throws UnsupportedTemporalTypeException if the field is not supported + @throws ArithmeticException if numeric overflow occurs" + {:arglists (quote (["java.time.MonthDay" + "java.time.temporal.TemporalField"]))} + (^long [^js/JSJoda.MonthDay this ^js/JSJoda.TemporalField field] + (.getLong this field))) + +(defn with-day-of-month + "Returns a copy of this {@code MonthDay} with the day-of-month altered. + + This returns a month-day with the specified day-of-month. + If the day-of-month is invalid for the month, an exception is thrown. + + This instance is immutable and unaffected by this method call. + + @param dayOfMonth the day-of-month to set in the return month-day, from 1 to 31 + @return a {@code MonthDay} based on this month-day with the requested day, not null + @throws DateTimeException if the day-of-month value is invalid, + or if the day-of-month is invalid for the month" + {:arglists (quote (["java.time.MonthDay" "int"]))} + (^js/JSJoda.MonthDay [^js/JSJoda.MonthDay this ^int day-of-month] + (.withDayOfMonth this day-of-month))) + +(defn get-day-of-month + "Gets the day-of-month field. + + This method returns the primitive {@code int} value for the day-of-month. + + @return the day-of-month, from 1 to 31" + {:arglists (quote (["java.time.MonthDay"]))} + (^int [^js/JSJoda.MonthDay this] (.dayOfMonth this))) + +(defn from + "Obtains an instance of {@code MonthDay} from a temporal object. + + This obtains a month-day based on the specified temporal. + A {@code TemporalAccessor} represents an arbitrary set of date and time information, + which this factory converts to an instance of {@code MonthDay}. + + The conversion extracts the {@link ChronoField#MONTH_OF_YEAR MONTH_OF_YEAR} and + {@link ChronoField#DAY_OF_MONTH DAY_OF_MONTH} fields. + The extraction is only permitted if the temporal object has an ISO + chronology, or can be converted to a {@code LocalDate}. + + This method matches the signature of the functional interface {@link TemporalQuery} + allowing it to be used as a query via method reference, {@code MonthDay::from}. + + @param temporal the temporal object to convert, not null + @return the month-day, not null + @throws DateTimeException if unable to convert to a {@code MonthDay}" + {:arglists (quote (["java.time.temporal.TemporalAccessor"]))} + (^js/JSJoda.MonthDay [^js/JSJoda.TemporalAccessor temporal] + (js-invoke java.time.MonthDay "from" temporal))) + +(defn is-after + "Checks if this month-day is after the specified month-day. + + @param other the other month-day to compare to, not null + @return true if this is after the specified month-day" + {:arglists (quote (["java.time.MonthDay" "java.time.MonthDay"]))} + (^boolean [^js/JSJoda.MonthDay this ^js/JSJoda.MonthDay other] + (.isAfter this other))) + +(defn is-supported + "Checks if the specified field is supported. + + This checks if this month-day can be queried for the specified field. + If false, then calling the {@link #range(TemporalField) range} and + {@link #get(TemporalField) get} methods will throw an exception. + + If the field is a {@link ChronoField} then the query is implemented here. + The supported fields are: +
    +
  • {@code MONTH_OF_YEAR} +
  • {@code YEAR} +
+ All other {@code ChronoField} instances will return false. + + If the field is not a {@code ChronoField}, then the result of this method + is obtained by invoking {@code TemporalField.isSupportedBy(TemporalAccessor)} + passing {@code this} as the argument. + Whether the field is supported is determined by the field. + + @param field the field to check, null returns false + @return true if the field is supported on this month-day, false if not" + {:arglists (quote (["java.time.MonthDay" + "java.time.temporal.TemporalField"]))} + (^boolean [^js/JSJoda.MonthDay this ^js/JSJoda.TemporalField field] + (.isSupported this field))) + +(defn parse + {:arglists (quote (["java.lang.CharSequence"] + ["java.lang.CharSequence" + "java.time.format.DateTimeFormatter"]))} + (^js/JSJoda.MonthDay [^java.lang.CharSequence text] + (js-invoke java.time.MonthDay "parse" text)) + (^js/JSJoda.MonthDay + [^java.lang.CharSequence text ^js/JSJoda.DateTimeFormatter formatter] + (js-invoke java.time.MonthDay "parse" text formatter))) + +(defn is-valid-year + "Checks if the year is valid for this month-day. + + This method checks whether this month and day and the input year form + a valid date. This can only return false for February 29th. + + @param year the year to validate + @return true if the year is valid for this month-day + @see Year#isValidMonthDay(MonthDay)" + {:arglists (quote (["java.time.MonthDay" "int"]))} + (^boolean [^js/JSJoda.MonthDay this ^int year] (.isValidYear this year))) + +(defn hash-code + "A hash code for this month-day. + + @return a suitable hash code" + {:arglists (quote (["java.time.MonthDay"]))} + (^int [^js/JSJoda.MonthDay this] (.hashCode this))) + +(defn adjust-into + "Adjusts the specified temporal object to have this month-day. + + This returns a temporal object of the same observable type as the input + with the month and day-of-month changed to be the same as this. + + The adjustment is equivalent to using {@link Temporal#with(TemporalField, long)} + twice, passing {@link ChronoField#MONTH_OF_YEAR} and + {@link ChronoField#DAY_OF_MONTH} as the fields. + If the specified temporal object does not use the ISO calendar system then + a {@code DateTimeException} is thrown. + + In most cases, it is clearer to reverse the calling pattern by using + {@link Temporal#with(TemporalAdjuster)}: +
+   // these two lines are equivalent, but the second approach is recommended
+   temporal = thisMonthDay.adjustInto(temporal);
+   temporal = temporal.with(thisMonthDay);
+ 
+ + This instance is immutable and unaffected by this method call. + + @param temporal the target object to be adjusted, not null + @return the adjusted object, not null + @throws DateTimeException if unable to make the adjustment + @throws ArithmeticException if numeric overflow occurs" + {:arglists (quote (["java.time.MonthDay" "java.time.temporal.Temporal"]))} + (^js/JSJoda.Temporal [^js/JSJoda.MonthDay this ^js/JSJoda.Temporal temporal] + (.adjustInto this temporal))) + +(defn with + "Returns a copy of this {@code MonthDay} with the month-of-year altered. + + This returns a month-day with the specified month. + If the day-of-month is invalid for the specified month, the day will + be adjusted to the last valid day-of-month. + + This instance is immutable and unaffected by this method call. + + @param month the month-of-year to set in the returned month-day, not null + @return a {@code MonthDay} based on this month-day with the requested month, not null" + {:arglists (quote (["java.time.MonthDay" "java.time.Month"]))} + (^js/JSJoda.MonthDay [^js/JSJoda.MonthDay this ^js/JSJoda.Month month] + (.with this month))) + +(defn now + {:arglists (quote ([] ["java.time.Clock"] ["java.time.ZoneId"]))} + (^js/JSJoda.MonthDay [] (js-invoke java.time.MonthDay "now")) + (^js/JSJoda.MonthDay [arg0] (js-invoke java.time.MonthDay "now" arg0))) + +(defn get-month-value + "Gets the month-of-year field from 1 to 12. + + This method returns the month as an {@code int} from 1 to 12. + Application code is frequently clearer if the enum {@link Month} + is used by calling {@link #getMonth()}. + + @return the month-of-year, from 1 to 12 + @see #getMonth()" + {:arglists (quote (["java.time.MonthDay"]))} + (^int [^js/JSJoda.MonthDay this] (.monthValue this))) + +(defn compare-to + "Compares this month-day to another month-day. + + The comparison is based first on value of the month, then on the value of the day. + It is \"consistent with equals\", as defined by {@link Comparable}. + + @param other the other month-day to compare to, not null + @return the comparator value, negative if less, positive if greater" + {:arglists (quote (["java.time.MonthDay" "java.time.MonthDay"]))} + (^int [^js/JSJoda.MonthDay this ^js/JSJoda.MonthDay other] + (.compareTo this other))) + +(defn get-month + "Gets the month-of-year field using the {@code Month} enum. + + This method returns the enum {@link Month} for the month. + This avoids confusion as to what {@code int} values mean. + If you need access to the primitive {@code int} value then the enum + provides the {@link Month#getValue() int value}. + + @return the month-of-year, not null + @see #getMonthValue()" + {:arglists (quote (["java.time.MonthDay"]))} + (^js/JSJoda.Month [^js/JSJoda.MonthDay this] (.month this))) + +(defn get + "Gets the value of the specified field from this month-day as an {@code int}. + + This queries this month-day for the value of the specified field. + The returned value will always be within the valid range of values for the field. + If it is not possible to return the value, because the field is not supported + or for some other reason, an exception is thrown. + + If the field is a {@link ChronoField} then the query is implemented here. + The {@link #isSupported(TemporalField) supported fields} will return valid + values based on this month-day. + All other {@code ChronoField} instances will throw an {@code UnsupportedTemporalTypeException}. + + If the field is not a {@code ChronoField}, then the result of this method + is obtained by invoking {@code TemporalField.getFrom(TemporalAccessor)} + passing {@code this} as the argument. Whether the value can be obtained, + and what the value represents, is determined by the field. + + @param field the field to get, not null + @return the value for the field + @throws DateTimeException if a value for the field cannot be obtained or + the value is outside the range of valid values for the field + @throws UnsupportedTemporalTypeException if the field is not supported or + the range of values exceeds an {@code int} + @throws ArithmeticException if numeric overflow occurs" + {:arglists (quote (["java.time.MonthDay" + "java.time.temporal.TemporalField"]))} + (^int [^js/JSJoda.MonthDay this ^js/JSJoda.TemporalField field] + (.get this field))) + +(defn equals + "Checks if this month-day is equal to another month-day. + + The comparison is based on the time-line position of the month-day within a year. + + @param obj the object to check, null returns false + @return true if this is equal to the other month-day" + {:arglists (quote (["java.time.MonthDay" "java.lang.Object"]))} + (^boolean [^js/JSJoda.MonthDay this ^java.lang.Object obj] + (.equals this obj))) + +(defn format + "Formats this month-day using the specified formatter. + + This month-day will be passed to the formatter to produce a string. + + @param formatter the formatter to use, not null + @return the formatted month-day string, not null + @throws DateTimeException if an error occurs during printing" + {:arglists (quote (["java.time.MonthDay" + "java.time.format.DateTimeFormatter"]))} + (^java.lang.String + [^js/JSJoda.MonthDay this ^js/JSJoda.DateTimeFormatter formatter] + (.format this formatter))) diff --git a/src/cljc/java_time/offset_date_time.clj b/src/cljc/java_time/offset_date_time.clj index 9f340f1..a4257dd 100644 --- a/src/cljc/java_time/offset_date_time.clj +++ b/src/cljc/java_time/offset_date_time.clj @@ -1,74 +1,1190 @@ -(ns cljc.java-time.offset-date-time (:refer-clojure :exclude [abs get range format min max next name resolve short]) (:require [cljc.java-time.extn.calendar-awareness]) (:import [java.time OffsetDateTime])) -(def min java.time.OffsetDateTime/MIN) -(def max java.time.OffsetDateTime/MAX) -(clojure.core/defn minus-minutes {:arglists (quote (["java.time.OffsetDateTime" "long"]))} (^java.time.OffsetDateTime [^java.time.OffsetDateTime this14190 ^long long14191] (.minusMinutes this14190 long14191))) -(clojure.core/defn truncated-to {:arglists (quote (["java.time.OffsetDateTime" "java.time.temporal.TemporalUnit"]))} (^java.time.OffsetDateTime [^java.time.OffsetDateTime this14192 ^java.time.temporal.ChronoUnit java-time-temporal-TemporalUnit14193] (.truncatedTo this14192 java-time-temporal-TemporalUnit14193))) -(clojure.core/defn minus-weeks {:arglists (quote (["java.time.OffsetDateTime" "long"]))} (^java.time.OffsetDateTime [^java.time.OffsetDateTime this14194 ^long long14195] (.minusWeeks this14194 long14195))) -(clojure.core/defn to-instant {:arglists (quote (["java.time.OffsetDateTime"]))} (^java.time.Instant [^java.time.OffsetDateTime this14196] (.toInstant this14196))) -(clojure.core/defn plus-weeks {:arglists (quote (["java.time.OffsetDateTime" "long"]))} (^java.time.OffsetDateTime [^java.time.OffsetDateTime this14197 ^long long14198] (.plusWeeks this14197 long14198))) -(clojure.core/defn range {:arglists (quote (["java.time.OffsetDateTime" "java.time.temporal.TemporalField"]))} (^java.time.temporal.ValueRange [^java.time.OffsetDateTime this14199 ^java.time.temporal.TemporalField java-time-temporal-TemporalField14200] (.range this14199 java-time-temporal-TemporalField14200))) -(clojure.core/defn get-hour {:arglists (quote (["java.time.OffsetDateTime"]))} (^java.lang.Integer [^java.time.OffsetDateTime this14201] (.getHour this14201))) -(clojure.core/defn at-zone-same-instant {:arglists (quote (["java.time.OffsetDateTime" "java.time.ZoneId"]))} (^java.time.ZonedDateTime [^java.time.OffsetDateTime this14202 ^java.time.ZoneId java-time-ZoneId14203] (.atZoneSameInstant this14202 java-time-ZoneId14203))) -(clojure.core/defn minus-hours {:arglists (quote (["java.time.OffsetDateTime" "long"]))} (^java.time.OffsetDateTime [^java.time.OffsetDateTime this14204 ^long long14205] (.minusHours this14204 long14205))) -(clojure.core/defn of {:arglists (quote (["java.time.LocalDate" "java.time.LocalTime" "java.time.ZoneOffset"] ["java.time.LocalDateTime" "java.time.ZoneOffset"] ["int" "int" "int" "int" "int" "int" "int" "java.time.ZoneOffset"]))} (^java.time.OffsetDateTime [^java.time.LocalDate java-time-LocalDate14206 ^java.time.LocalTime java-time-LocalTime14207 ^java.time.ZoneOffset java-time-ZoneOffset14208] (java.time.OffsetDateTime/of java-time-LocalDate14206 java-time-LocalTime14207 java-time-ZoneOffset14208)) (^java.time.OffsetDateTime [^java.time.LocalDateTime java-time-LocalDateTime14209 ^java.time.ZoneOffset java-time-ZoneOffset14210] (java.time.OffsetDateTime/of java-time-LocalDateTime14209 java-time-ZoneOffset14210)) (^java.time.OffsetDateTime [^java.lang.Integer int14211 ^java.lang.Integer int14212 ^java.lang.Integer int14213 ^java.lang.Integer int14214 ^java.lang.Integer int14215 ^java.lang.Integer int14216 ^java.lang.Integer int14217 ^java.time.ZoneOffset java-time-ZoneOffset14218] (java.time.OffsetDateTime/of int14211 int14212 int14213 int14214 int14215 int14216 int14217 java-time-ZoneOffset14218))) -(clojure.core/defn with-month {:arglists (quote (["java.time.OffsetDateTime" "int"]))} (^java.time.OffsetDateTime [^java.time.OffsetDateTime this14219 ^java.lang.Integer int14220] (.withMonth this14219 int14220))) -(clojure.core/defn is-equal {:arglists (quote (["java.time.OffsetDateTime" "java.time.OffsetDateTime"]))} (^java.lang.Boolean [^java.time.OffsetDateTime this14221 ^java.time.OffsetDateTime java-time-OffsetDateTime14222] (.isEqual this14221 java-time-OffsetDateTime14222))) -(clojure.core/defn get-nano {:arglists (quote (["java.time.OffsetDateTime"]))} (^java.lang.Integer [^java.time.OffsetDateTime this14223] (.getNano this14223))) -(clojure.core/defn to-offset-time {:arglists (quote (["java.time.OffsetDateTime"]))} (^java.time.OffsetTime [^java.time.OffsetDateTime this14224] (.toOffsetTime this14224))) -(clojure.core/defn at-zone-similar-local {:arglists (quote (["java.time.OffsetDateTime" "java.time.ZoneId"]))} (^java.time.ZonedDateTime [^java.time.OffsetDateTime this14225 ^java.time.ZoneId java-time-ZoneId14226] (.atZoneSimilarLocal this14225 java-time-ZoneId14226))) -(clojure.core/defn get-year {:arglists (quote (["java.time.OffsetDateTime"]))} (^java.lang.Integer [^java.time.OffsetDateTime this14227] (.getYear this14227))) -(clojure.core/defn minus-seconds {:arglists (quote (["java.time.OffsetDateTime" "long"]))} (^java.time.OffsetDateTime [^java.time.OffsetDateTime this14228 ^long long14229] (.minusSeconds this14228 long14229))) -(clojure.core/defn get-second {:arglists (quote (["java.time.OffsetDateTime"]))} (^java.lang.Integer [^java.time.OffsetDateTime this14230] (.getSecond this14230))) -(clojure.core/defn plus-nanos {:arglists (quote (["java.time.OffsetDateTime" "long"]))} (^java.time.OffsetDateTime [^java.time.OffsetDateTime this14231 ^long long14232] (.plusNanos this14231 long14232))) -(clojure.core/defn get-day-of-year {:arglists (quote (["java.time.OffsetDateTime"]))} (^java.lang.Integer [^java.time.OffsetDateTime this14233] (.getDayOfYear this14233))) -(clojure.core/defn plus {:arglists (quote (["java.time.OffsetDateTime" "java.time.temporal.TemporalAmount"] ["java.time.OffsetDateTime" "long" "java.time.temporal.TemporalUnit"]))} (^java.time.OffsetDateTime [^java.time.OffsetDateTime this14234 ^java.time.temporal.TemporalAmount java-time-temporal-TemporalAmount14235] (.plus this14234 java-time-temporal-TemporalAmount14235)) (^java.time.OffsetDateTime [^java.time.OffsetDateTime this14236 ^long long14237 ^java.time.temporal.ChronoUnit java-time-temporal-TemporalUnit14238] (.plus this14236 long14237 java-time-temporal-TemporalUnit14238))) -(clojure.core/defn time-line-order {:arglists (quote ([]))} (^java.util.Comparator [] (java.time.OffsetDateTime/timeLineOrder))) -(clojure.core/defn with-hour {:arglists (quote (["java.time.OffsetDateTime" "int"]))} (^java.time.OffsetDateTime [^java.time.OffsetDateTime this14239 ^java.lang.Integer int14240] (.withHour this14239 int14240))) -(clojure.core/defn with-minute {:arglists (quote (["java.time.OffsetDateTime" "int"]))} (^java.time.OffsetDateTime [^java.time.OffsetDateTime this14241 ^java.lang.Integer int14242] (.withMinute this14241 int14242))) -(clojure.core/defn plus-minutes {:arglists (quote (["java.time.OffsetDateTime" "long"]))} (^java.time.OffsetDateTime [^java.time.OffsetDateTime this14243 ^long long14244] (.plusMinutes this14243 long14244))) -(clojure.core/defn query {:arglists (quote (["java.time.OffsetDateTime" "java.time.temporal.TemporalQuery"]))} (^java.lang.Object [^java.time.OffsetDateTime this14245 ^java.time.temporal.TemporalQuery java-time-temporal-TemporalQuery14246] (.query this14245 java-time-temporal-TemporalQuery14246))) -(clojure.core/defn with-offset-same-instant {:arglists (quote (["java.time.OffsetDateTime" "java.time.ZoneOffset"]))} (^java.time.OffsetDateTime [^java.time.OffsetDateTime this14247 ^java.time.ZoneOffset java-time-ZoneOffset14248] (.withOffsetSameInstant this14247 java-time-ZoneOffset14248))) -(clojure.core/defn get-day-of-week {:arglists (quote (["java.time.OffsetDateTime"]))} (^java.time.DayOfWeek [^java.time.OffsetDateTime this14249] (.getDayOfWeek this14249))) -(clojure.core/defn to-string {:arglists (quote (["java.time.OffsetDateTime"]))} (^java.lang.String [^java.time.OffsetDateTime this14250] (.toString this14250))) -(clojure.core/defn plus-months {:arglists (quote (["java.time.OffsetDateTime" "long"]))} (^java.time.OffsetDateTime [^java.time.OffsetDateTime this14251 ^long long14252] (.plusMonths this14251 long14252))) -(clojure.core/defn is-before {:arglists (quote (["java.time.OffsetDateTime" "java.time.OffsetDateTime"]))} (^java.lang.Boolean [^java.time.OffsetDateTime this14253 ^java.time.OffsetDateTime java-time-OffsetDateTime14254] (.isBefore this14253 java-time-OffsetDateTime14254))) -(clojure.core/defn minus-months {:arglists (quote (["java.time.OffsetDateTime" "long"]))} (^java.time.OffsetDateTime [^java.time.OffsetDateTime this14255 ^long long14256] (.minusMonths this14255 long14256))) -(clojure.core/defn minus {:arglists (quote (["java.time.OffsetDateTime" "long" "java.time.temporal.TemporalUnit"] ["java.time.OffsetDateTime" "java.time.temporal.TemporalAmount"]))} (^java.time.OffsetDateTime [^java.time.OffsetDateTime this14257 ^long long14258 ^java.time.temporal.ChronoUnit java-time-temporal-TemporalUnit14259] (.minus this14257 long14258 java-time-temporal-TemporalUnit14259)) (^java.time.OffsetDateTime [^java.time.OffsetDateTime this14260 ^java.time.temporal.TemporalAmount java-time-temporal-TemporalAmount14261] (.minus this14260 java-time-temporal-TemporalAmount14261))) -(clojure.core/defn plus-hours {:arglists (quote (["java.time.OffsetDateTime" "long"]))} (^java.time.OffsetDateTime [^java.time.OffsetDateTime this14262 ^long long14263] (.plusHours this14262 long14263))) -(clojure.core/defn plus-days {:arglists (quote (["java.time.OffsetDateTime" "long"]))} (^java.time.OffsetDateTime [^java.time.OffsetDateTime this14264 ^long long14265] (.plusDays this14264 long14265))) -(clojure.core/defn to-local-time {:arglists (quote (["java.time.OffsetDateTime"]))} (^java.time.LocalTime [^java.time.OffsetDateTime this14266] (.toLocalTime this14266))) -(clojure.core/defn get-long {:arglists (quote (["java.time.OffsetDateTime" "java.time.temporal.TemporalField"]))} (^long [^java.time.OffsetDateTime this14267 ^java.time.temporal.TemporalField java-time-temporal-TemporalField14268] (.getLong this14267 java-time-temporal-TemporalField14268))) -(clojure.core/defn get-offset {:arglists (quote (["java.time.OffsetDateTime"]))} (^java.time.ZoneOffset [^java.time.OffsetDateTime this14269] (.getOffset this14269))) -(clojure.core/defn to-zoned-date-time {:arglists (quote (["java.time.OffsetDateTime"]))} (^java.time.ZonedDateTime [^java.time.OffsetDateTime this14270] (.toZonedDateTime this14270))) -(clojure.core/defn with-year {:arglists (quote (["java.time.OffsetDateTime" "int"]))} (^java.time.OffsetDateTime [^java.time.OffsetDateTime this14271 ^java.lang.Integer int14272] (.withYear this14271 int14272))) -(clojure.core/defn with-nano {:arglists (quote (["java.time.OffsetDateTime" "int"]))} (^java.time.OffsetDateTime [^java.time.OffsetDateTime this14273 ^java.lang.Integer int14274] (.withNano this14273 int14274))) -(clojure.core/defn to-epoch-second {:arglists (quote (["java.time.OffsetDateTime"]))} (^long [^java.time.OffsetDateTime this14275] (.toEpochSecond this14275))) -(clojure.core/defn until {:arglists (quote (["java.time.OffsetDateTime" "java.time.temporal.Temporal" "java.time.temporal.TemporalUnit"]))} (^long [^java.time.OffsetDateTime this14276 ^java.time.temporal.Temporal java-time-temporal-Temporal14277 ^java.time.temporal.ChronoUnit java-time-temporal-TemporalUnit14278] (.until this14276 java-time-temporal-Temporal14277 java-time-temporal-TemporalUnit14278))) -(clojure.core/defn with-offset-same-local {:arglists (quote (["java.time.OffsetDateTime" "java.time.ZoneOffset"]))} (^java.time.OffsetDateTime [^java.time.OffsetDateTime this14279 ^java.time.ZoneOffset java-time-ZoneOffset14280] (.withOffsetSameLocal this14279 java-time-ZoneOffset14280))) -(clojure.core/defn with-day-of-month {:arglists (quote (["java.time.OffsetDateTime" "int"]))} (^java.time.OffsetDateTime [^java.time.OffsetDateTime this14281 ^java.lang.Integer int14282] (.withDayOfMonth this14281 int14282))) -(clojure.core/defn get-day-of-month {:arglists (quote (["java.time.OffsetDateTime"]))} (^java.lang.Integer [^java.time.OffsetDateTime this14283] (.getDayOfMonth this14283))) -(clojure.core/defn from {:arglists (quote (["java.time.temporal.TemporalAccessor"]))} (^java.time.OffsetDateTime [^java.time.temporal.TemporalAccessor java-time-temporal-TemporalAccessor14284] (java.time.OffsetDateTime/from java-time-temporal-TemporalAccessor14284))) -(clojure.core/defn is-after {:arglists (quote (["java.time.OffsetDateTime" "java.time.OffsetDateTime"]))} (^java.lang.Boolean [^java.time.OffsetDateTime this14285 ^java.time.OffsetDateTime java-time-OffsetDateTime14286] (.isAfter this14285 java-time-OffsetDateTime14286))) -(clojure.core/defn minus-nanos {:arglists (quote (["java.time.OffsetDateTime" "long"]))} (^java.time.OffsetDateTime [^java.time.OffsetDateTime this14287 ^long long14288] (.minusNanos this14287 long14288))) -(clojure.core/defn is-supported {:arglists (quote (["java.time.OffsetDateTime" "java.time.temporal.TemporalUnit"] ["java.time.OffsetDateTime" "java.time.temporal.TemporalField"]))} (^java.lang.Boolean [this14289 G__14290] (clojure.core/cond (clojure.core/and (clojure.core/instance? java.time.temporal.ChronoUnit G__14290)) (clojure.core/let [G__14290 ^"java.time.temporal.ChronoUnit" G__14290] (.isSupported ^java.time.OffsetDateTime this14289 G__14290)) (clojure.core/and (clojure.core/instance? java.time.temporal.TemporalField G__14290)) (clojure.core/let [G__14290 ^"java.time.temporal.TemporalField" G__14290] (.isSupported ^java.time.OffsetDateTime this14289 G__14290)) :else (throw (java.lang.IllegalArgumentException. "no corresponding java.time method with these args"))))) -(clojure.core/defn minus-years {:arglists (quote (["java.time.OffsetDateTime" "long"]))} (^java.time.OffsetDateTime [^java.time.OffsetDateTime this14291 ^long long14292] (.minusYears this14291 long14292))) -(clojure.core/defn parse {:arglists (quote (["java.lang.CharSequence" "java.time.format.DateTimeFormatter"] ["java.lang.CharSequence"]))} (^java.time.OffsetDateTime [^java.lang.CharSequence java-lang-CharSequence14293 ^java.time.format.DateTimeFormatter java-time-format-DateTimeFormatter14294] (java.time.OffsetDateTime/parse java-lang-CharSequence14293 java-time-format-DateTimeFormatter14294)) (^java.time.OffsetDateTime [^java.lang.CharSequence java-lang-CharSequence14295] (java.time.OffsetDateTime/parse java-lang-CharSequence14295))) -(clojure.core/defn with-second {:arglists (quote (["java.time.OffsetDateTime" "int"]))} (^java.time.OffsetDateTime [^java.time.OffsetDateTime this14296 ^java.lang.Integer int14297] (.withSecond this14296 int14297))) -(clojure.core/defn to-local-date {:arglists (quote (["java.time.OffsetDateTime"]))} (^java.time.LocalDate [^java.time.OffsetDateTime this14298] (.toLocalDate this14298))) -(clojure.core/defn get-minute {:arglists (quote (["java.time.OffsetDateTime"]))} (^java.lang.Integer [^java.time.OffsetDateTime this14299] (.getMinute this14299))) -(clojure.core/defn hash-code {:arglists (quote (["java.time.OffsetDateTime"]))} (^java.lang.Integer [^java.time.OffsetDateTime this14300] (.hashCode this14300))) -(clojure.core/defn adjust-into {:arglists (quote (["java.time.OffsetDateTime" "java.time.temporal.Temporal"]))} (^java.time.temporal.Temporal [^java.time.OffsetDateTime this14301 ^java.time.temporal.Temporal java-time-temporal-Temporal14302] (.adjustInto this14301 java-time-temporal-Temporal14302))) -(clojure.core/defn with {:arglists (quote (["java.time.OffsetDateTime" "java.time.temporal.TemporalAdjuster"] ["java.time.OffsetDateTime" "java.time.temporal.TemporalField" "long"]))} (^java.time.OffsetDateTime [^java.time.OffsetDateTime this14303 ^java.time.temporal.TemporalAdjuster java-time-temporal-TemporalAdjuster14304] (.with this14303 java-time-temporal-TemporalAdjuster14304)) (^java.time.OffsetDateTime [^java.time.OffsetDateTime this14305 ^java.time.temporal.TemporalField java-time-temporal-TemporalField14306 ^long long14307] (.with this14305 java-time-temporal-TemporalField14306 long14307))) -(clojure.core/defn now {:arglists (quote (["java.time.ZoneId"] ["java.time.Clock"] []))} (^java.time.OffsetDateTime [G__14309] (clojure.core/cond (clojure.core/and (clojure.core/instance? java.time.ZoneId G__14309)) (clojure.core/let [G__14309 ^"java.time.ZoneId" G__14309] (java.time.OffsetDateTime/now G__14309)) (clojure.core/and (clojure.core/instance? java.time.Clock G__14309)) (clojure.core/let [G__14309 ^"java.time.Clock" G__14309] (java.time.OffsetDateTime/now G__14309)) :else (throw (java.lang.IllegalArgumentException. "no corresponding java.time method with these args")))) (^java.time.OffsetDateTime [] (java.time.OffsetDateTime/now))) -(clojure.core/defn to-local-date-time {:arglists (quote (["java.time.OffsetDateTime"]))} (^java.time.LocalDateTime [^java.time.OffsetDateTime this14310] (.toLocalDateTime this14310))) -(clojure.core/defn get-month-value {:arglists (quote (["java.time.OffsetDateTime"]))} (^java.lang.Integer [^java.time.OffsetDateTime this14311] (.getMonthValue this14311))) -(clojure.core/defn with-day-of-year {:arglists (quote (["java.time.OffsetDateTime" "int"]))} (^java.time.OffsetDateTime [^java.time.OffsetDateTime this14312 ^java.lang.Integer int14313] (.withDayOfYear this14312 int14313))) -(clojure.core/defn compare-to {:arglists (quote (["java.time.OffsetDateTime" "java.time.OffsetDateTime"]))} (^java.lang.Integer [^java.time.OffsetDateTime this14314 ^java.time.OffsetDateTime java-time-OffsetDateTime14315] (.compareTo this14314 java-time-OffsetDateTime14315))) -(clojure.core/defn get-month {:arglists (quote (["java.time.OffsetDateTime"]))} (^java.time.Month [^java.time.OffsetDateTime this14316] (.getMonth this14316))) -(clojure.core/defn of-instant {:arglists (quote (["java.time.Instant" "java.time.ZoneId"]))} (^java.time.OffsetDateTime [^java.time.Instant java-time-Instant14317 ^java.time.ZoneId java-time-ZoneId14318] (java.time.OffsetDateTime/ofInstant java-time-Instant14317 java-time-ZoneId14318))) -(clojure.core/defn plus-seconds {:arglists (quote (["java.time.OffsetDateTime" "long"]))} (^java.time.OffsetDateTime [^java.time.OffsetDateTime this14319 ^long long14320] (.plusSeconds this14319 long14320))) -(clojure.core/defn get {:arglists (quote (["java.time.OffsetDateTime" "java.time.temporal.TemporalField"]))} (^java.lang.Integer [^java.time.OffsetDateTime this14321 ^java.time.temporal.TemporalField java-time-temporal-TemporalField14322] (.get this14321 java-time-temporal-TemporalField14322))) -(clojure.core/defn equals {:arglists (quote (["java.time.OffsetDateTime" "java.lang.Object"]))} (^java.lang.Boolean [^java.time.OffsetDateTime this14323 ^java.lang.Object java-lang-Object14324] (.equals this14323 java-lang-Object14324))) -(clojure.core/defn format {:arglists (quote (["java.time.OffsetDateTime" "java.time.format.DateTimeFormatter"]))} (^java.lang.String [^java.time.OffsetDateTime this14325 ^java.time.format.DateTimeFormatter java-time-format-DateTimeFormatter14326] (.format this14325 java-time-format-DateTimeFormatter14326))) -(clojure.core/defn plus-years {:arglists (quote (["java.time.OffsetDateTime" "long"]))} (^java.time.OffsetDateTime [^java.time.OffsetDateTime this14327 ^long long14328] (.plusYears this14327 long14328))) -(clojure.core/defn minus-days {:arglists (quote (["java.time.OffsetDateTime" "long"]))} (^java.time.OffsetDateTime [^java.time.OffsetDateTime this14329 ^long long14330] (.minusDays this14329 long14330))) +(ns cljc.java-time.offset-date-time + (:refer-clojure :exclude + [abs get range format min max next name resolve short]) + (:require [cljc.java-time.extn.calendar-awareness]) + (:import [java.time OffsetDateTime])) + +(def min + "The minimum supported {@code OffsetDateTime}, '-999999999-01-01T00:00:00+18:00'. + This is the local date-time of midnight at the start of the minimum date + in the maximum offset (larger offsets are earlier on the time-line). + This combines {@link LocalDateTime#MIN} and {@link ZoneOffset#MAX}. + This could be used by an application as a \"far past\" date-time." + java.time.OffsetDateTime/MIN) + +(def max + "The maximum supported {@code OffsetDateTime}, '+999999999-12-31T23:59:59.999999999-18:00'. + This is the local date-time just before midnight at the end of the maximum date + in the minimum offset (larger negative offsets are later on the time-line). + This combines {@link LocalDateTime#MAX} and {@link ZoneOffset#MIN}. + This could be used by an application as a \"far future\" date-time." + java.time.OffsetDateTime/MAX) + +(defn minus-minutes + "Returns a copy of this {@code OffsetDateTime} with the specified number of minutes subtracted. + + This instance is immutable and unaffected by this method call. + + @param minutes the minutes to subtract, may be negative + @return an {@code OffsetDateTime} based on this date-time with the minutes subtracted, not null + @throws DateTimeException if the result exceeds the supported date range" + {:arglists (quote (["java.time.OffsetDateTime" "long"]))} + (^java.time.OffsetDateTime [^java.time.OffsetDateTime this ^long minutes] + (.minusMinutes this minutes))) + +(defn truncated-to + "Returns a copy of this {@code OffsetDateTime} with the time truncated. + + Truncation returns a copy of the original date-time with fields + smaller than the specified unit set to zero. + For example, truncating with the {@link ChronoUnit#MINUTES minutes} unit + will set the second-of-minute and nano-of-second field to zero. + + The unit must have a {@linkplain TemporalUnit#getDuration() duration} + that divides into the length of a standard day without remainder. + This includes all supplied time units on {@link ChronoUnit} and + {@link ChronoUnit#DAYS DAYS}. Other units throw an exception. + + The offset does not affect the calculation and will be the same in the result. + + This instance is immutable and unaffected by this method call. + + @param unit the unit to truncate to, not null + @return an {@code OffsetDateTime} based on this date-time with the time truncated, not null + @throws DateTimeException if unable to truncate + @throws UnsupportedTemporalTypeException if the unit is not supported" + {:arglists (quote (["java.time.OffsetDateTime" + "java.time.temporal.TemporalUnit"]))} + (^java.time.OffsetDateTime + [^java.time.OffsetDateTime this ^java.time.temporal.ChronoUnit unit] + (.truncatedTo this unit))) + +(defn minus-weeks + "Returns a copy of this {@code OffsetDateTime} with the specified number of weeks subtracted. + + This method subtracts the specified amount in weeks from the days field decrementing + the month and year fields as necessary to ensure the result remains valid. + The result is only invalid if the maximum/minimum year is exceeded. + + For example, 2008-12-31 minus one week would result in 2009-01-07. + + This instance is immutable and unaffected by this method call. + + @param weeks the weeks to subtract, may be negative + @return an {@code OffsetDateTime} based on this date-time with the weeks subtracted, not null + @throws DateTimeException if the result exceeds the supported date range" + {:arglists (quote (["java.time.OffsetDateTime" "long"]))} + (^java.time.OffsetDateTime [^java.time.OffsetDateTime this ^long weeks] + (.minusWeeks this weeks))) + +(defn to-instant + "Converts this date-time to an {@code Instant}. + + This returns an {@code Instant} representing the same point on the + time-line as this date-time. + + @return an {@code Instant} representing the same instant, not null" + {:arglists (quote (["java.time.OffsetDateTime"]))} + (^java.time.Instant [^java.time.OffsetDateTime this] (.toInstant this))) + +(defn plus-weeks + "Returns a copy of this OffsetDateTime with the specified number of weeks added. + + This method adds the specified amount in weeks to the days field incrementing + the month and year fields as necessary to ensure the result remains valid. + The result is only invalid if the maximum/minimum year is exceeded. + + For example, 2008-12-31 plus one week would result in 2009-01-07. + + This instance is immutable and unaffected by this method call. + + @param weeks the weeks to add, may be negative + @return an {@code OffsetDateTime} based on this date-time with the weeks added, not null + @throws DateTimeException if the result exceeds the supported date range" + {:arglists (quote (["java.time.OffsetDateTime" "long"]))} + (^java.time.OffsetDateTime [^java.time.OffsetDateTime this ^long weeks] + (.plusWeeks this weeks))) + +(defn range + "Gets the range of valid values for the specified field. + + The range object expresses the minimum and maximum valid values for a field. + This date-time is used to enhance the accuracy of the returned range. + If it is not possible to return the range, because the field is not supported + or for some other reason, an exception is thrown. + + If the field is a {@link ChronoField} then the query is implemented here. + The {@link #isSupported(TemporalField) supported fields} will return + appropriate range instances. + All other {@code ChronoField} instances will throw an {@code UnsupportedTemporalTypeException}. + + If the field is not a {@code ChronoField}, then the result of this method + is obtained by invoking {@code TemporalField.rangeRefinedBy(TemporalAccessor)} + passing {@code this} as the argument. + Whether the range can be obtained is determined by the field. + + @param field the field to query the range for, not null + @return the range of valid values for the field, not null + @throws DateTimeException if the range for the field cannot be obtained + @throws UnsupportedTemporalTypeException if the field is not supported" + {:arglists (quote (["java.time.OffsetDateTime" + "java.time.temporal.TemporalField"]))} + (^java.time.temporal.ValueRange + [^java.time.OffsetDateTime this ^java.time.temporal.TemporalField field] + (.range this field))) + +(defn get-hour + "Gets the hour-of-day field. + + @return the hour-of-day, from 0 to 23" + {:arglists (quote (["java.time.OffsetDateTime"]))} + (^java.lang.Integer [^java.time.OffsetDateTime this] (.getHour this))) + +(defn at-zone-same-instant + "Combines this date-time with a time-zone to create a {@code ZonedDateTime} + ensuring that the result has the same instant. + + This returns a {@code ZonedDateTime} formed from this date-time and the specified time-zone. + This conversion will ignore the visible local date-time and use the underlying instant instead. + This avoids any problems with local time-line gaps or overlaps. + The result might have different values for fields such as hour, minute an even day. + + To attempt to retain the values of the fields, use {@link #atZoneSimilarLocal(ZoneId)}. + To use the offset as the zone ID, use {@link #toZonedDateTime()}. + + @param zone the time-zone to use, not null + @return the zoned date-time formed from this date-time, not null" + {:arglists (quote (["java.time.OffsetDateTime" "java.time.ZoneId"]))} + (^java.time.ZonedDateTime + [^java.time.OffsetDateTime this ^java.time.ZoneId zone] + (.atZoneSameInstant this zone))) + +(defn minus-hours + "Returns a copy of this {@code OffsetDateTime} with the specified number of hours subtracted. + + This instance is immutable and unaffected by this method call. + + @param hours the hours to subtract, may be negative + @return an {@code OffsetDateTime} based on this date-time with the hours subtracted, not null + @throws DateTimeException if the result exceeds the supported date range" + {:arglists (quote (["java.time.OffsetDateTime" "long"]))} + (^java.time.OffsetDateTime [^java.time.OffsetDateTime this ^long hours] + (.minusHours this hours))) + +(defn of + {:arglists (quote (["java.time.LocalDateTime" "java.time.ZoneOffset"] + ["java.time.LocalDate" "java.time.LocalTime" + "java.time.ZoneOffset"] + ["int" "int" "int" "int" "int" "int" "int" + "java.time.ZoneOffset"]))} + (^java.time.OffsetDateTime + [^java.time.LocalDateTime date-time ^java.time.ZoneOffset offset] + (java.time.OffsetDateTime/of date-time offset)) + (^java.time.OffsetDateTime + [^java.time.LocalDate date ^java.time.LocalTime time + ^java.time.ZoneOffset offset] + (java.time.OffsetDateTime/of date time offset)) + (^java.time.OffsetDateTime + [^java.lang.Integer year ^java.lang.Integer month + ^java.lang.Integer day-of-month ^java.lang.Integer hour + ^java.lang.Integer minute ^java.lang.Integer second + ^java.lang.Integer nano-of-second ^java.time.ZoneOffset offset] + (java.time.OffsetDateTime/of year + month + day-of-month + hour + minute + second + nano-of-second + offset))) + +(defn with-month + "Returns a copy of this {@code OffsetDateTime} with the month-of-year altered. + + The time and offset do not affect the calculation and will be the same in the result. + If the day-of-month is invalid for the year, it will be changed to the last valid day of the month. + + This instance is immutable and unaffected by this method call. + + @param month the month-of-year to set in the result, from 1 (January) to 12 (December) + @return an {@code OffsetDateTime} based on this date-time with the requested month, not null + @throws DateTimeException if the month-of-year value is invalid" + {:arglists (quote (["java.time.OffsetDateTime" "int"]))} + (^java.time.OffsetDateTime + [^java.time.OffsetDateTime this ^java.lang.Integer month] + (.withMonth this month))) + +(defn is-equal + "Checks if the instant of this date-time is equal to that of the specified date-time. + + This method differs from the comparison in {@link #compareTo} and {@link #equals} + in that it only compares the instant of the date-time. This is equivalent to using + {@code dateTime1.toInstant().equals(dateTime2.toInstant());}. + + @param other the other date-time to compare to, not null + @return true if the instant equals the instant of the specified date-time" + {:arglists (quote (["java.time.OffsetDateTime" "java.time.OffsetDateTime"]))} + (^java.lang.Boolean + [^java.time.OffsetDateTime this ^java.time.OffsetDateTime other] + (.isEqual this other))) + +(defn get-nano + "Gets the nano-of-second field. + + @return the nano-of-second, from 0 to 999,999,999" + {:arglists (quote (["java.time.OffsetDateTime"]))} + (^java.lang.Integer [^java.time.OffsetDateTime this] (.getNano this))) + +(defn to-offset-time + "Converts this date-time to an {@code OffsetTime}. + + This returns an offset time with the same local time and offset. + + @return an OffsetTime representing the time and offset, not null" + {:arglists (quote (["java.time.OffsetDateTime"]))} + (^java.time.OffsetTime [^java.time.OffsetDateTime this] (.toOffsetTime this))) + +(defn at-zone-similar-local + "Combines this date-time with a time-zone to create a {@code ZonedDateTime} + trying to keep the same local date and time. + + This returns a {@code ZonedDateTime} formed from this date-time and the specified time-zone. + Where possible, the result will have the same local date-time as this object. + + Time-zone rules, such as daylight savings, mean that not every time on the + local time-line exists. If the local date-time is in a gap or overlap according to + the rules then a resolver is used to determine the resultant local time and offset. + This method uses {@link ZonedDateTime#ofLocal(LocalDateTime, ZoneId, ZoneOffset)} + to retain the offset from this instance if possible. + + Finer control over gaps and overlaps is available in two ways. + If you simply want to use the later offset at overlaps then call + {@link ZonedDateTime#withLaterOffsetAtOverlap()} immediately after this method. + + To create a zoned date-time at the same instant irrespective of the local time-line, + use {@link #atZoneSameInstant(ZoneId)}. + To use the offset as the zone ID, use {@link #toZonedDateTime()}. + + @param zone the time-zone to use, not null + @return the zoned date-time formed from this date and the earliest valid time for the zone, not null" + {:arglists (quote (["java.time.OffsetDateTime" "java.time.ZoneId"]))} + (^java.time.ZonedDateTime + [^java.time.OffsetDateTime this ^java.time.ZoneId zone] + (.atZoneSimilarLocal this zone))) + +(defn get-year + "Gets the year field. + + This method returns the primitive {@code int} value for the year. + + The year returned by this method is proleptic as per {@code get(YEAR)}. + To obtain the year-of-era, use {@code get(YEAR_OF_ERA)}. + + @return the year, from MIN_YEAR to MAX_YEAR" + {:arglists (quote (["java.time.OffsetDateTime"]))} + (^java.lang.Integer [^java.time.OffsetDateTime this] (.getYear this))) + +(defn minus-seconds + "Returns a copy of this {@code OffsetDateTime} with the specified number of seconds subtracted. + + This instance is immutable and unaffected by this method call. + + @param seconds the seconds to subtract, may be negative + @return an {@code OffsetDateTime} based on this date-time with the seconds subtracted, not null + @throws DateTimeException if the result exceeds the supported date range" + {:arglists (quote (["java.time.OffsetDateTime" "long"]))} + (^java.time.OffsetDateTime [^java.time.OffsetDateTime this ^long seconds] + (.minusSeconds this seconds))) + +(defn get-second + "Gets the second-of-minute field. + + @return the second-of-minute, from 0 to 59" + {:arglists (quote (["java.time.OffsetDateTime"]))} + (^java.lang.Integer [^java.time.OffsetDateTime this] (.getSecond this))) + +(defn plus-nanos + "Returns a copy of this {@code OffsetDateTime} with the specified number of nanoseconds added. + + This instance is immutable and unaffected by this method call. + + @param nanos the nanos to add, may be negative + @return an {@code OffsetDateTime} based on this date-time with the nanoseconds added, not null + @throws DateTimeException if the unit cannot be added to this type" + {:arglists (quote (["java.time.OffsetDateTime" "long"]))} + (^java.time.OffsetDateTime [^java.time.OffsetDateTime this ^long nanos] + (.plusNanos this nanos))) + +(defn get-day-of-year + "Gets the day-of-year field. + + This method returns the primitive {@code int} value for the day-of-year. + + @return the day-of-year, from 1 to 365, or 366 in a leap year" + {:arglists (quote (["java.time.OffsetDateTime"]))} + (^java.lang.Integer [^java.time.OffsetDateTime this] (.getDayOfYear this))) + +(defn plus + {:arglists (quote (["java.time.OffsetDateTime" + "java.time.temporal.TemporalAmount"] + ["java.time.OffsetDateTime" "long" + "java.time.temporal.TemporalUnit"]))} + (^java.time.OffsetDateTime + [^java.time.OffsetDateTime this + ^java.time.temporal.TemporalAmount amount-to-add] + (.plus this amount-to-add)) + (^java.time.OffsetDateTime + [^java.time.OffsetDateTime this ^long amount-to-add + ^java.time.temporal.ChronoUnit unit] + (.plus this amount-to-add unit))) + +(defn time-line-order + "Gets a comparator that compares two {@code OffsetDateTime} instances + based solely on the instant. + + This method differs from the comparison in {@link #compareTo} in that it + only compares the underlying instant. + + @return a comparator that compares in time-line order + + @see #isAfter + @see #isBefore + @see #isEqual" + {:arglists (quote ([]))} + (^java.util.Comparator [] (java.time.OffsetDateTime/timeLineOrder))) + +(defn with-hour + "Returns a copy of this {@code OffsetDateTime} with the hour-of-day altered. + + The date and offset do not affect the calculation and will be the same in the result. + + This instance is immutable and unaffected by this method call. + + @param hour the hour-of-day to set in the result, from 0 to 23 + @return an {@code OffsetDateTime} based on this date-time with the requested hour, not null + @throws DateTimeException if the hour value is invalid" + {:arglists (quote (["java.time.OffsetDateTime" "int"]))} + (^java.time.OffsetDateTime + [^java.time.OffsetDateTime this ^java.lang.Integer hour] + (.withHour this hour))) + +(defn with-minute + "Returns a copy of this {@code OffsetDateTime} with the minute-of-hour altered. + + The date and offset do not affect the calculation and will be the same in the result. + + This instance is immutable and unaffected by this method call. + + @param minute the minute-of-hour to set in the result, from 0 to 59 + @return an {@code OffsetDateTime} based on this date-time with the requested minute, not null + @throws DateTimeException if the minute value is invalid" + {:arglists (quote (["java.time.OffsetDateTime" "int"]))} + (^java.time.OffsetDateTime + [^java.time.OffsetDateTime this ^java.lang.Integer minute] + (.withMinute this minute))) + +(defn plus-minutes + "Returns a copy of this {@code OffsetDateTime} with the specified number of minutes added. + + This instance is immutable and unaffected by this method call. + + @param minutes the minutes to add, may be negative + @return an {@code OffsetDateTime} based on this date-time with the minutes added, not null + @throws DateTimeException if the result exceeds the supported date range" + {:arglists (quote (["java.time.OffsetDateTime" "long"]))} + (^java.time.OffsetDateTime [^java.time.OffsetDateTime this ^long minutes] + (.plusMinutes this minutes))) + +(defn query + "Queries this date-time using the specified query. + + This queries this date-time using the specified query strategy object. + The {@code TemporalQuery} object defines the logic to be used to + obtain the result. Read the documentation of the query to understand + what the result of this method will be. + + The result of this method is obtained by invoking the + {@link TemporalQuery#queryFrom(TemporalAccessor)} method on the + specified query passing {@code this} as the argument. + + @param the type of the result + @param query the query to invoke, not null + @return the query result, null may be returned (defined by the query) + @throws DateTimeException if unable to query (defined by the query) + @throws ArithmeticException if numeric overflow occurs (defined by the query)" + {:arglists (quote (["java.time.OffsetDateTime" + "java.time.temporal.TemporalQuery"]))} + (^java.lang.Object + [^java.time.OffsetDateTime this ^java.time.temporal.TemporalQuery query] + (.query this query))) + +(defn with-offset-same-instant + "Returns a copy of this {@code OffsetDateTime} with the specified offset ensuring + that the result is at the same instant. + + This method returns an object with the specified {@code ZoneOffset} and a {@code LocalDateTime} + adjusted by the difference between the two offsets. + This will result in the old and new objects representing the same instant. + This is useful for finding the local time in a different offset. + For example, if this time represents {@code 2007-12-03T10:30+02:00} and the offset specified is + {@code +03:00}, then this method will return {@code 2007-12-03T11:30+03:00}. + + To change the offset without adjusting the local time use {@link #withOffsetSameLocal}. + + This instance is immutable and unaffected by this method call. + + @param offset the zone offset to change to, not null + @return an {@code OffsetDateTime} based on this date-time with the requested offset, not null + @throws DateTimeException if the result exceeds the supported date range" + {:arglists (quote (["java.time.OffsetDateTime" "java.time.ZoneOffset"]))} + (^java.time.OffsetDateTime + [^java.time.OffsetDateTime this ^java.time.ZoneOffset offset] + (.withOffsetSameInstant this offset))) + +(defn get-day-of-week + "Gets the day-of-week field, which is an enum {@code DayOfWeek}. + + This method returns the enum {@link DayOfWeek} for the day-of-week. + This avoids confusion as to what {@code int} values mean. + If you need access to the primitive {@code int} value then the enum + provides the {@link DayOfWeek#getValue() int value}. + + Additional information can be obtained from the {@code DayOfWeek}. + This includes textual names of the values. + + @return the day-of-week, not null" + {:arglists (quote (["java.time.OffsetDateTime"]))} + (^java.time.DayOfWeek [^java.time.OffsetDateTime this] (.getDayOfWeek this))) + +(defn to-string + "Outputs this date-time as a {@code String}, such as {@code 2007-12-03T10:15:30+01:00}. + + The output will be one of the following ISO-8601 formats: +
    +
  • {@code uuuu-MM-dd'T'HH:mmXXXXX}
  • +
  • {@code uuuu-MM-dd'T'HH:mm:ssXXXXX}
  • +
  • {@code uuuu-MM-dd'T'HH:mm:ss.SSSXXXXX}
  • +
  • {@code uuuu-MM-dd'T'HH:mm:ss.SSSSSSXXXXX}
  • +
  • {@code uuuu-MM-dd'T'HH:mm:ss.SSSSSSSSSXXXXX}
  • +
+ The format used will be the shortest that outputs the full value of + the time where the omitted parts are implied to be zero. + + @return a string representation of this date-time, not null" + {:arglists (quote (["java.time.OffsetDateTime"]))} + (^java.lang.String [^java.time.OffsetDateTime this] (.toString this))) + +(defn plus-months + "Returns a copy of this {@code OffsetDateTime} with the specified number of months added. + + This method adds the specified amount to the months field in three steps: +
    +
  1. Add the input months to the month-of-year field
  2. +
  3. Check if the resulting date would be invalid
  4. +
  5. Adjust the day-of-month to the last valid day if necessary
  6. +
+ + For example, 2007-03-31 plus one month would result in the invalid date + 2007-04-31. Instead of returning an invalid result, the last valid day + of the month, 2007-04-30, is selected instead. + + This instance is immutable and unaffected by this method call. + + @param months the months to add, may be negative + @return an {@code OffsetDateTime} based on this date-time with the months added, not null + @throws DateTimeException if the result exceeds the supported date range" + {:arglists (quote (["java.time.OffsetDateTime" "long"]))} + (^java.time.OffsetDateTime [^java.time.OffsetDateTime this ^long months] + (.plusMonths this months))) + +(defn is-before + "Checks if the instant of this date-time is before that of the specified date-time. + + This method differs from the comparison in {@link #compareTo} in that it + only compares the instant of the date-time. This is equivalent to using + {@code dateTime1.toInstant().isBefore(dateTime2.toInstant());}. + + @param other the other date-time to compare to, not null + @return true if this is before the instant of the specified date-time" + {:arglists (quote (["java.time.OffsetDateTime" "java.time.OffsetDateTime"]))} + (^java.lang.Boolean + [^java.time.OffsetDateTime this ^java.time.OffsetDateTime other] + (.isBefore this other))) + +(defn minus-months + "Returns a copy of this {@code OffsetDateTime} with the specified number of months subtracted. + + This method subtracts the specified amount from the months field in three steps: +
    +
  1. Subtract the input months from the month-of-year field
  2. +
  3. Check if the resulting date would be invalid
  4. +
  5. Adjust the day-of-month to the last valid day if necessary
  6. +
+ + For example, 2007-03-31 minus one month would result in the invalid date + 2007-04-31. Instead of returning an invalid result, the last valid day + of the month, 2007-04-30, is selected instead. + + This instance is immutable and unaffected by this method call. + + @param months the months to subtract, may be negative + @return an {@code OffsetDateTime} based on this date-time with the months subtracted, not null + @throws DateTimeException if the result exceeds the supported date range" + {:arglists (quote (["java.time.OffsetDateTime" "long"]))} + (^java.time.OffsetDateTime [^java.time.OffsetDateTime this ^long months] + (.minusMonths this months))) + +(defn minus + {:arglists (quote (["java.time.OffsetDateTime" + "java.time.temporal.TemporalAmount"] + ["java.time.OffsetDateTime" "long" + "java.time.temporal.TemporalUnit"]))} + (^java.time.OffsetDateTime + [^java.time.OffsetDateTime this + ^java.time.temporal.TemporalAmount amount-to-subtract] + (.minus this amount-to-subtract)) + (^java.time.OffsetDateTime + [^java.time.OffsetDateTime this ^long amount-to-subtract + ^java.time.temporal.ChronoUnit unit] + (.minus this amount-to-subtract unit))) + +(defn plus-hours + "Returns a copy of this {@code OffsetDateTime} with the specified number of hours added. + + This instance is immutable and unaffected by this method call. + + @param hours the hours to add, may be negative + @return an {@code OffsetDateTime} based on this date-time with the hours added, not null + @throws DateTimeException if the result exceeds the supported date range" + {:arglists (quote (["java.time.OffsetDateTime" "long"]))} + (^java.time.OffsetDateTime [^java.time.OffsetDateTime this ^long hours] + (.plusHours this hours))) + +(defn plus-days + "Returns a copy of this OffsetDateTime with the specified number of days added. + + This method adds the specified amount to the days field incrementing the + month and year fields as necessary to ensure the result remains valid. + The result is only invalid if the maximum/minimum year is exceeded. + + For example, 2008-12-31 plus one day would result in 2009-01-01. + + This instance is immutable and unaffected by this method call. + + @param days the days to add, may be negative + @return an {@code OffsetDateTime} based on this date-time with the days added, not null + @throws DateTimeException if the result exceeds the supported date range" + {:arglists (quote (["java.time.OffsetDateTime" "long"]))} + (^java.time.OffsetDateTime [^java.time.OffsetDateTime this ^long days] + (.plusDays this days))) + +(defn to-local-time + "Gets the {@code LocalTime} part of this date-time. + + This returns a {@code LocalTime} with the same hour, minute, second and + nanosecond as this date-time. + + @return the time part of this date-time, not null" + {:arglists (quote (["java.time.OffsetDateTime"]))} + (^java.time.LocalTime [^java.time.OffsetDateTime this] (.toLocalTime this))) + +(defn get-long + "Gets the value of the specified field from this date-time as a {@code long}. + + This queries this date-time for the value of the specified field. + If it is not possible to return the value, because the field is not supported + or for some other reason, an exception is thrown. + + If the field is a {@link ChronoField} then the query is implemented here. + The {@link #isSupported(TemporalField) supported fields} will return valid + values based on this date-time. + All other {@code ChronoField} instances will throw an {@code UnsupportedTemporalTypeException}. + + If the field is not a {@code ChronoField}, then the result of this method + is obtained by invoking {@code TemporalField.getFrom(TemporalAccessor)} + passing {@code this} as the argument. Whether the value can be obtained, + and what the value represents, is determined by the field. + + @param field the field to get, not null + @return the value for the field + @throws DateTimeException if a value for the field cannot be obtained + @throws UnsupportedTemporalTypeException if the field is not supported + @throws ArithmeticException if numeric overflow occurs" + {:arglists (quote (["java.time.OffsetDateTime" + "java.time.temporal.TemporalField"]))} + (^long + [^java.time.OffsetDateTime this ^java.time.temporal.TemporalField field] + (.getLong this field))) + +(defn get-offset + "Gets the zone offset, such as '+01:00'. + + This is the offset of the local date-time from UTC/Greenwich. + + @return the zone offset, not null" + {:arglists (quote (["java.time.OffsetDateTime"]))} + (^java.time.ZoneOffset [^java.time.OffsetDateTime this] (.getOffset this))) + +(defn to-zoned-date-time + "Converts this date-time to a {@code ZonedDateTime} using the offset as the zone ID. + + This creates the simplest possible {@code ZonedDateTime} using the offset + as the zone ID. + + To control the time-zone used, see {@link #atZoneSameInstant(ZoneId)} and + {@link #atZoneSimilarLocal(ZoneId)}. + + @return a zoned date-time representing the same local date-time and offset, not null" + {:arglists (quote (["java.time.OffsetDateTime"]))} + (^java.time.ZonedDateTime [^java.time.OffsetDateTime this] + (.toZonedDateTime this))) + +(defn with-year + "Returns a copy of this {@code OffsetDateTime} with the year altered. + + The time and offset do not affect the calculation and will be the same in the result. + If the day-of-month is invalid for the year, it will be changed to the last valid day of the month. + + This instance is immutable and unaffected by this method call. + + @param year the year to set in the result, from MIN_YEAR to MAX_YEAR + @return an {@code OffsetDateTime} based on this date-time with the requested year, not null + @throws DateTimeException if the year value is invalid" + {:arglists (quote (["java.time.OffsetDateTime" "int"]))} + (^java.time.OffsetDateTime + [^java.time.OffsetDateTime this ^java.lang.Integer year] + (.withYear this year))) + +(defn with-nano + "Returns a copy of this {@code OffsetDateTime} with the nano-of-second altered. + + The date and offset do not affect the calculation and will be the same in the result. + + This instance is immutable and unaffected by this method call. + + @param nanoOfSecond the nano-of-second to set in the result, from 0 to 999,999,999 + @return an {@code OffsetDateTime} based on this date-time with the requested nanosecond, not null + @throws DateTimeException if the nano value is invalid" + {:arglists (quote (["java.time.OffsetDateTime" "int"]))} + (^java.time.OffsetDateTime + [^java.time.OffsetDateTime this ^java.lang.Integer nano-of-second] + (.withNano this nano-of-second))) + +(defn to-epoch-second + "Converts this date-time to the number of seconds from the epoch of 1970-01-01T00:00:00Z. + + This allows this date-time to be converted to a value of the + {@link ChronoField#INSTANT_SECONDS epoch-seconds} field. This is primarily + intended for low-level conversions rather than general application usage. + + @return the number of seconds from the epoch of 1970-01-01T00:00:00Z" + {:arglists (quote (["java.time.OffsetDateTime"]))} + (^long [^java.time.OffsetDateTime this] (.toEpochSecond this))) + +(defn until + "Calculates the amount of time until another date-time in terms of the specified unit. + + This calculates the amount of time between two {@code OffsetDateTime} + objects in terms of a single {@code TemporalUnit}. + The start and end points are {@code this} and the specified date-time. + The result will be negative if the end is before the start. + For example, the amount in days between two date-times can be calculated + using {@code startDateTime.until(endDateTime, DAYS)}. + + The {@code Temporal} passed to this method is converted to a + {@code OffsetDateTime} using {@link #from(TemporalAccessor)}. + If the offset differs between the two date-times, the specified + end date-time is normalized to have the same offset as this date-time. + + The calculation returns a whole number, representing the number of + complete units between the two date-times. + For example, the amount in months between 2012-06-15T00:00Z and 2012-08-14T23:59Z + will only be one month as it is one minute short of two months. + + There are two equivalent ways of using this method. + The first is to invoke this method. + The second is to use {@link TemporalUnit#between(Temporal, Temporal)}: +
+   // these two lines are equivalent
+   amount = start.until(end, MONTHS);
+   amount = MONTHS.between(start, end);
+ 
+ The choice should be made based on which makes the code more readable. + + The calculation is implemented in this method for {@link ChronoUnit}. + The units {@code NANOS}, {@code MICROS}, {@code MILLIS}, {@code SECONDS}, + {@code MINUTES}, {@code HOURS} and {@code HALF_DAYS}, {@code DAYS}, + {@code WEEKS}, {@code MONTHS}, {@code YEARS}, {@code DECADES}, + {@code CENTURIES}, {@code MILLENNIA} and {@code ERAS} are supported. + Other {@code ChronoUnit} values will throw an exception. + + If the unit is not a {@code ChronoUnit}, then the result of this method + is obtained by invoking {@code TemporalUnit.between(Temporal, Temporal)} + passing {@code this} as the first argument and the converted input temporal + as the second argument. + + This instance is immutable and unaffected by this method call. + + @param endExclusive the end date, exclusive, which is converted to an {@code OffsetDateTime}, not null + @param unit the unit to measure the amount in, not null + @return the amount of time between this date-time and the end date-time + @throws DateTimeException if the amount cannot be calculated, or the end + temporal cannot be converted to an {@code OffsetDateTime} + @throws UnsupportedTemporalTypeException if the unit is not supported + @throws ArithmeticException if numeric overflow occurs" + {:arglists (quote (["java.time.OffsetDateTime" "java.time.temporal.Temporal" + "java.time.temporal.TemporalUnit"]))} + (^long + [^java.time.OffsetDateTime this ^java.time.temporal.Temporal end-exclusive + ^java.time.temporal.ChronoUnit unit] + (.until this end-exclusive unit))) + +(defn with-offset-same-local + "Returns a copy of this {@code OffsetDateTime} with the specified offset ensuring + that the result has the same local date-time. + + This method returns an object with the same {@code LocalDateTime} and the specified {@code ZoneOffset}. + No calculation is needed or performed. + For example, if this time represents {@code 2007-12-03T10:30+02:00} and the offset specified is + {@code +03:00}, then this method will return {@code 2007-12-03T10:30+03:00}. + + To take into account the difference between the offsets, and adjust the time fields, + use {@link #withOffsetSameInstant}. + + This instance is immutable and unaffected by this method call. + + @param offset the zone offset to change to, not null + @return an {@code OffsetDateTime} based on this date-time with the requested offset, not null" + {:arglists (quote (["java.time.OffsetDateTime" "java.time.ZoneOffset"]))} + (^java.time.OffsetDateTime + [^java.time.OffsetDateTime this ^java.time.ZoneOffset offset] + (.withOffsetSameLocal this offset))) + +(defn with-day-of-month + "Returns a copy of this {@code OffsetDateTime} with the day-of-month altered. + + If the resulting {@code OffsetDateTime} is invalid, an exception is thrown. + The time and offset do not affect the calculation and will be the same in the result. + + This instance is immutable and unaffected by this method call. + + @param dayOfMonth the day-of-month to set in the result, from 1 to 28-31 + @return an {@code OffsetDateTime} based on this date-time with the requested day, not null + @throws DateTimeException if the day-of-month value is invalid, + or if the day-of-month is invalid for the month-year" + {:arglists (quote (["java.time.OffsetDateTime" "int"]))} + (^java.time.OffsetDateTime + [^java.time.OffsetDateTime this ^java.lang.Integer day-of-month] + (.withDayOfMonth this day-of-month))) + +(defn get-day-of-month + "Gets the day-of-month field. + + This method returns the primitive {@code int} value for the day-of-month. + + @return the day-of-month, from 1 to 31" + {:arglists (quote (["java.time.OffsetDateTime"]))} + (^java.lang.Integer [^java.time.OffsetDateTime this] (.getDayOfMonth this))) + +(defn from + "Obtains an instance of {@code OffsetDateTime} from a temporal object. + + This obtains an offset date-time based on the specified temporal. + A {@code TemporalAccessor} represents an arbitrary set of date and time information, + which this factory converts to an instance of {@code OffsetDateTime}. + + The conversion will first obtain a {@code ZoneOffset} from the temporal object. + It will then try to obtain a {@code LocalDateTime}, falling back to an {@code Instant} if necessary. + The result will be the combination of {@code ZoneOffset} with either + with {@code LocalDateTime} or {@code Instant}. + Implementations are permitted to perform optimizations such as accessing + those fields that are equivalent to the relevant objects. + + This method matches the signature of the functional interface {@link TemporalQuery} + allowing it to be used as a query via method reference, {@code OffsetDateTime::from}. + + @param temporal the temporal object to convert, not null + @return the offset date-time, not null + @throws DateTimeException if unable to convert to an {@code OffsetDateTime}" + {:arglists (quote (["java.time.temporal.TemporalAccessor"]))} + (^java.time.OffsetDateTime [^java.time.temporal.TemporalAccessor temporal] + (java.time.OffsetDateTime/from temporal))) + +(defn is-after + "Checks if the instant of this date-time is after that of the specified date-time. + + This method differs from the comparison in {@link #compareTo} and {@link #equals} in that it + only compares the instant of the date-time. This is equivalent to using + {@code dateTime1.toInstant().isAfter(dateTime2.toInstant());}. + + @param other the other date-time to compare to, not null + @return true if this is after the instant of the specified date-time" + {:arglists (quote (["java.time.OffsetDateTime" "java.time.OffsetDateTime"]))} + (^java.lang.Boolean + [^java.time.OffsetDateTime this ^java.time.OffsetDateTime other] + (.isAfter this other))) + +(defn minus-nanos + "Returns a copy of this {@code OffsetDateTime} with the specified number of nanoseconds subtracted. + + This instance is immutable and unaffected by this method call. + + @param nanos the nanos to subtract, may be negative + @return an {@code OffsetDateTime} based on this date-time with the nanoseconds subtracted, not null + @throws DateTimeException if the result exceeds the supported date range" + {:arglists (quote (["java.time.OffsetDateTime" "long"]))} + (^java.time.OffsetDateTime [^java.time.OffsetDateTime this ^long nanos] + (.minusNanos this nanos))) + +(defn is-supported + {:arglists + (quote (["java.time.OffsetDateTime" "java.time.temporal.TemporalField"] + ["java.time.OffsetDateTime" "java.time.temporal.TemporalUnit"]))} + (^java.lang.Boolean [^java.time.OffsetDateTime this arg0] + (cond (instance? java.time.temporal.TemporalField arg0) + (let [^java.time.temporal.TemporalField field arg0] + (.isSupported this field)) + (instance? java.time.temporal.ChronoUnit arg0) + (let [^java.time.temporal.TemporalUnit unit arg0] + (.isSupported this unit)) + :else (throw (java.lang.IllegalArgumentException. + "no corresponding java.time method with these args"))))) + +(defn minus-years + "Returns a copy of this {@code OffsetDateTime} with the specified number of years subtracted. + + This method subtracts the specified amount from the years field in three steps: +
    +
  1. Subtract the input years from the year field
  2. +
  3. Check if the resulting date would be invalid
  4. +
  5. Adjust the day-of-month to the last valid day if necessary
  6. +
+ + For example, 2008-02-29 (leap year) minus one year would result in the + invalid date 2009-02-29 (standard year). Instead of returning an invalid + result, the last valid day of the month, 2009-02-28, is selected instead. + + This instance is immutable and unaffected by this method call. + + @param years the years to subtract, may be negative + @return an {@code OffsetDateTime} based on this date-time with the years subtracted, not null + @throws DateTimeException if the result exceeds the supported date range" + {:arglists (quote (["java.time.OffsetDateTime" "long"]))} + (^java.time.OffsetDateTime [^java.time.OffsetDateTime this ^long years] + (.minusYears this years))) + +(defn parse + {:arglists (quote (["java.lang.CharSequence"] + ["java.lang.CharSequence" + "java.time.format.DateTimeFormatter"]))} + (^java.time.OffsetDateTime [^java.lang.CharSequence text] + (java.time.OffsetDateTime/parse text)) + (^java.time.OffsetDateTime + [^java.lang.CharSequence text ^java.time.format.DateTimeFormatter formatter] + (java.time.OffsetDateTime/parse text formatter))) + +(defn with-second + "Returns a copy of this {@code OffsetDateTime} with the second-of-minute altered. + + The date and offset do not affect the calculation and will be the same in the result. + + This instance is immutable and unaffected by this method call. + + @param second the second-of-minute to set in the result, from 0 to 59 + @return an {@code OffsetDateTime} based on this date-time with the requested second, not null + @throws DateTimeException if the second value is invalid" + {:arglists (quote (["java.time.OffsetDateTime" "int"]))} + (^java.time.OffsetDateTime + [^java.time.OffsetDateTime this ^java.lang.Integer second] + (.withSecond this second))) + +(defn to-local-date + "Gets the {@code LocalDate} part of this date-time. + + This returns a {@code LocalDate} with the same year, month and day + as this date-time. + + @return the date part of this date-time, not null" + {:arglists (quote (["java.time.OffsetDateTime"]))} + (^java.time.LocalDate [^java.time.OffsetDateTime this] (.toLocalDate this))) + +(defn get-minute + "Gets the minute-of-hour field. + + @return the minute-of-hour, from 0 to 59" + {:arglists (quote (["java.time.OffsetDateTime"]))} + (^java.lang.Integer [^java.time.OffsetDateTime this] (.getMinute this))) + +(defn hash-code + "A hash code for this date-time. + + @return a suitable hash code" + {:arglists (quote (["java.time.OffsetDateTime"]))} + (^java.lang.Integer [^java.time.OffsetDateTime this] (.hashCode this))) + +(defn adjust-into + "Adjusts the specified temporal object to have the same offset, date + and time as this object. + + This returns a temporal object of the same observable type as the input + with the offset, date and time changed to be the same as this. + + The adjustment is equivalent to using {@link Temporal#with(TemporalField, long)} + three times, passing {@link ChronoField#EPOCH_DAY}, + {@link ChronoField#NANO_OF_DAY} and {@link ChronoField#OFFSET_SECONDS} as the fields. + + In most cases, it is clearer to reverse the calling pattern by using + {@link Temporal#with(TemporalAdjuster)}: +
+   // these two lines are equivalent, but the second approach is recommended
+   temporal = thisOffsetDateTime.adjustInto(temporal);
+   temporal = temporal.with(thisOffsetDateTime);
+ 
+ + This instance is immutable and unaffected by this method call. + + @param temporal the target object to be adjusted, not null + @return the adjusted object, not null + @throws DateTimeException if unable to make the adjustment + @throws ArithmeticException if numeric overflow occurs" + {:arglists (quote (["java.time.OffsetDateTime" + "java.time.temporal.Temporal"]))} + (^java.time.temporal.Temporal + [^java.time.OffsetDateTime this ^java.time.temporal.Temporal temporal] + (.adjustInto this temporal))) + +(defn with + {:arglists (quote (["java.time.OffsetDateTime" + "java.time.temporal.TemporalAdjuster"] + ["java.time.OffsetDateTime" + "java.time.temporal.TemporalField" "long"]))} + (^java.time.OffsetDateTime + [^java.time.OffsetDateTime this + ^java.time.temporal.TemporalAdjuster adjuster] + (.with this adjuster)) + (^java.time.OffsetDateTime + [^java.time.OffsetDateTime this ^java.time.temporal.TemporalField field + ^long new-value] + (.with this field new-value))) + +(defn now + {:arglists (quote ([] ["java.time.Clock"] ["java.time.ZoneId"]))} + (^java.time.OffsetDateTime [] (java.time.OffsetDateTime/now)) + (^java.time.OffsetDateTime [arg0] + (cond (instance? java.time.Clock arg0) (let [^java.time.Clock clock arg0] + (java.time.OffsetDateTime/now + clock)) + (instance? java.time.ZoneId arg0) (let [^java.time.ZoneId zone arg0] + (java.time.OffsetDateTime/now + zone)) + :else (throw (java.lang.IllegalArgumentException. + "no corresponding java.time method with these args"))))) + +(defn to-local-date-time + "Gets the {@code LocalDateTime} part of this date-time. + + This returns a {@code LocalDateTime} with the same year, month, day and time + as this date-time. + + @return the local date-time part of this date-time, not null" + {:arglists (quote (["java.time.OffsetDateTime"]))} + (^java.time.LocalDateTime [^java.time.OffsetDateTime this] + (.toLocalDateTime this))) + +(defn get-month-value + "Gets the month-of-year field from 1 to 12. + + This method returns the month as an {@code int} from 1 to 12. + Application code is frequently clearer if the enum {@link Month} + is used by calling {@link #getMonth()}. + + @return the month-of-year, from 1 to 12 + @see #getMonth()" + {:arglists (quote (["java.time.OffsetDateTime"]))} + (^java.lang.Integer [^java.time.OffsetDateTime this] (.getMonthValue this))) + +(defn with-day-of-year + "Returns a copy of this {@code OffsetDateTime} with the day-of-year altered. + + The time and offset do not affect the calculation and will be the same in the result. + If the resulting {@code OffsetDateTime} is invalid, an exception is thrown. + + This instance is immutable and unaffected by this method call. + + @param dayOfYear the day-of-year to set in the result, from 1 to 365-366 + @return an {@code OffsetDateTime} based on this date with the requested day, not null + @throws DateTimeException if the day-of-year value is invalid, + or if the day-of-year is invalid for the year" + {:arglists (quote (["java.time.OffsetDateTime" "int"]))} + (^java.time.OffsetDateTime + [^java.time.OffsetDateTime this ^java.lang.Integer day-of-year] + (.withDayOfYear this day-of-year))) + +(defn compare-to + "Compares this date-time to another date-time. + + The comparison is based on the instant then on the local date-time. + It is \"consistent with equals\", as defined by {@link Comparable}. + + For example, the following is the comparator order: +
    +
  1. {@code 2008-12-03T10:30+01:00}
  2. +
  3. {@code 2008-12-03T11:00+01:00}
  4. +
  5. {@code 2008-12-03T12:00+02:00}
  6. +
  7. {@code 2008-12-03T11:30+01:00}
  8. +
  9. {@code 2008-12-03T12:00+01:00}
  10. +
  11. {@code 2008-12-03T12:30+01:00}
  12. +
+ Values #2 and #3 represent the same instant on the time-line. + When two values represent the same instant, the local date-time is compared + to distinguish them. This step is needed to make the ordering + consistent with {@code equals()}. + + @param other the other date-time to compare to, not null + @return the comparator value, negative if less, positive if greater" + {:arglists (quote (["java.time.OffsetDateTime" "java.time.OffsetDateTime"]))} + (^java.lang.Integer + [^java.time.OffsetDateTime this ^java.time.OffsetDateTime other] + (.compareTo this other))) + +(defn get-month + "Gets the month-of-year field using the {@code Month} enum. + + This method returns the enum {@link Month} for the month. + This avoids confusion as to what {@code int} values mean. + If you need access to the primitive {@code int} value then the enum + provides the {@link Month#getValue() int value}. + + @return the month-of-year, not null + @see #getMonthValue()" + {:arglists (quote (["java.time.OffsetDateTime"]))} + (^java.time.Month [^java.time.OffsetDateTime this] (.getMonth this))) + +(defn of-instant + "Obtains an instance of {@code OffsetDateTime} from an {@code Instant} and zone ID. + + This creates an offset date-time with the same instant as that specified. + Finding the offset from UTC/Greenwich is simple as there is only one valid + offset for each instant. + + @param instant the instant to create the date-time from, not null + @param zone the time-zone, which may be an offset, not null + @return the offset date-time, not null + @throws DateTimeException if the result exceeds the supported range" + {:arglists (quote (["java.time.Instant" "java.time.ZoneId"]))} + (^java.time.OffsetDateTime [^java.time.Instant instant ^java.time.ZoneId zone] + (java.time.OffsetDateTime/ofInstant instant zone))) + +(defn plus-seconds + "Returns a copy of this {@code OffsetDateTime} with the specified number of seconds added. + + This instance is immutable and unaffected by this method call. + + @param seconds the seconds to add, may be negative + @return an {@code OffsetDateTime} based on this date-time with the seconds added, not null + @throws DateTimeException if the result exceeds the supported date range" + {:arglists (quote (["java.time.OffsetDateTime" "long"]))} + (^java.time.OffsetDateTime [^java.time.OffsetDateTime this ^long seconds] + (.plusSeconds this seconds))) + +(defn get + "Gets the value of the specified field from this date-time as an {@code int}. + + This queries this date-time for the value of the specified field. + The returned value will always be within the valid range of values for the field. + If it is not possible to return the value, because the field is not supported + or for some other reason, an exception is thrown. + + If the field is a {@link ChronoField} then the query is implemented here. + The {@link #isSupported(TemporalField) supported fields} will return valid + values based on this date-time, except {@code NANO_OF_DAY}, {@code MICRO_OF_DAY}, + {@code EPOCH_DAY}, {@code PROLEPTIC_MONTH} and {@code INSTANT_SECONDS} which are too + large to fit in an {@code int} and throw a {@code DateTimeException}. + All other {@code ChronoField} instances will throw an {@code UnsupportedTemporalTypeException}. + + If the field is not a {@code ChronoField}, then the result of this method + is obtained by invoking {@code TemporalField.getFrom(TemporalAccessor)} + passing {@code this} as the argument. Whether the value can be obtained, + and what the value represents, is determined by the field. + + @param field the field to get, not null + @return the value for the field + @throws DateTimeException if a value for the field cannot be obtained or + the value is outside the range of valid values for the field + @throws UnsupportedTemporalTypeException if the field is not supported or + the range of values exceeds an {@code int} + @throws ArithmeticException if numeric overflow occurs" + {:arglists (quote (["java.time.OffsetDateTime" + "java.time.temporal.TemporalField"]))} + (^java.lang.Integer + [^java.time.OffsetDateTime this ^java.time.temporal.TemporalField field] + (.get this field))) + +(defn equals + "Checks if this date-time is equal to another date-time. + + The comparison is based on the local date-time and the offset. + To compare for the same instant on the time-line, use {@link #isEqual}. + Only objects of type {@code OffsetDateTime} are compared, other types return false. + + @param obj the object to check, null returns false + @return true if this is equal to the other date-time" + {:arglists (quote (["java.time.OffsetDateTime" "java.lang.Object"]))} + (^java.lang.Boolean [^java.time.OffsetDateTime this ^java.lang.Object obj] + (.equals this obj))) + +(defn format + "Formats this date-time using the specified formatter. + + This date-time will be passed to the formatter to produce a string. + + @param formatter the formatter to use, not null + @return the formatted date-time string, not null + @throws DateTimeException if an error occurs during printing" + {:arglists (quote (["java.time.OffsetDateTime" + "java.time.format.DateTimeFormatter"]))} + (^java.lang.String + [^java.time.OffsetDateTime this + ^java.time.format.DateTimeFormatter formatter] + (.format this formatter))) + +(defn plus-years + "Returns a copy of this {@code OffsetDateTime} with the specified number of years added. + + This method adds the specified amount to the years field in three steps: +
    +
  1. Add the input years to the year field
  2. +
  3. Check if the resulting date would be invalid
  4. +
  5. Adjust the day-of-month to the last valid day if necessary
  6. +
+ + For example, 2008-02-29 (leap year) plus one year would result in the + invalid date 2009-02-29 (standard year). Instead of returning an invalid + result, the last valid day of the month, 2009-02-28, is selected instead. + + This instance is immutable and unaffected by this method call. + + @param years the years to add, may be negative + @return an {@code OffsetDateTime} based on this date-time with the years added, not null + @throws DateTimeException if the result exceeds the supported date range" + {:arglists (quote (["java.time.OffsetDateTime" "long"]))} + (^java.time.OffsetDateTime [^java.time.OffsetDateTime this ^long years] + (.plusYears this years))) + +(defn minus-days + "Returns a copy of this {@code OffsetDateTime} with the specified number of days subtracted. + + This method subtracts the specified amount from the days field decrementing the + month and year fields as necessary to ensure the result remains valid. + The result is only invalid if the maximum/minimum year is exceeded. + + For example, 2008-12-31 minus one day would result in 2009-01-01. + + This instance is immutable and unaffected by this method call. + + @param days the days to subtract, may be negative + @return an {@code OffsetDateTime} based on this date-time with the days subtracted, not null + @throws DateTimeException if the result exceeds the supported date range" + {:arglists (quote (["java.time.OffsetDateTime" "long"]))} + (^java.time.OffsetDateTime [^java.time.OffsetDateTime this ^long days] + (.minusDays this days))) diff --git a/src/cljc/java_time/offset_date_time.cljs b/src/cljc/java_time/offset_date_time.cljs index ee3e128..76dd199 100644 --- a/src/cljc/java_time/offset_date_time.cljs +++ b/src/cljc/java_time/offset_date_time.cljs @@ -1,74 +1,1161 @@ -(ns cljc.java-time.offset-date-time (:refer-clojure :exclude [abs get range format min max next name resolve short]) (:require [cljc.java-time.extn.calendar-awareness] [goog.object] [java.time :refer [OffsetDateTime]])) -(def min (goog.object/get java.time.OffsetDateTime "MIN")) -(def max (goog.object/get java.time.OffsetDateTime "MAX")) -(clojure.core/defn minus-minutes {:arglists (quote (["java.time.OffsetDateTime" "long"]))} (^js/JSJoda.OffsetDateTime [^js/JSJoda.OffsetDateTime this14331 ^long long14332] (.minusMinutes this14331 long14332))) -(clojure.core/defn truncated-to {:arglists (quote (["java.time.OffsetDateTime" "java.time.temporal.TemporalUnit"]))} (^js/JSJoda.OffsetDateTime [^js/JSJoda.OffsetDateTime this14333 ^js/JSJoda.TemporalUnit java-time-temporal-TemporalUnit14334] (.truncatedTo this14333 java-time-temporal-TemporalUnit14334))) -(clojure.core/defn minus-weeks {:arglists (quote (["java.time.OffsetDateTime" "long"]))} (^js/JSJoda.OffsetDateTime [^js/JSJoda.OffsetDateTime this14335 ^long long14336] (.minusWeeks this14335 long14336))) -(clojure.core/defn to-instant {:arglists (quote (["java.time.OffsetDateTime"]))} (^js/JSJoda.Instant [^js/JSJoda.OffsetDateTime this14337] (.toInstant this14337))) -(clojure.core/defn plus-weeks {:arglists (quote (["java.time.OffsetDateTime" "long"]))} (^js/JSJoda.OffsetDateTime [^js/JSJoda.OffsetDateTime this14338 ^long long14339] (.plusWeeks this14338 long14339))) -(clojure.core/defn range {:arglists (quote (["java.time.OffsetDateTime" "java.time.temporal.TemporalField"]))} (^js/JSJoda.ValueRange [^js/JSJoda.OffsetDateTime this14340 ^js/JSJoda.TemporalField java-time-temporal-TemporalField14341] (.range this14340 java-time-temporal-TemporalField14341))) -(clojure.core/defn get-hour {:arglists (quote (["java.time.OffsetDateTime"]))} (^int [^js/JSJoda.OffsetDateTime this14342] (.hour this14342))) -(clojure.core/defn at-zone-same-instant {:arglists (quote (["java.time.OffsetDateTime" "java.time.ZoneId"]))} (^js/JSJoda.ZonedDateTime [^js/JSJoda.OffsetDateTime this14343 ^js/JSJoda.ZoneId java-time-ZoneId14344] (.atZoneSameInstant this14343 java-time-ZoneId14344))) -(clojure.core/defn minus-hours {:arglists (quote (["java.time.OffsetDateTime" "long"]))} (^js/JSJoda.OffsetDateTime [^js/JSJoda.OffsetDateTime this14345 ^long long14346] (.minusHours this14345 long14346))) -(clojure.core/defn of {:arglists (quote (["java.time.LocalDate" "java.time.LocalTime" "java.time.ZoneOffset"] ["java.time.LocalDateTime" "java.time.ZoneOffset"] ["int" "int" "int" "int" "int" "int" "int" "java.time.ZoneOffset"]))} (^js/JSJoda.OffsetDateTime [^js/JSJoda.LocalDate java-time-LocalDate14347 ^js/JSJoda.LocalTime java-time-LocalTime14348 ^js/JSJoda.ZoneOffset java-time-ZoneOffset14349] (js-invoke java.time.OffsetDateTime "of" java-time-LocalDate14347 java-time-LocalTime14348 java-time-ZoneOffset14349)) (^js/JSJoda.OffsetDateTime [^js/JSJoda.LocalDateTime java-time-LocalDateTime14350 ^js/JSJoda.ZoneOffset java-time-ZoneOffset14351] (js-invoke java.time.OffsetDateTime "of" java-time-LocalDateTime14350 java-time-ZoneOffset14351)) (^js/JSJoda.OffsetDateTime [^int int14352 ^int int14353 ^int int14354 ^int int14355 ^int int14356 ^int int14357 ^int int14358 ^js/JSJoda.ZoneOffset java-time-ZoneOffset14359] (js-invoke java.time.OffsetDateTime "of" int14352 int14353 int14354 int14355 int14356 int14357 int14358 java-time-ZoneOffset14359))) -(clojure.core/defn with-month {:arglists (quote (["java.time.OffsetDateTime" "int"]))} (^js/JSJoda.OffsetDateTime [^js/JSJoda.OffsetDateTime this14360 ^int int14361] (.withMonth this14360 int14361))) -(clojure.core/defn is-equal {:arglists (quote (["java.time.OffsetDateTime" "java.time.OffsetDateTime"]))} (^boolean [^js/JSJoda.OffsetDateTime this14362 ^js/JSJoda.OffsetDateTime java-time-OffsetDateTime14363] (.isEqual this14362 java-time-OffsetDateTime14363))) -(clojure.core/defn get-nano {:arglists (quote (["java.time.OffsetDateTime"]))} (^int [^js/JSJoda.OffsetDateTime this14364] (.nano this14364))) -(clojure.core/defn to-offset-time {:arglists (quote (["java.time.OffsetDateTime"]))} (^js/JSJoda.OffsetTime [^js/JSJoda.OffsetDateTime this14365] (.toOffsetTime this14365))) -(clojure.core/defn at-zone-similar-local {:arglists (quote (["java.time.OffsetDateTime" "java.time.ZoneId"]))} (^js/JSJoda.ZonedDateTime [^js/JSJoda.OffsetDateTime this14366 ^js/JSJoda.ZoneId java-time-ZoneId14367] (.atZoneSimilarLocal this14366 java-time-ZoneId14367))) -(clojure.core/defn get-year {:arglists (quote (["java.time.OffsetDateTime"]))} (^int [^js/JSJoda.OffsetDateTime this14368] (.year this14368))) -(clojure.core/defn minus-seconds {:arglists (quote (["java.time.OffsetDateTime" "long"]))} (^js/JSJoda.OffsetDateTime [^js/JSJoda.OffsetDateTime this14369 ^long long14370] (.minusSeconds this14369 long14370))) -(clojure.core/defn get-second {:arglists (quote (["java.time.OffsetDateTime"]))} (^int [^js/JSJoda.OffsetDateTime this14371] (.second this14371))) -(clojure.core/defn plus-nanos {:arglists (quote (["java.time.OffsetDateTime" "long"]))} (^js/JSJoda.OffsetDateTime [^js/JSJoda.OffsetDateTime this14372 ^long long14373] (.plusNanos this14372 long14373))) -(clojure.core/defn get-day-of-year {:arglists (quote (["java.time.OffsetDateTime"]))} (^int [^js/JSJoda.OffsetDateTime this14374] (.dayOfYear this14374))) -(clojure.core/defn plus {:arglists (quote (["java.time.OffsetDateTime" "java.time.temporal.TemporalAmount"] ["java.time.OffsetDateTime" "long" "java.time.temporal.TemporalUnit"]))} (^js/JSJoda.OffsetDateTime [^js/JSJoda.OffsetDateTime this14375 ^js/JSJoda.TemporalAmount java-time-temporal-TemporalAmount14376] (.plus this14375 java-time-temporal-TemporalAmount14376)) (^js/JSJoda.OffsetDateTime [^js/JSJoda.OffsetDateTime this14377 ^long long14378 ^js/JSJoda.TemporalUnit java-time-temporal-TemporalUnit14379] (.plus this14377 long14378 java-time-temporal-TemporalUnit14379))) -(clojure.core/defn time-line-order {:arglists (quote ([]))} (^java.util.Comparator [] (js-invoke java.time.OffsetDateTime "timeLineOrder"))) -(clojure.core/defn with-hour {:arglists (quote (["java.time.OffsetDateTime" "int"]))} (^js/JSJoda.OffsetDateTime [^js/JSJoda.OffsetDateTime this14380 ^int int14381] (.withHour this14380 int14381))) -(clojure.core/defn with-minute {:arglists (quote (["java.time.OffsetDateTime" "int"]))} (^js/JSJoda.OffsetDateTime [^js/JSJoda.OffsetDateTime this14382 ^int int14383] (.withMinute this14382 int14383))) -(clojure.core/defn plus-minutes {:arglists (quote (["java.time.OffsetDateTime" "long"]))} (^js/JSJoda.OffsetDateTime [^js/JSJoda.OffsetDateTime this14384 ^long long14385] (.plusMinutes this14384 long14385))) -(clojure.core/defn query {:arglists (quote (["java.time.OffsetDateTime" "java.time.temporal.TemporalQuery"]))} (^java.lang.Object [^js/JSJoda.OffsetDateTime this14386 ^js/JSJoda.TemporalQuery java-time-temporal-TemporalQuery14387] (.query this14386 java-time-temporal-TemporalQuery14387))) -(clojure.core/defn with-offset-same-instant {:arglists (quote (["java.time.OffsetDateTime" "java.time.ZoneOffset"]))} (^js/JSJoda.OffsetDateTime [^js/JSJoda.OffsetDateTime this14388 ^js/JSJoda.ZoneOffset java-time-ZoneOffset14389] (.withOffsetSameInstant this14388 java-time-ZoneOffset14389))) -(clojure.core/defn get-day-of-week {:arglists (quote (["java.time.OffsetDateTime"]))} (^js/JSJoda.DayOfWeek [^js/JSJoda.OffsetDateTime this14390] (.dayOfWeek this14390))) -(clojure.core/defn to-string {:arglists (quote (["java.time.OffsetDateTime"]))} (^java.lang.String [^js/JSJoda.OffsetDateTime this14391] (.toString this14391))) -(clojure.core/defn plus-months {:arglists (quote (["java.time.OffsetDateTime" "long"]))} (^js/JSJoda.OffsetDateTime [^js/JSJoda.OffsetDateTime this14392 ^long long14393] (.plusMonths this14392 long14393))) -(clojure.core/defn is-before {:arglists (quote (["java.time.OffsetDateTime" "java.time.OffsetDateTime"]))} (^boolean [^js/JSJoda.OffsetDateTime this14394 ^js/JSJoda.OffsetDateTime java-time-OffsetDateTime14395] (.isBefore this14394 java-time-OffsetDateTime14395))) -(clojure.core/defn minus-months {:arglists (quote (["java.time.OffsetDateTime" "long"]))} (^js/JSJoda.OffsetDateTime [^js/JSJoda.OffsetDateTime this14396 ^long long14397] (.minusMonths this14396 long14397))) -(clojure.core/defn minus {:arglists (quote (["java.time.OffsetDateTime" "long" "java.time.temporal.TemporalUnit"] ["java.time.OffsetDateTime" "java.time.temporal.TemporalAmount"]))} (^js/JSJoda.OffsetDateTime [^js/JSJoda.OffsetDateTime this14398 ^long long14399 ^js/JSJoda.TemporalUnit java-time-temporal-TemporalUnit14400] (.minus this14398 long14399 java-time-temporal-TemporalUnit14400)) (^js/JSJoda.OffsetDateTime [^js/JSJoda.OffsetDateTime this14401 ^js/JSJoda.TemporalAmount java-time-temporal-TemporalAmount14402] (.minus this14401 java-time-temporal-TemporalAmount14402))) -(clojure.core/defn plus-hours {:arglists (quote (["java.time.OffsetDateTime" "long"]))} (^js/JSJoda.OffsetDateTime [^js/JSJoda.OffsetDateTime this14403 ^long long14404] (.plusHours this14403 long14404))) -(clojure.core/defn plus-days {:arglists (quote (["java.time.OffsetDateTime" "long"]))} (^js/JSJoda.OffsetDateTime [^js/JSJoda.OffsetDateTime this14405 ^long long14406] (.plusDays this14405 long14406))) -(clojure.core/defn to-local-time {:arglists (quote (["java.time.OffsetDateTime"]))} (^js/JSJoda.LocalTime [^js/JSJoda.OffsetDateTime this14407] (.toLocalTime this14407))) -(clojure.core/defn get-long {:arglists (quote (["java.time.OffsetDateTime" "java.time.temporal.TemporalField"]))} (^long [^js/JSJoda.OffsetDateTime this14408 ^js/JSJoda.TemporalField java-time-temporal-TemporalField14409] (.getLong this14408 java-time-temporal-TemporalField14409))) -(clojure.core/defn get-offset {:arglists (quote (["java.time.OffsetDateTime"]))} (^js/JSJoda.ZoneOffset [^js/JSJoda.OffsetDateTime this14410] (.offset this14410))) -(clojure.core/defn to-zoned-date-time {:arglists (quote (["java.time.OffsetDateTime"]))} (^js/JSJoda.ZonedDateTime [^js/JSJoda.OffsetDateTime this14411] (.toZonedDateTime this14411))) -(clojure.core/defn with-year {:arglists (quote (["java.time.OffsetDateTime" "int"]))} (^js/JSJoda.OffsetDateTime [^js/JSJoda.OffsetDateTime this14412 ^int int14413] (.withYear this14412 int14413))) -(clojure.core/defn with-nano {:arglists (quote (["java.time.OffsetDateTime" "int"]))} (^js/JSJoda.OffsetDateTime [^js/JSJoda.OffsetDateTime this14414 ^int int14415] (.withNano this14414 int14415))) -(clojure.core/defn to-epoch-second {:arglists (quote (["java.time.OffsetDateTime"]))} (^long [^js/JSJoda.OffsetDateTime this14416] (.toEpochSecond this14416))) -(clojure.core/defn until {:arglists (quote (["java.time.OffsetDateTime" "java.time.temporal.Temporal" "java.time.temporal.TemporalUnit"]))} (^long [^js/JSJoda.OffsetDateTime this14417 ^js/JSJoda.Temporal java-time-temporal-Temporal14418 ^js/JSJoda.TemporalUnit java-time-temporal-TemporalUnit14419] (.until this14417 java-time-temporal-Temporal14418 java-time-temporal-TemporalUnit14419))) -(clojure.core/defn with-offset-same-local {:arglists (quote (["java.time.OffsetDateTime" "java.time.ZoneOffset"]))} (^js/JSJoda.OffsetDateTime [^js/JSJoda.OffsetDateTime this14420 ^js/JSJoda.ZoneOffset java-time-ZoneOffset14421] (.withOffsetSameLocal this14420 java-time-ZoneOffset14421))) -(clojure.core/defn with-day-of-month {:arglists (quote (["java.time.OffsetDateTime" "int"]))} (^js/JSJoda.OffsetDateTime [^js/JSJoda.OffsetDateTime this14422 ^int int14423] (.withDayOfMonth this14422 int14423))) -(clojure.core/defn get-day-of-month {:arglists (quote (["java.time.OffsetDateTime"]))} (^int [^js/JSJoda.OffsetDateTime this14424] (.dayOfMonth this14424))) -(clojure.core/defn from {:arglists (quote (["java.time.temporal.TemporalAccessor"]))} (^js/JSJoda.OffsetDateTime [^js/JSJoda.TemporalAccessor java-time-temporal-TemporalAccessor14425] (js-invoke java.time.OffsetDateTime "from" java-time-temporal-TemporalAccessor14425))) -(clojure.core/defn is-after {:arglists (quote (["java.time.OffsetDateTime" "java.time.OffsetDateTime"]))} (^boolean [^js/JSJoda.OffsetDateTime this14426 ^js/JSJoda.OffsetDateTime java-time-OffsetDateTime14427] (.isAfter this14426 java-time-OffsetDateTime14427))) -(clojure.core/defn minus-nanos {:arglists (quote (["java.time.OffsetDateTime" "long"]))} (^js/JSJoda.OffsetDateTime [^js/JSJoda.OffsetDateTime this14428 ^long long14429] (.minusNanos this14428 long14429))) -(clojure.core/defn is-supported {:arglists (quote (["java.time.OffsetDateTime" "java.time.temporal.TemporalUnit"] ["java.time.OffsetDateTime" "java.time.temporal.TemporalField"]))} (^boolean [this14430 G__14431] (.isSupported ^js/JSJoda.OffsetDateTime this14430 G__14431))) -(clojure.core/defn minus-years {:arglists (quote (["java.time.OffsetDateTime" "long"]))} (^js/JSJoda.OffsetDateTime [^js/JSJoda.OffsetDateTime this14432 ^long long14433] (.minusYears this14432 long14433))) -(clojure.core/defn parse {:arglists (quote (["java.lang.CharSequence" "java.time.format.DateTimeFormatter"] ["java.lang.CharSequence"]))} (^js/JSJoda.OffsetDateTime [^java.lang.CharSequence java-lang-CharSequence14434 ^js/JSJoda.DateTimeFormatter java-time-format-DateTimeFormatter14435] (js-invoke java.time.OffsetDateTime "parse" java-lang-CharSequence14434 java-time-format-DateTimeFormatter14435)) (^js/JSJoda.OffsetDateTime [^java.lang.CharSequence java-lang-CharSequence14436] (js-invoke java.time.OffsetDateTime "parse" java-lang-CharSequence14436))) -(clojure.core/defn with-second {:arglists (quote (["java.time.OffsetDateTime" "int"]))} (^js/JSJoda.OffsetDateTime [^js/JSJoda.OffsetDateTime this14437 ^int int14438] (.withSecond this14437 int14438))) -(clojure.core/defn to-local-date {:arglists (quote (["java.time.OffsetDateTime"]))} (^js/JSJoda.LocalDate [^js/JSJoda.OffsetDateTime this14439] (.toLocalDate this14439))) -(clojure.core/defn get-minute {:arglists (quote (["java.time.OffsetDateTime"]))} (^int [^js/JSJoda.OffsetDateTime this14440] (.minute this14440))) -(clojure.core/defn hash-code {:arglists (quote (["java.time.OffsetDateTime"]))} (^int [^js/JSJoda.OffsetDateTime this14441] (.hashCode this14441))) -(clojure.core/defn adjust-into {:arglists (quote (["java.time.OffsetDateTime" "java.time.temporal.Temporal"]))} (^js/JSJoda.Temporal [^js/JSJoda.OffsetDateTime this14442 ^js/JSJoda.Temporal java-time-temporal-Temporal14443] (.adjustInto this14442 java-time-temporal-Temporal14443))) -(clojure.core/defn with {:arglists (quote (["java.time.OffsetDateTime" "java.time.temporal.TemporalAdjuster"] ["java.time.OffsetDateTime" "java.time.temporal.TemporalField" "long"]))} (^js/JSJoda.OffsetDateTime [^js/JSJoda.OffsetDateTime this14444 ^js/JSJoda.TemporalAdjuster java-time-temporal-TemporalAdjuster14445] (.with this14444 java-time-temporal-TemporalAdjuster14445)) (^js/JSJoda.OffsetDateTime [^js/JSJoda.OffsetDateTime this14446 ^js/JSJoda.TemporalField java-time-temporal-TemporalField14447 ^long long14448] (.with this14446 java-time-temporal-TemporalField14447 long14448))) -(clojure.core/defn now {:arglists (quote (["java.time.ZoneId"] ["java.time.Clock"] []))} (^js/JSJoda.OffsetDateTime [G__14450] (js-invoke java.time.OffsetDateTime "now" G__14450)) (^js/JSJoda.OffsetDateTime [] (js-invoke java.time.OffsetDateTime "now"))) -(clojure.core/defn to-local-date-time {:arglists (quote (["java.time.OffsetDateTime"]))} (^js/JSJoda.LocalDateTime [^js/JSJoda.OffsetDateTime this14451] (.toLocalDateTime this14451))) -(clojure.core/defn get-month-value {:arglists (quote (["java.time.OffsetDateTime"]))} (^int [^js/JSJoda.OffsetDateTime this14452] (.monthValue this14452))) -(clojure.core/defn with-day-of-year {:arglists (quote (["java.time.OffsetDateTime" "int"]))} (^js/JSJoda.OffsetDateTime [^js/JSJoda.OffsetDateTime this14453 ^int int14454] (.withDayOfYear this14453 int14454))) -(clojure.core/defn compare-to {:arglists (quote (["java.time.OffsetDateTime" "java.time.OffsetDateTime"]))} (^int [^js/JSJoda.OffsetDateTime this14455 ^js/JSJoda.OffsetDateTime java-time-OffsetDateTime14456] (.compareTo this14455 java-time-OffsetDateTime14456))) -(clojure.core/defn get-month {:arglists (quote (["java.time.OffsetDateTime"]))} (^js/JSJoda.Month [^js/JSJoda.OffsetDateTime this14457] (.month this14457))) -(clojure.core/defn of-instant {:arglists (quote (["java.time.Instant" "java.time.ZoneId"]))} (^js/JSJoda.OffsetDateTime [^js/JSJoda.Instant java-time-Instant14458 ^js/JSJoda.ZoneId java-time-ZoneId14459] (js-invoke java.time.OffsetDateTime "ofInstant" java-time-Instant14458 java-time-ZoneId14459))) -(clojure.core/defn plus-seconds {:arglists (quote (["java.time.OffsetDateTime" "long"]))} (^js/JSJoda.OffsetDateTime [^js/JSJoda.OffsetDateTime this14460 ^long long14461] (.plusSeconds this14460 long14461))) -(clojure.core/defn get {:arglists (quote (["java.time.OffsetDateTime" "java.time.temporal.TemporalField"]))} (^int [^js/JSJoda.OffsetDateTime this14462 ^js/JSJoda.TemporalField java-time-temporal-TemporalField14463] (.get this14462 java-time-temporal-TemporalField14463))) -(clojure.core/defn equals {:arglists (quote (["java.time.OffsetDateTime" "java.lang.Object"]))} (^boolean [^js/JSJoda.OffsetDateTime this14464 ^java.lang.Object java-lang-Object14465] (.equals this14464 java-lang-Object14465))) -(clojure.core/defn format {:arglists (quote (["java.time.OffsetDateTime" "java.time.format.DateTimeFormatter"]))} (^java.lang.String [^js/JSJoda.OffsetDateTime this14466 ^js/JSJoda.DateTimeFormatter java-time-format-DateTimeFormatter14467] (.format this14466 java-time-format-DateTimeFormatter14467))) -(clojure.core/defn plus-years {:arglists (quote (["java.time.OffsetDateTime" "long"]))} (^js/JSJoda.OffsetDateTime [^js/JSJoda.OffsetDateTime this14468 ^long long14469] (.plusYears this14468 long14469))) -(clojure.core/defn minus-days {:arglists (quote (["java.time.OffsetDateTime" "long"]))} (^js/JSJoda.OffsetDateTime [^js/JSJoda.OffsetDateTime this14470 ^long long14471] (.minusDays this14470 long14471))) +(ns cljc.java-time.offset-date-time + (:refer-clojure :exclude + [abs get range format min max next name resolve short]) + (:require [cljc.java-time.extn.calendar-awareness] + [goog.object] + [java.time :refer [OffsetDateTime]])) + +(def min + "The minimum supported {@code OffsetDateTime}, '-999999999-01-01T00:00:00+18:00'. + This is the local date-time of midnight at the start of the minimum date + in the maximum offset (larger offsets are earlier on the time-line). + This combines {@link LocalDateTime#MIN} and {@link ZoneOffset#MAX}. + This could be used by an application as a \"far past\" date-time." + (goog.object/get java.time.OffsetDateTime "MIN")) + +(def max + "The maximum supported {@code OffsetDateTime}, '+999999999-12-31T23:59:59.999999999-18:00'. + This is the local date-time just before midnight at the end of the maximum date + in the minimum offset (larger negative offsets are later on the time-line). + This combines {@link LocalDateTime#MAX} and {@link ZoneOffset#MIN}. + This could be used by an application as a \"far future\" date-time." + (goog.object/get java.time.OffsetDateTime "MAX")) + +(defn minus-minutes + "Returns a copy of this {@code OffsetDateTime} with the specified number of minutes subtracted. + + This instance is immutable and unaffected by this method call. + + @param minutes the minutes to subtract, may be negative + @return an {@code OffsetDateTime} based on this date-time with the minutes subtracted, not null + @throws DateTimeException if the result exceeds the supported date range" + {:arglists (quote (["java.time.OffsetDateTime" "long"]))} + (^js/JSJoda.OffsetDateTime [^js/JSJoda.OffsetDateTime this ^long minutes] + (.minusMinutes this minutes))) + +(defn truncated-to + "Returns a copy of this {@code OffsetDateTime} with the time truncated. + + Truncation returns a copy of the original date-time with fields + smaller than the specified unit set to zero. + For example, truncating with the {@link ChronoUnit#MINUTES minutes} unit + will set the second-of-minute and nano-of-second field to zero. + + The unit must have a {@linkplain TemporalUnit#getDuration() duration} + that divides into the length of a standard day without remainder. + This includes all supplied time units on {@link ChronoUnit} and + {@link ChronoUnit#DAYS DAYS}. Other units throw an exception. + + The offset does not affect the calculation and will be the same in the result. + + This instance is immutable and unaffected by this method call. + + @param unit the unit to truncate to, not null + @return an {@code OffsetDateTime} based on this date-time with the time truncated, not null + @throws DateTimeException if unable to truncate + @throws UnsupportedTemporalTypeException if the unit is not supported" + {:arglists (quote (["java.time.OffsetDateTime" + "java.time.temporal.TemporalUnit"]))} + (^js/JSJoda.OffsetDateTime + [^js/JSJoda.OffsetDateTime this ^js/JSJoda.TemporalUnit unit] + (.truncatedTo this unit))) + +(defn minus-weeks + "Returns a copy of this {@code OffsetDateTime} with the specified number of weeks subtracted. + + This method subtracts the specified amount in weeks from the days field decrementing + the month and year fields as necessary to ensure the result remains valid. + The result is only invalid if the maximum/minimum year is exceeded. + + For example, 2008-12-31 minus one week would result in 2009-01-07. + + This instance is immutable and unaffected by this method call. + + @param weeks the weeks to subtract, may be negative + @return an {@code OffsetDateTime} based on this date-time with the weeks subtracted, not null + @throws DateTimeException if the result exceeds the supported date range" + {:arglists (quote (["java.time.OffsetDateTime" "long"]))} + (^js/JSJoda.OffsetDateTime [^js/JSJoda.OffsetDateTime this ^long weeks] + (.minusWeeks this weeks))) + +(defn to-instant + "Converts this date-time to an {@code Instant}. + + This returns an {@code Instant} representing the same point on the + time-line as this date-time. + + @return an {@code Instant} representing the same instant, not null" + {:arglists (quote (["java.time.OffsetDateTime"]))} + (^js/JSJoda.Instant [^js/JSJoda.OffsetDateTime this] (.toInstant this))) + +(defn plus-weeks + "Returns a copy of this OffsetDateTime with the specified number of weeks added. + + This method adds the specified amount in weeks to the days field incrementing + the month and year fields as necessary to ensure the result remains valid. + The result is only invalid if the maximum/minimum year is exceeded. + + For example, 2008-12-31 plus one week would result in 2009-01-07. + + This instance is immutable and unaffected by this method call. + + @param weeks the weeks to add, may be negative + @return an {@code OffsetDateTime} based on this date-time with the weeks added, not null + @throws DateTimeException if the result exceeds the supported date range" + {:arglists (quote (["java.time.OffsetDateTime" "long"]))} + (^js/JSJoda.OffsetDateTime [^js/JSJoda.OffsetDateTime this ^long weeks] + (.plusWeeks this weeks))) + +(defn range + "Gets the range of valid values for the specified field. + + The range object expresses the minimum and maximum valid values for a field. + This date-time is used to enhance the accuracy of the returned range. + If it is not possible to return the range, because the field is not supported + or for some other reason, an exception is thrown. + + If the field is a {@link ChronoField} then the query is implemented here. + The {@link #isSupported(TemporalField) supported fields} will return + appropriate range instances. + All other {@code ChronoField} instances will throw an {@code UnsupportedTemporalTypeException}. + + If the field is not a {@code ChronoField}, then the result of this method + is obtained by invoking {@code TemporalField.rangeRefinedBy(TemporalAccessor)} + passing {@code this} as the argument. + Whether the range can be obtained is determined by the field. + + @param field the field to query the range for, not null + @return the range of valid values for the field, not null + @throws DateTimeException if the range for the field cannot be obtained + @throws UnsupportedTemporalTypeException if the field is not supported" + {:arglists (quote (["java.time.OffsetDateTime" + "java.time.temporal.TemporalField"]))} + (^js/JSJoda.ValueRange + [^js/JSJoda.OffsetDateTime this ^js/JSJoda.TemporalField field] + (.range this field))) + +(defn get-hour + "Gets the hour-of-day field. + + @return the hour-of-day, from 0 to 23" + {:arglists (quote (["java.time.OffsetDateTime"]))} + (^int [^js/JSJoda.OffsetDateTime this] (.hour this))) + +(defn at-zone-same-instant + "Combines this date-time with a time-zone to create a {@code ZonedDateTime} + ensuring that the result has the same instant. + + This returns a {@code ZonedDateTime} formed from this date-time and the specified time-zone. + This conversion will ignore the visible local date-time and use the underlying instant instead. + This avoids any problems with local time-line gaps or overlaps. + The result might have different values for fields such as hour, minute an even day. + + To attempt to retain the values of the fields, use {@link #atZoneSimilarLocal(ZoneId)}. + To use the offset as the zone ID, use {@link #toZonedDateTime()}. + + @param zone the time-zone to use, not null + @return the zoned date-time formed from this date-time, not null" + {:arglists (quote (["java.time.OffsetDateTime" "java.time.ZoneId"]))} + (^js/JSJoda.ZonedDateTime + [^js/JSJoda.OffsetDateTime this ^js/JSJoda.ZoneId zone] + (.atZoneSameInstant this zone))) + +(defn minus-hours + "Returns a copy of this {@code OffsetDateTime} with the specified number of hours subtracted. + + This instance is immutable and unaffected by this method call. + + @param hours the hours to subtract, may be negative + @return an {@code OffsetDateTime} based on this date-time with the hours subtracted, not null + @throws DateTimeException if the result exceeds the supported date range" + {:arglists (quote (["java.time.OffsetDateTime" "long"]))} + (^js/JSJoda.OffsetDateTime [^js/JSJoda.OffsetDateTime this ^long hours] + (.minusHours this hours))) + +(defn of + {:arglists (quote (["java.time.LocalDateTime" "java.time.ZoneOffset"] + ["java.time.LocalDate" "java.time.LocalTime" + "java.time.ZoneOffset"] + ["int" "int" "int" "int" "int" "int" "int" + "java.time.ZoneOffset"]))} + (^js/JSJoda.OffsetDateTime + [^js/JSJoda.LocalDateTime date-time ^js/JSJoda.ZoneOffset offset] + (js-invoke java.time.OffsetDateTime "of" date-time offset)) + (^js/JSJoda.OffsetDateTime + [^js/JSJoda.LocalDate date ^js/JSJoda.LocalTime time + ^js/JSJoda.ZoneOffset offset] + (js-invoke java.time.OffsetDateTime "of" date time offset)) + (^js/JSJoda.OffsetDateTime + [^int year ^int month ^int day-of-month ^int hour ^int minute ^int second + ^int nano-of-second ^js/JSJoda.ZoneOffset offset] + (js-invoke java.time.OffsetDateTime + "of" + year + month + day-of-month + hour + minute + second + nano-of-second + offset))) + +(defn with-month + "Returns a copy of this {@code OffsetDateTime} with the month-of-year altered. + + The time and offset do not affect the calculation and will be the same in the result. + If the day-of-month is invalid for the year, it will be changed to the last valid day of the month. + + This instance is immutable and unaffected by this method call. + + @param month the month-of-year to set in the result, from 1 (January) to 12 (December) + @return an {@code OffsetDateTime} based on this date-time with the requested month, not null + @throws DateTimeException if the month-of-year value is invalid" + {:arglists (quote (["java.time.OffsetDateTime" "int"]))} + (^js/JSJoda.OffsetDateTime [^js/JSJoda.OffsetDateTime this ^int month] + (.withMonth this month))) + +(defn is-equal + "Checks if the instant of this date-time is equal to that of the specified date-time. + + This method differs from the comparison in {@link #compareTo} and {@link #equals} + in that it only compares the instant of the date-time. This is equivalent to using + {@code dateTime1.toInstant().equals(dateTime2.toInstant());}. + + @param other the other date-time to compare to, not null + @return true if the instant equals the instant of the specified date-time" + {:arglists (quote (["java.time.OffsetDateTime" "java.time.OffsetDateTime"]))} + (^boolean [^js/JSJoda.OffsetDateTime this ^js/JSJoda.OffsetDateTime other] + (.isEqual this other))) + +(defn get-nano + "Gets the nano-of-second field. + + @return the nano-of-second, from 0 to 999,999,999" + {:arglists (quote (["java.time.OffsetDateTime"]))} + (^int [^js/JSJoda.OffsetDateTime this] (.nano this))) + +(defn to-offset-time + "Converts this date-time to an {@code OffsetTime}. + + This returns an offset time with the same local time and offset. + + @return an OffsetTime representing the time and offset, not null" + {:arglists (quote (["java.time.OffsetDateTime"]))} + (^js/JSJoda.OffsetTime [^js/JSJoda.OffsetDateTime this] (.toOffsetTime this))) + +(defn at-zone-similar-local + "Combines this date-time with a time-zone to create a {@code ZonedDateTime} + trying to keep the same local date and time. + + This returns a {@code ZonedDateTime} formed from this date-time and the specified time-zone. + Where possible, the result will have the same local date-time as this object. + + Time-zone rules, such as daylight savings, mean that not every time on the + local time-line exists. If the local date-time is in a gap or overlap according to + the rules then a resolver is used to determine the resultant local time and offset. + This method uses {@link ZonedDateTime#ofLocal(LocalDateTime, ZoneId, ZoneOffset)} + to retain the offset from this instance if possible. + + Finer control over gaps and overlaps is available in two ways. + If you simply want to use the later offset at overlaps then call + {@link ZonedDateTime#withLaterOffsetAtOverlap()} immediately after this method. + + To create a zoned date-time at the same instant irrespective of the local time-line, + use {@link #atZoneSameInstant(ZoneId)}. + To use the offset as the zone ID, use {@link #toZonedDateTime()}. + + @param zone the time-zone to use, not null + @return the zoned date-time formed from this date and the earliest valid time for the zone, not null" + {:arglists (quote (["java.time.OffsetDateTime" "java.time.ZoneId"]))} + (^js/JSJoda.ZonedDateTime + [^js/JSJoda.OffsetDateTime this ^js/JSJoda.ZoneId zone] + (.atZoneSimilarLocal this zone))) + +(defn get-year + "Gets the year field. + + This method returns the primitive {@code int} value for the year. + + The year returned by this method is proleptic as per {@code get(YEAR)}. + To obtain the year-of-era, use {@code get(YEAR_OF_ERA)}. + + @return the year, from MIN_YEAR to MAX_YEAR" + {:arglists (quote (["java.time.OffsetDateTime"]))} + (^int [^js/JSJoda.OffsetDateTime this] (.year this))) + +(defn minus-seconds + "Returns a copy of this {@code OffsetDateTime} with the specified number of seconds subtracted. + + This instance is immutable and unaffected by this method call. + + @param seconds the seconds to subtract, may be negative + @return an {@code OffsetDateTime} based on this date-time with the seconds subtracted, not null + @throws DateTimeException if the result exceeds the supported date range" + {:arglists (quote (["java.time.OffsetDateTime" "long"]))} + (^js/JSJoda.OffsetDateTime [^js/JSJoda.OffsetDateTime this ^long seconds] + (.minusSeconds this seconds))) + +(defn get-second + "Gets the second-of-minute field. + + @return the second-of-minute, from 0 to 59" + {:arglists (quote (["java.time.OffsetDateTime"]))} + (^int [^js/JSJoda.OffsetDateTime this] (.second this))) + +(defn plus-nanos + "Returns a copy of this {@code OffsetDateTime} with the specified number of nanoseconds added. + + This instance is immutable and unaffected by this method call. + + @param nanos the nanos to add, may be negative + @return an {@code OffsetDateTime} based on this date-time with the nanoseconds added, not null + @throws DateTimeException if the unit cannot be added to this type" + {:arglists (quote (["java.time.OffsetDateTime" "long"]))} + (^js/JSJoda.OffsetDateTime [^js/JSJoda.OffsetDateTime this ^long nanos] + (.plusNanos this nanos))) + +(defn get-day-of-year + "Gets the day-of-year field. + + This method returns the primitive {@code int} value for the day-of-year. + + @return the day-of-year, from 1 to 365, or 366 in a leap year" + {:arglists (quote (["java.time.OffsetDateTime"]))} + (^int [^js/JSJoda.OffsetDateTime this] (.dayOfYear this))) + +(defn plus + {:arglists (quote (["java.time.OffsetDateTime" + "java.time.temporal.TemporalAmount"] + ["java.time.OffsetDateTime" "long" + "java.time.temporal.TemporalUnit"]))} + (^js/JSJoda.OffsetDateTime + [^js/JSJoda.OffsetDateTime this ^js/JSJoda.TemporalAmount amount-to-add] + (.plus this amount-to-add)) + (^js/JSJoda.OffsetDateTime + [^js/JSJoda.OffsetDateTime this ^long amount-to-add + ^js/JSJoda.TemporalUnit unit] + (.plus this amount-to-add unit))) + +(defn time-line-order + "Gets a comparator that compares two {@code OffsetDateTime} instances + based solely on the instant. + + This method differs from the comparison in {@link #compareTo} in that it + only compares the underlying instant. + + @return a comparator that compares in time-line order + + @see #isAfter + @see #isBefore + @see #isEqual" + {:arglists (quote ([]))} + (^java.util.Comparator [] + (js-invoke java.time.OffsetDateTime "timeLineOrder"))) + +(defn with-hour + "Returns a copy of this {@code OffsetDateTime} with the hour-of-day altered. + + The date and offset do not affect the calculation and will be the same in the result. + + This instance is immutable and unaffected by this method call. + + @param hour the hour-of-day to set in the result, from 0 to 23 + @return an {@code OffsetDateTime} based on this date-time with the requested hour, not null + @throws DateTimeException if the hour value is invalid" + {:arglists (quote (["java.time.OffsetDateTime" "int"]))} + (^js/JSJoda.OffsetDateTime [^js/JSJoda.OffsetDateTime this ^int hour] + (.withHour this hour))) + +(defn with-minute + "Returns a copy of this {@code OffsetDateTime} with the minute-of-hour altered. + + The date and offset do not affect the calculation and will be the same in the result. + + This instance is immutable and unaffected by this method call. + + @param minute the minute-of-hour to set in the result, from 0 to 59 + @return an {@code OffsetDateTime} based on this date-time with the requested minute, not null + @throws DateTimeException if the minute value is invalid" + {:arglists (quote (["java.time.OffsetDateTime" "int"]))} + (^js/JSJoda.OffsetDateTime [^js/JSJoda.OffsetDateTime this ^int minute] + (.withMinute this minute))) + +(defn plus-minutes + "Returns a copy of this {@code OffsetDateTime} with the specified number of minutes added. + + This instance is immutable and unaffected by this method call. + + @param minutes the minutes to add, may be negative + @return an {@code OffsetDateTime} based on this date-time with the minutes added, not null + @throws DateTimeException if the result exceeds the supported date range" + {:arglists (quote (["java.time.OffsetDateTime" "long"]))} + (^js/JSJoda.OffsetDateTime [^js/JSJoda.OffsetDateTime this ^long minutes] + (.plusMinutes this minutes))) + +(defn query + "Queries this date-time using the specified query. + + This queries this date-time using the specified query strategy object. + The {@code TemporalQuery} object defines the logic to be used to + obtain the result. Read the documentation of the query to understand + what the result of this method will be. + + The result of this method is obtained by invoking the + {@link TemporalQuery#queryFrom(TemporalAccessor)} method on the + specified query passing {@code this} as the argument. + + @param the type of the result + @param query the query to invoke, not null + @return the query result, null may be returned (defined by the query) + @throws DateTimeException if unable to query (defined by the query) + @throws ArithmeticException if numeric overflow occurs (defined by the query)" + {:arglists (quote (["java.time.OffsetDateTime" + "java.time.temporal.TemporalQuery"]))} + (^java.lang.Object + [^js/JSJoda.OffsetDateTime this ^js/JSJoda.TemporalQuery query] + (.query this query))) + +(defn with-offset-same-instant + "Returns a copy of this {@code OffsetDateTime} with the specified offset ensuring + that the result is at the same instant. + + This method returns an object with the specified {@code ZoneOffset} and a {@code LocalDateTime} + adjusted by the difference between the two offsets. + This will result in the old and new objects representing the same instant. + This is useful for finding the local time in a different offset. + For example, if this time represents {@code 2007-12-03T10:30+02:00} and the offset specified is + {@code +03:00}, then this method will return {@code 2007-12-03T11:30+03:00}. + + To change the offset without adjusting the local time use {@link #withOffsetSameLocal}. + + This instance is immutable and unaffected by this method call. + + @param offset the zone offset to change to, not null + @return an {@code OffsetDateTime} based on this date-time with the requested offset, not null + @throws DateTimeException if the result exceeds the supported date range" + {:arglists (quote (["java.time.OffsetDateTime" "java.time.ZoneOffset"]))} + (^js/JSJoda.OffsetDateTime + [^js/JSJoda.OffsetDateTime this ^js/JSJoda.ZoneOffset offset] + (.withOffsetSameInstant this offset))) + +(defn get-day-of-week + "Gets the day-of-week field, which is an enum {@code DayOfWeek}. + + This method returns the enum {@link DayOfWeek} for the day-of-week. + This avoids confusion as to what {@code int} values mean. + If you need access to the primitive {@code int} value then the enum + provides the {@link DayOfWeek#getValue() int value}. + + Additional information can be obtained from the {@code DayOfWeek}. + This includes textual names of the values. + + @return the day-of-week, not null" + {:arglists (quote (["java.time.OffsetDateTime"]))} + (^js/JSJoda.DayOfWeek [^js/JSJoda.OffsetDateTime this] (.dayOfWeek this))) + +(defn to-string + "Outputs this date-time as a {@code String}, such as {@code 2007-12-03T10:15:30+01:00}. + + The output will be one of the following ISO-8601 formats: +
    +
  • {@code uuuu-MM-dd'T'HH:mmXXXXX}
  • +
  • {@code uuuu-MM-dd'T'HH:mm:ssXXXXX}
  • +
  • {@code uuuu-MM-dd'T'HH:mm:ss.SSSXXXXX}
  • +
  • {@code uuuu-MM-dd'T'HH:mm:ss.SSSSSSXXXXX}
  • +
  • {@code uuuu-MM-dd'T'HH:mm:ss.SSSSSSSSSXXXXX}
  • +
+ The format used will be the shortest that outputs the full value of + the time where the omitted parts are implied to be zero. + + @return a string representation of this date-time, not null" + {:arglists (quote (["java.time.OffsetDateTime"]))} + (^java.lang.String [^js/JSJoda.OffsetDateTime this] (.toString this))) + +(defn plus-months + "Returns a copy of this {@code OffsetDateTime} with the specified number of months added. + + This method adds the specified amount to the months field in three steps: +
    +
  1. Add the input months to the month-of-year field
  2. +
  3. Check if the resulting date would be invalid
  4. +
  5. Adjust the day-of-month to the last valid day if necessary
  6. +
+ + For example, 2007-03-31 plus one month would result in the invalid date + 2007-04-31. Instead of returning an invalid result, the last valid day + of the month, 2007-04-30, is selected instead. + + This instance is immutable and unaffected by this method call. + + @param months the months to add, may be negative + @return an {@code OffsetDateTime} based on this date-time with the months added, not null + @throws DateTimeException if the result exceeds the supported date range" + {:arglists (quote (["java.time.OffsetDateTime" "long"]))} + (^js/JSJoda.OffsetDateTime [^js/JSJoda.OffsetDateTime this ^long months] + (.plusMonths this months))) + +(defn is-before + "Checks if the instant of this date-time is before that of the specified date-time. + + This method differs from the comparison in {@link #compareTo} in that it + only compares the instant of the date-time. This is equivalent to using + {@code dateTime1.toInstant().isBefore(dateTime2.toInstant());}. + + @param other the other date-time to compare to, not null + @return true if this is before the instant of the specified date-time" + {:arglists (quote (["java.time.OffsetDateTime" "java.time.OffsetDateTime"]))} + (^boolean [^js/JSJoda.OffsetDateTime this ^js/JSJoda.OffsetDateTime other] + (.isBefore this other))) + +(defn minus-months + "Returns a copy of this {@code OffsetDateTime} with the specified number of months subtracted. + + This method subtracts the specified amount from the months field in three steps: +
    +
  1. Subtract the input months from the month-of-year field
  2. +
  3. Check if the resulting date would be invalid
  4. +
  5. Adjust the day-of-month to the last valid day if necessary
  6. +
+ + For example, 2007-03-31 minus one month would result in the invalid date + 2007-04-31. Instead of returning an invalid result, the last valid day + of the month, 2007-04-30, is selected instead. + + This instance is immutable and unaffected by this method call. + + @param months the months to subtract, may be negative + @return an {@code OffsetDateTime} based on this date-time with the months subtracted, not null + @throws DateTimeException if the result exceeds the supported date range" + {:arglists (quote (["java.time.OffsetDateTime" "long"]))} + (^js/JSJoda.OffsetDateTime [^js/JSJoda.OffsetDateTime this ^long months] + (.minusMonths this months))) + +(defn minus + {:arglists (quote (["java.time.OffsetDateTime" + "java.time.temporal.TemporalAmount"] + ["java.time.OffsetDateTime" "long" + "java.time.temporal.TemporalUnit"]))} + (^js/JSJoda.OffsetDateTime + [^js/JSJoda.OffsetDateTime this ^js/JSJoda.TemporalAmount amount-to-subtract] + (.minus this amount-to-subtract)) + (^js/JSJoda.OffsetDateTime + [^js/JSJoda.OffsetDateTime this ^long amount-to-subtract + ^js/JSJoda.TemporalUnit unit] + (.minus this amount-to-subtract unit))) + +(defn plus-hours + "Returns a copy of this {@code OffsetDateTime} with the specified number of hours added. + + This instance is immutable and unaffected by this method call. + + @param hours the hours to add, may be negative + @return an {@code OffsetDateTime} based on this date-time with the hours added, not null + @throws DateTimeException if the result exceeds the supported date range" + {:arglists (quote (["java.time.OffsetDateTime" "long"]))} + (^js/JSJoda.OffsetDateTime [^js/JSJoda.OffsetDateTime this ^long hours] + (.plusHours this hours))) + +(defn plus-days + "Returns a copy of this OffsetDateTime with the specified number of days added. + + This method adds the specified amount to the days field incrementing the + month and year fields as necessary to ensure the result remains valid. + The result is only invalid if the maximum/minimum year is exceeded. + + For example, 2008-12-31 plus one day would result in 2009-01-01. + + This instance is immutable and unaffected by this method call. + + @param days the days to add, may be negative + @return an {@code OffsetDateTime} based on this date-time with the days added, not null + @throws DateTimeException if the result exceeds the supported date range" + {:arglists (quote (["java.time.OffsetDateTime" "long"]))} + (^js/JSJoda.OffsetDateTime [^js/JSJoda.OffsetDateTime this ^long days] + (.plusDays this days))) + +(defn to-local-time + "Gets the {@code LocalTime} part of this date-time. + + This returns a {@code LocalTime} with the same hour, minute, second and + nanosecond as this date-time. + + @return the time part of this date-time, not null" + {:arglists (quote (["java.time.OffsetDateTime"]))} + (^js/JSJoda.LocalTime [^js/JSJoda.OffsetDateTime this] (.toLocalTime this))) + +(defn get-long + "Gets the value of the specified field from this date-time as a {@code long}. + + This queries this date-time for the value of the specified field. + If it is not possible to return the value, because the field is not supported + or for some other reason, an exception is thrown. + + If the field is a {@link ChronoField} then the query is implemented here. + The {@link #isSupported(TemporalField) supported fields} will return valid + values based on this date-time. + All other {@code ChronoField} instances will throw an {@code UnsupportedTemporalTypeException}. + + If the field is not a {@code ChronoField}, then the result of this method + is obtained by invoking {@code TemporalField.getFrom(TemporalAccessor)} + passing {@code this} as the argument. Whether the value can be obtained, + and what the value represents, is determined by the field. + + @param field the field to get, not null + @return the value for the field + @throws DateTimeException if a value for the field cannot be obtained + @throws UnsupportedTemporalTypeException if the field is not supported + @throws ArithmeticException if numeric overflow occurs" + {:arglists (quote (["java.time.OffsetDateTime" + "java.time.temporal.TemporalField"]))} + (^long [^js/JSJoda.OffsetDateTime this ^js/JSJoda.TemporalField field] + (.getLong this field))) + +(defn get-offset + "Gets the zone offset, such as '+01:00'. + + This is the offset of the local date-time from UTC/Greenwich. + + @return the zone offset, not null" + {:arglists (quote (["java.time.OffsetDateTime"]))} + (^js/JSJoda.ZoneOffset [^js/JSJoda.OffsetDateTime this] (.offset this))) + +(defn to-zoned-date-time + "Converts this date-time to a {@code ZonedDateTime} using the offset as the zone ID. + + This creates the simplest possible {@code ZonedDateTime} using the offset + as the zone ID. + + To control the time-zone used, see {@link #atZoneSameInstant(ZoneId)} and + {@link #atZoneSimilarLocal(ZoneId)}. + + @return a zoned date-time representing the same local date-time and offset, not null" + {:arglists (quote (["java.time.OffsetDateTime"]))} + (^js/JSJoda.ZonedDateTime [^js/JSJoda.OffsetDateTime this] + (.toZonedDateTime this))) + +(defn with-year + "Returns a copy of this {@code OffsetDateTime} with the year altered. + + The time and offset do not affect the calculation and will be the same in the result. + If the day-of-month is invalid for the year, it will be changed to the last valid day of the month. + + This instance is immutable and unaffected by this method call. + + @param year the year to set in the result, from MIN_YEAR to MAX_YEAR + @return an {@code OffsetDateTime} based on this date-time with the requested year, not null + @throws DateTimeException if the year value is invalid" + {:arglists (quote (["java.time.OffsetDateTime" "int"]))} + (^js/JSJoda.OffsetDateTime [^js/JSJoda.OffsetDateTime this ^int year] + (.withYear this year))) + +(defn with-nano + "Returns a copy of this {@code OffsetDateTime} with the nano-of-second altered. + + The date and offset do not affect the calculation and will be the same in the result. + + This instance is immutable and unaffected by this method call. + + @param nanoOfSecond the nano-of-second to set in the result, from 0 to 999,999,999 + @return an {@code OffsetDateTime} based on this date-time with the requested nanosecond, not null + @throws DateTimeException if the nano value is invalid" + {:arglists (quote (["java.time.OffsetDateTime" "int"]))} + (^js/JSJoda.OffsetDateTime + [^js/JSJoda.OffsetDateTime this ^int nano-of-second] + (.withNano this nano-of-second))) + +(defn to-epoch-second + "Converts this date-time to the number of seconds from the epoch of 1970-01-01T00:00:00Z. + + This allows this date-time to be converted to a value of the + {@link ChronoField#INSTANT_SECONDS epoch-seconds} field. This is primarily + intended for low-level conversions rather than general application usage. + + @return the number of seconds from the epoch of 1970-01-01T00:00:00Z" + {:arglists (quote (["java.time.OffsetDateTime"]))} + (^long [^js/JSJoda.OffsetDateTime this] (.toEpochSecond this))) + +(defn until + "Calculates the amount of time until another date-time in terms of the specified unit. + + This calculates the amount of time between two {@code OffsetDateTime} + objects in terms of a single {@code TemporalUnit}. + The start and end points are {@code this} and the specified date-time. + The result will be negative if the end is before the start. + For example, the amount in days between two date-times can be calculated + using {@code startDateTime.until(endDateTime, DAYS)}. + + The {@code Temporal} passed to this method is converted to a + {@code OffsetDateTime} using {@link #from(TemporalAccessor)}. + If the offset differs between the two date-times, the specified + end date-time is normalized to have the same offset as this date-time. + + The calculation returns a whole number, representing the number of + complete units between the two date-times. + For example, the amount in months between 2012-06-15T00:00Z and 2012-08-14T23:59Z + will only be one month as it is one minute short of two months. + + There are two equivalent ways of using this method. + The first is to invoke this method. + The second is to use {@link TemporalUnit#between(Temporal, Temporal)}: +
+   // these two lines are equivalent
+   amount = start.until(end, MONTHS);
+   amount = MONTHS.between(start, end);
+ 
+ The choice should be made based on which makes the code more readable. + + The calculation is implemented in this method for {@link ChronoUnit}. + The units {@code NANOS}, {@code MICROS}, {@code MILLIS}, {@code SECONDS}, + {@code MINUTES}, {@code HOURS} and {@code HALF_DAYS}, {@code DAYS}, + {@code WEEKS}, {@code MONTHS}, {@code YEARS}, {@code DECADES}, + {@code CENTURIES}, {@code MILLENNIA} and {@code ERAS} are supported. + Other {@code ChronoUnit} values will throw an exception. + + If the unit is not a {@code ChronoUnit}, then the result of this method + is obtained by invoking {@code TemporalUnit.between(Temporal, Temporal)} + passing {@code this} as the first argument and the converted input temporal + as the second argument. + + This instance is immutable and unaffected by this method call. + + @param endExclusive the end date, exclusive, which is converted to an {@code OffsetDateTime}, not null + @param unit the unit to measure the amount in, not null + @return the amount of time between this date-time and the end date-time + @throws DateTimeException if the amount cannot be calculated, or the end + temporal cannot be converted to an {@code OffsetDateTime} + @throws UnsupportedTemporalTypeException if the unit is not supported + @throws ArithmeticException if numeric overflow occurs" + {:arglists (quote (["java.time.OffsetDateTime" "java.time.temporal.Temporal" + "java.time.temporal.TemporalUnit"]))} + (^long + [^js/JSJoda.OffsetDateTime this ^js/JSJoda.Temporal end-exclusive + ^js/JSJoda.TemporalUnit unit] + (.until this end-exclusive unit))) + +(defn with-offset-same-local + "Returns a copy of this {@code OffsetDateTime} with the specified offset ensuring + that the result has the same local date-time. + + This method returns an object with the same {@code LocalDateTime} and the specified {@code ZoneOffset}. + No calculation is needed or performed. + For example, if this time represents {@code 2007-12-03T10:30+02:00} and the offset specified is + {@code +03:00}, then this method will return {@code 2007-12-03T10:30+03:00}. + + To take into account the difference between the offsets, and adjust the time fields, + use {@link #withOffsetSameInstant}. + + This instance is immutable and unaffected by this method call. + + @param offset the zone offset to change to, not null + @return an {@code OffsetDateTime} based on this date-time with the requested offset, not null" + {:arglists (quote (["java.time.OffsetDateTime" "java.time.ZoneOffset"]))} + (^js/JSJoda.OffsetDateTime + [^js/JSJoda.OffsetDateTime this ^js/JSJoda.ZoneOffset offset] + (.withOffsetSameLocal this offset))) + +(defn with-day-of-month + "Returns a copy of this {@code OffsetDateTime} with the day-of-month altered. + + If the resulting {@code OffsetDateTime} is invalid, an exception is thrown. + The time and offset do not affect the calculation and will be the same in the result. + + This instance is immutable and unaffected by this method call. + + @param dayOfMonth the day-of-month to set in the result, from 1 to 28-31 + @return an {@code OffsetDateTime} based on this date-time with the requested day, not null + @throws DateTimeException if the day-of-month value is invalid, + or if the day-of-month is invalid for the month-year" + {:arglists (quote (["java.time.OffsetDateTime" "int"]))} + (^js/JSJoda.OffsetDateTime [^js/JSJoda.OffsetDateTime this ^int day-of-month] + (.withDayOfMonth this day-of-month))) + +(defn get-day-of-month + "Gets the day-of-month field. + + This method returns the primitive {@code int} value for the day-of-month. + + @return the day-of-month, from 1 to 31" + {:arglists (quote (["java.time.OffsetDateTime"]))} + (^int [^js/JSJoda.OffsetDateTime this] (.dayOfMonth this))) + +(defn from + "Obtains an instance of {@code OffsetDateTime} from a temporal object. + + This obtains an offset date-time based on the specified temporal. + A {@code TemporalAccessor} represents an arbitrary set of date and time information, + which this factory converts to an instance of {@code OffsetDateTime}. + + The conversion will first obtain a {@code ZoneOffset} from the temporal object. + It will then try to obtain a {@code LocalDateTime}, falling back to an {@code Instant} if necessary. + The result will be the combination of {@code ZoneOffset} with either + with {@code LocalDateTime} or {@code Instant}. + Implementations are permitted to perform optimizations such as accessing + those fields that are equivalent to the relevant objects. + + This method matches the signature of the functional interface {@link TemporalQuery} + allowing it to be used as a query via method reference, {@code OffsetDateTime::from}. + + @param temporal the temporal object to convert, not null + @return the offset date-time, not null + @throws DateTimeException if unable to convert to an {@code OffsetDateTime}" + {:arglists (quote (["java.time.temporal.TemporalAccessor"]))} + (^js/JSJoda.OffsetDateTime [^js/JSJoda.TemporalAccessor temporal] + (js-invoke java.time.OffsetDateTime "from" temporal))) + +(defn is-after + "Checks if the instant of this date-time is after that of the specified date-time. + + This method differs from the comparison in {@link #compareTo} and {@link #equals} in that it + only compares the instant of the date-time. This is equivalent to using + {@code dateTime1.toInstant().isAfter(dateTime2.toInstant());}. + + @param other the other date-time to compare to, not null + @return true if this is after the instant of the specified date-time" + {:arglists (quote (["java.time.OffsetDateTime" "java.time.OffsetDateTime"]))} + (^boolean [^js/JSJoda.OffsetDateTime this ^js/JSJoda.OffsetDateTime other] + (.isAfter this other))) + +(defn minus-nanos + "Returns a copy of this {@code OffsetDateTime} with the specified number of nanoseconds subtracted. + + This instance is immutable and unaffected by this method call. + + @param nanos the nanos to subtract, may be negative + @return an {@code OffsetDateTime} based on this date-time with the nanoseconds subtracted, not null + @throws DateTimeException if the result exceeds the supported date range" + {:arglists (quote (["java.time.OffsetDateTime" "long"]))} + (^js/JSJoda.OffsetDateTime [^js/JSJoda.OffsetDateTime this ^long nanos] + (.minusNanos this nanos))) + +(defn is-supported + {:arglists + (quote (["java.time.OffsetDateTime" "java.time.temporal.TemporalField"] + ["java.time.OffsetDateTime" "java.time.temporal.TemporalUnit"]))} + (^boolean [^js/JSJoda.OffsetDateTime this arg0] + (.isSupported ^js/JSJoda.OffsetDateTime this arg0))) + +(defn minus-years + "Returns a copy of this {@code OffsetDateTime} with the specified number of years subtracted. + + This method subtracts the specified amount from the years field in three steps: +
    +
  1. Subtract the input years from the year field
  2. +
  3. Check if the resulting date would be invalid
  4. +
  5. Adjust the day-of-month to the last valid day if necessary
  6. +
+ + For example, 2008-02-29 (leap year) minus one year would result in the + invalid date 2009-02-29 (standard year). Instead of returning an invalid + result, the last valid day of the month, 2009-02-28, is selected instead. + + This instance is immutable and unaffected by this method call. + + @param years the years to subtract, may be negative + @return an {@code OffsetDateTime} based on this date-time with the years subtracted, not null + @throws DateTimeException if the result exceeds the supported date range" + {:arglists (quote (["java.time.OffsetDateTime" "long"]))} + (^js/JSJoda.OffsetDateTime [^js/JSJoda.OffsetDateTime this ^long years] + (.minusYears this years))) + +(defn parse + {:arglists (quote (["java.lang.CharSequence"] + ["java.lang.CharSequence" + "java.time.format.DateTimeFormatter"]))} + (^js/JSJoda.OffsetDateTime [^java.lang.CharSequence text] + (js-invoke java.time.OffsetDateTime "parse" text)) + (^js/JSJoda.OffsetDateTime + [^java.lang.CharSequence text ^js/JSJoda.DateTimeFormatter formatter] + (js-invoke java.time.OffsetDateTime "parse" text formatter))) + +(defn with-second + "Returns a copy of this {@code OffsetDateTime} with the second-of-minute altered. + + The date and offset do not affect the calculation and will be the same in the result. + + This instance is immutable and unaffected by this method call. + + @param second the second-of-minute to set in the result, from 0 to 59 + @return an {@code OffsetDateTime} based on this date-time with the requested second, not null + @throws DateTimeException if the second value is invalid" + {:arglists (quote (["java.time.OffsetDateTime" "int"]))} + (^js/JSJoda.OffsetDateTime [^js/JSJoda.OffsetDateTime this ^int second] + (.withSecond this second))) + +(defn to-local-date + "Gets the {@code LocalDate} part of this date-time. + + This returns a {@code LocalDate} with the same year, month and day + as this date-time. + + @return the date part of this date-time, not null" + {:arglists (quote (["java.time.OffsetDateTime"]))} + (^js/JSJoda.LocalDate [^js/JSJoda.OffsetDateTime this] (.toLocalDate this))) + +(defn get-minute + "Gets the minute-of-hour field. + + @return the minute-of-hour, from 0 to 59" + {:arglists (quote (["java.time.OffsetDateTime"]))} + (^int [^js/JSJoda.OffsetDateTime this] (.minute this))) + +(defn hash-code + "A hash code for this date-time. + + @return a suitable hash code" + {:arglists (quote (["java.time.OffsetDateTime"]))} + (^int [^js/JSJoda.OffsetDateTime this] (.hashCode this))) + +(defn adjust-into + "Adjusts the specified temporal object to have the same offset, date + and time as this object. + + This returns a temporal object of the same observable type as the input + with the offset, date and time changed to be the same as this. + + The adjustment is equivalent to using {@link Temporal#with(TemporalField, long)} + three times, passing {@link ChronoField#EPOCH_DAY}, + {@link ChronoField#NANO_OF_DAY} and {@link ChronoField#OFFSET_SECONDS} as the fields. + + In most cases, it is clearer to reverse the calling pattern by using + {@link Temporal#with(TemporalAdjuster)}: +
+   // these two lines are equivalent, but the second approach is recommended
+   temporal = thisOffsetDateTime.adjustInto(temporal);
+   temporal = temporal.with(thisOffsetDateTime);
+ 
+ + This instance is immutable and unaffected by this method call. + + @param temporal the target object to be adjusted, not null + @return the adjusted object, not null + @throws DateTimeException if unable to make the adjustment + @throws ArithmeticException if numeric overflow occurs" + {:arglists (quote (["java.time.OffsetDateTime" + "java.time.temporal.Temporal"]))} + (^js/JSJoda.Temporal + [^js/JSJoda.OffsetDateTime this ^js/JSJoda.Temporal temporal] + (.adjustInto this temporal))) + +(defn with + {:arglists (quote (["java.time.OffsetDateTime" + "java.time.temporal.TemporalAdjuster"] + ["java.time.OffsetDateTime" + "java.time.temporal.TemporalField" "long"]))} + (^js/JSJoda.OffsetDateTime + [^js/JSJoda.OffsetDateTime this ^js/JSJoda.TemporalAdjuster adjuster] + (.with this adjuster)) + (^js/JSJoda.OffsetDateTime + [^js/JSJoda.OffsetDateTime this ^js/JSJoda.TemporalField field + ^long new-value] + (.with this field new-value))) + +(defn now + {:arglists (quote ([] ["java.time.Clock"] ["java.time.ZoneId"]))} + (^js/JSJoda.OffsetDateTime [] (js-invoke java.time.OffsetDateTime "now")) + (^js/JSJoda.OffsetDateTime [arg0] + (js-invoke java.time.OffsetDateTime "now" arg0))) + +(defn to-local-date-time + "Gets the {@code LocalDateTime} part of this date-time. + + This returns a {@code LocalDateTime} with the same year, month, day and time + as this date-time. + + @return the local date-time part of this date-time, not null" + {:arglists (quote (["java.time.OffsetDateTime"]))} + (^js/JSJoda.LocalDateTime [^js/JSJoda.OffsetDateTime this] + (.toLocalDateTime this))) + +(defn get-month-value + "Gets the month-of-year field from 1 to 12. + + This method returns the month as an {@code int} from 1 to 12. + Application code is frequently clearer if the enum {@link Month} + is used by calling {@link #getMonth()}. + + @return the month-of-year, from 1 to 12 + @see #getMonth()" + {:arglists (quote (["java.time.OffsetDateTime"]))} + (^int [^js/JSJoda.OffsetDateTime this] (.monthValue this))) + +(defn with-day-of-year + "Returns a copy of this {@code OffsetDateTime} with the day-of-year altered. + + The time and offset do not affect the calculation and will be the same in the result. + If the resulting {@code OffsetDateTime} is invalid, an exception is thrown. + + This instance is immutable and unaffected by this method call. + + @param dayOfYear the day-of-year to set in the result, from 1 to 365-366 + @return an {@code OffsetDateTime} based on this date with the requested day, not null + @throws DateTimeException if the day-of-year value is invalid, + or if the day-of-year is invalid for the year" + {:arglists (quote (["java.time.OffsetDateTime" "int"]))} + (^js/JSJoda.OffsetDateTime [^js/JSJoda.OffsetDateTime this ^int day-of-year] + (.withDayOfYear this day-of-year))) + +(defn compare-to + "Compares this date-time to another date-time. + + The comparison is based on the instant then on the local date-time. + It is \"consistent with equals\", as defined by {@link Comparable}. + + For example, the following is the comparator order: +
    +
  1. {@code 2008-12-03T10:30+01:00}
  2. +
  3. {@code 2008-12-03T11:00+01:00}
  4. +
  5. {@code 2008-12-03T12:00+02:00}
  6. +
  7. {@code 2008-12-03T11:30+01:00}
  8. +
  9. {@code 2008-12-03T12:00+01:00}
  10. +
  11. {@code 2008-12-03T12:30+01:00}
  12. +
+ Values #2 and #3 represent the same instant on the time-line. + When two values represent the same instant, the local date-time is compared + to distinguish them. This step is needed to make the ordering + consistent with {@code equals()}. + + @param other the other date-time to compare to, not null + @return the comparator value, negative if less, positive if greater" + {:arglists (quote (["java.time.OffsetDateTime" "java.time.OffsetDateTime"]))} + (^int [^js/JSJoda.OffsetDateTime this ^js/JSJoda.OffsetDateTime other] + (.compareTo this other))) + +(defn get-month + "Gets the month-of-year field using the {@code Month} enum. + + This method returns the enum {@link Month} for the month. + This avoids confusion as to what {@code int} values mean. + If you need access to the primitive {@code int} value then the enum + provides the {@link Month#getValue() int value}. + + @return the month-of-year, not null + @see #getMonthValue()" + {:arglists (quote (["java.time.OffsetDateTime"]))} + (^js/JSJoda.Month [^js/JSJoda.OffsetDateTime this] (.month this))) + +(defn of-instant + "Obtains an instance of {@code OffsetDateTime} from an {@code Instant} and zone ID. + + This creates an offset date-time with the same instant as that specified. + Finding the offset from UTC/Greenwich is simple as there is only one valid + offset for each instant. + + @param instant the instant to create the date-time from, not null + @param zone the time-zone, which may be an offset, not null + @return the offset date-time, not null + @throws DateTimeException if the result exceeds the supported range" + {:arglists (quote (["java.time.Instant" "java.time.ZoneId"]))} + (^js/JSJoda.OffsetDateTime [^js/JSJoda.Instant instant ^js/JSJoda.ZoneId zone] + (js-invoke java.time.OffsetDateTime "ofInstant" instant zone))) + +(defn plus-seconds + "Returns a copy of this {@code OffsetDateTime} with the specified number of seconds added. + + This instance is immutable and unaffected by this method call. + + @param seconds the seconds to add, may be negative + @return an {@code OffsetDateTime} based on this date-time with the seconds added, not null + @throws DateTimeException if the result exceeds the supported date range" + {:arglists (quote (["java.time.OffsetDateTime" "long"]))} + (^js/JSJoda.OffsetDateTime [^js/JSJoda.OffsetDateTime this ^long seconds] + (.plusSeconds this seconds))) + +(defn get + "Gets the value of the specified field from this date-time as an {@code int}. + + This queries this date-time for the value of the specified field. + The returned value will always be within the valid range of values for the field. + If it is not possible to return the value, because the field is not supported + or for some other reason, an exception is thrown. + + If the field is a {@link ChronoField} then the query is implemented here. + The {@link #isSupported(TemporalField) supported fields} will return valid + values based on this date-time, except {@code NANO_OF_DAY}, {@code MICRO_OF_DAY}, + {@code EPOCH_DAY}, {@code PROLEPTIC_MONTH} and {@code INSTANT_SECONDS} which are too + large to fit in an {@code int} and throw a {@code DateTimeException}. + All other {@code ChronoField} instances will throw an {@code UnsupportedTemporalTypeException}. + + If the field is not a {@code ChronoField}, then the result of this method + is obtained by invoking {@code TemporalField.getFrom(TemporalAccessor)} + passing {@code this} as the argument. Whether the value can be obtained, + and what the value represents, is determined by the field. + + @param field the field to get, not null + @return the value for the field + @throws DateTimeException if a value for the field cannot be obtained or + the value is outside the range of valid values for the field + @throws UnsupportedTemporalTypeException if the field is not supported or + the range of values exceeds an {@code int} + @throws ArithmeticException if numeric overflow occurs" + {:arglists (quote (["java.time.OffsetDateTime" + "java.time.temporal.TemporalField"]))} + (^int [^js/JSJoda.OffsetDateTime this ^js/JSJoda.TemporalField field] + (.get this field))) + +(defn equals + "Checks if this date-time is equal to another date-time. + + The comparison is based on the local date-time and the offset. + To compare for the same instant on the time-line, use {@link #isEqual}. + Only objects of type {@code OffsetDateTime} are compared, other types return false. + + @param obj the object to check, null returns false + @return true if this is equal to the other date-time" + {:arglists (quote (["java.time.OffsetDateTime" "java.lang.Object"]))} + (^boolean [^js/JSJoda.OffsetDateTime this ^java.lang.Object obj] + (.equals this obj))) + +(defn format + "Formats this date-time using the specified formatter. + + This date-time will be passed to the formatter to produce a string. + + @param formatter the formatter to use, not null + @return the formatted date-time string, not null + @throws DateTimeException if an error occurs during printing" + {:arglists (quote (["java.time.OffsetDateTime" + "java.time.format.DateTimeFormatter"]))} + (^java.lang.String + [^js/JSJoda.OffsetDateTime this ^js/JSJoda.DateTimeFormatter formatter] + (.format this formatter))) + +(defn plus-years + "Returns a copy of this {@code OffsetDateTime} with the specified number of years added. + + This method adds the specified amount to the years field in three steps: +
    +
  1. Add the input years to the year field
  2. +
  3. Check if the resulting date would be invalid
  4. +
  5. Adjust the day-of-month to the last valid day if necessary
  6. +
+ + For example, 2008-02-29 (leap year) plus one year would result in the + invalid date 2009-02-29 (standard year). Instead of returning an invalid + result, the last valid day of the month, 2009-02-28, is selected instead. + + This instance is immutable and unaffected by this method call. + + @param years the years to add, may be negative + @return an {@code OffsetDateTime} based on this date-time with the years added, not null + @throws DateTimeException if the result exceeds the supported date range" + {:arglists (quote (["java.time.OffsetDateTime" "long"]))} + (^js/JSJoda.OffsetDateTime [^js/JSJoda.OffsetDateTime this ^long years] + (.plusYears this years))) + +(defn minus-days + "Returns a copy of this {@code OffsetDateTime} with the specified number of days subtracted. + + This method subtracts the specified amount from the days field decrementing the + month and year fields as necessary to ensure the result remains valid. + The result is only invalid if the maximum/minimum year is exceeded. + + For example, 2008-12-31 minus one day would result in 2009-01-01. + + This instance is immutable and unaffected by this method call. + + @param days the days to subtract, may be negative + @return an {@code OffsetDateTime} based on this date-time with the days subtracted, not null + @throws DateTimeException if the result exceeds the supported date range" + {:arglists (quote (["java.time.OffsetDateTime" "long"]))} + (^js/JSJoda.OffsetDateTime [^js/JSJoda.OffsetDateTime this ^long days] + (.minusDays this days))) diff --git a/src/cljc/java_time/offset_time.clj b/src/cljc/java_time/offset_time.clj index 4950b20..3fd5040 100644 --- a/src/cljc/java_time/offset_time.clj +++ b/src/cljc/java_time/offset_time.clj @@ -1,48 +1,769 @@ -(ns cljc.java-time.offset-time (:refer-clojure :exclude [abs get range format min max next name resolve short]) (:require [cljc.java-time.extn.calendar-awareness]) (:import [java.time OffsetTime])) -(def min java.time.OffsetTime/MIN) -(def max java.time.OffsetTime/MAX) -(clojure.core/defn minus-minutes {:arglists (quote (["java.time.OffsetTime" "long"]))} (^java.time.OffsetTime [^java.time.OffsetTime this13860 ^long long13861] (.minusMinutes this13860 long13861))) -(clojure.core/defn truncated-to {:arglists (quote (["java.time.OffsetTime" "java.time.temporal.TemporalUnit"]))} (^java.time.OffsetTime [^java.time.OffsetTime this13862 ^java.time.temporal.ChronoUnit java-time-temporal-TemporalUnit13863] (.truncatedTo this13862 java-time-temporal-TemporalUnit13863))) -(clojure.core/defn range {:arglists (quote (["java.time.OffsetTime" "java.time.temporal.TemporalField"]))} (^java.time.temporal.ValueRange [^java.time.OffsetTime this13864 ^java.time.temporal.TemporalField java-time-temporal-TemporalField13865] (.range this13864 java-time-temporal-TemporalField13865))) -(clojure.core/defn get-hour {:arglists (quote (["java.time.OffsetTime"]))} (^java.lang.Integer [^java.time.OffsetTime this13866] (.getHour this13866))) -(clojure.core/defn minus-hours {:arglists (quote (["java.time.OffsetTime" "long"]))} (^java.time.OffsetTime [^java.time.OffsetTime this13867 ^long long13868] (.minusHours this13867 long13868))) -(clojure.core/defn of {:arglists (quote (["java.time.LocalTime" "java.time.ZoneOffset"] ["int" "int" "int" "int" "java.time.ZoneOffset"]))} (^java.time.OffsetTime [^java.time.LocalTime java-time-LocalTime13869 ^java.time.ZoneOffset java-time-ZoneOffset13870] (java.time.OffsetTime/of java-time-LocalTime13869 java-time-ZoneOffset13870)) (^java.time.OffsetTime [^java.lang.Integer int13871 ^java.lang.Integer int13872 ^java.lang.Integer int13873 ^java.lang.Integer int13874 ^java.time.ZoneOffset java-time-ZoneOffset13875] (java.time.OffsetTime/of int13871 int13872 int13873 int13874 java-time-ZoneOffset13875))) -(clojure.core/defn is-equal {:arglists (quote (["java.time.OffsetTime" "java.time.OffsetTime"]))} (^java.lang.Boolean [^java.time.OffsetTime this13876 ^java.time.OffsetTime java-time-OffsetTime13877] (.isEqual this13876 java-time-OffsetTime13877))) -(clojure.core/defn get-nano {:arglists (quote (["java.time.OffsetTime"]))} (^java.lang.Integer [^java.time.OffsetTime this13878] (.getNano this13878))) -(clojure.core/defn minus-seconds {:arglists (quote (["java.time.OffsetTime" "long"]))} (^java.time.OffsetTime [^java.time.OffsetTime this13879 ^long long13880] (.minusSeconds this13879 long13880))) -(clojure.core/defn get-second {:arglists (quote (["java.time.OffsetTime"]))} (^java.lang.Integer [^java.time.OffsetTime this13881] (.getSecond this13881))) -(clojure.core/defn plus-nanos {:arglists (quote (["java.time.OffsetTime" "long"]))} (^java.time.OffsetTime [^java.time.OffsetTime this13882 ^long long13883] (.plusNanos this13882 long13883))) -(clojure.core/defn plus {:arglists (quote (["java.time.OffsetTime" "long" "java.time.temporal.TemporalUnit"] ["java.time.OffsetTime" "java.time.temporal.TemporalAmount"]))} (^java.time.OffsetTime [^java.time.OffsetTime this13884 ^long long13885 ^java.time.temporal.ChronoUnit java-time-temporal-TemporalUnit13886] (.plus this13884 long13885 java-time-temporal-TemporalUnit13886)) (^java.time.OffsetTime [^java.time.OffsetTime this13887 ^java.time.temporal.TemporalAmount java-time-temporal-TemporalAmount13888] (.plus this13887 java-time-temporal-TemporalAmount13888))) -(clojure.core/defn with-hour {:arglists (quote (["java.time.OffsetTime" "int"]))} (^java.time.OffsetTime [^java.time.OffsetTime this13889 ^java.lang.Integer int13890] (.withHour this13889 int13890))) -(clojure.core/defn with-minute {:arglists (quote (["java.time.OffsetTime" "int"]))} (^java.time.OffsetTime [^java.time.OffsetTime this13891 ^java.lang.Integer int13892] (.withMinute this13891 int13892))) -(clojure.core/defn plus-minutes {:arglists (quote (["java.time.OffsetTime" "long"]))} (^java.time.OffsetTime [^java.time.OffsetTime this13893 ^long long13894] (.plusMinutes this13893 long13894))) -(clojure.core/defn query {:arglists (quote (["java.time.OffsetTime" "java.time.temporal.TemporalQuery"]))} (^java.lang.Object [^java.time.OffsetTime this13895 ^java.time.temporal.TemporalQuery java-time-temporal-TemporalQuery13896] (.query this13895 java-time-temporal-TemporalQuery13896))) -(clojure.core/defn at-date {:arglists (quote (["java.time.OffsetTime" "java.time.LocalDate"]))} (^java.time.OffsetDateTime [^java.time.OffsetTime this13897 ^java.time.LocalDate java-time-LocalDate13898] (.atDate this13897 java-time-LocalDate13898))) -(clojure.core/defn with-offset-same-instant {:arglists (quote (["java.time.OffsetTime" "java.time.ZoneOffset"]))} (^java.time.OffsetTime [^java.time.OffsetTime this13899 ^java.time.ZoneOffset java-time-ZoneOffset13900] (.withOffsetSameInstant this13899 java-time-ZoneOffset13900))) -(clojure.core/defn to-string {:arglists (quote (["java.time.OffsetTime"]))} (^java.lang.String [^java.time.OffsetTime this13901] (.toString this13901))) -(clojure.core/defn is-before {:arglists (quote (["java.time.OffsetTime" "java.time.OffsetTime"]))} (^java.lang.Boolean [^java.time.OffsetTime this13902 ^java.time.OffsetTime java-time-OffsetTime13903] (.isBefore this13902 java-time-OffsetTime13903))) -(clojure.core/defn minus {:arglists (quote (["java.time.OffsetTime" "long" "java.time.temporal.TemporalUnit"] ["java.time.OffsetTime" "java.time.temporal.TemporalAmount"]))} (^java.time.OffsetTime [^java.time.OffsetTime this13904 ^long long13905 ^java.time.temporal.ChronoUnit java-time-temporal-TemporalUnit13906] (.minus this13904 long13905 java-time-temporal-TemporalUnit13906)) (^java.time.OffsetTime [^java.time.OffsetTime this13907 ^java.time.temporal.TemporalAmount java-time-temporal-TemporalAmount13908] (.minus this13907 java-time-temporal-TemporalAmount13908))) -(clojure.core/defn plus-hours {:arglists (quote (["java.time.OffsetTime" "long"]))} (^java.time.OffsetTime [^java.time.OffsetTime this13909 ^long long13910] (.plusHours this13909 long13910))) -(clojure.core/defn to-local-time {:arglists (quote (["java.time.OffsetTime"]))} (^java.time.LocalTime [^java.time.OffsetTime this13911] (.toLocalTime this13911))) -(clojure.core/defn get-long {:arglists (quote (["java.time.OffsetTime" "java.time.temporal.TemporalField"]))} (^long [^java.time.OffsetTime this13912 ^java.time.temporal.TemporalField java-time-temporal-TemporalField13913] (.getLong this13912 java-time-temporal-TemporalField13913))) -(clojure.core/defn get-offset {:arglists (quote (["java.time.OffsetTime"]))} (^java.time.ZoneOffset [^java.time.OffsetTime this13914] (.getOffset this13914))) -(clojure.core/defn with-nano {:arglists (quote (["java.time.OffsetTime" "int"]))} (^java.time.OffsetTime [^java.time.OffsetTime this13915 ^java.lang.Integer int13916] (.withNano this13915 int13916))) -(clojure.core/defn until {:arglists (quote (["java.time.OffsetTime" "java.time.temporal.Temporal" "java.time.temporal.TemporalUnit"]))} (^long [^java.time.OffsetTime this13917 ^java.time.temporal.Temporal java-time-temporal-Temporal13918 ^java.time.temporal.ChronoUnit java-time-temporal-TemporalUnit13919] (.until this13917 java-time-temporal-Temporal13918 java-time-temporal-TemporalUnit13919))) -(clojure.core/defn with-offset-same-local {:arglists (quote (["java.time.OffsetTime" "java.time.ZoneOffset"]))} (^java.time.OffsetTime [^java.time.OffsetTime this13920 ^java.time.ZoneOffset java-time-ZoneOffset13921] (.withOffsetSameLocal this13920 java-time-ZoneOffset13921))) -(clojure.core/defn from {:arglists (quote (["java.time.temporal.TemporalAccessor"]))} (^java.time.OffsetTime [^java.time.temporal.TemporalAccessor java-time-temporal-TemporalAccessor13922] (java.time.OffsetTime/from java-time-temporal-TemporalAccessor13922))) -(clojure.core/defn is-after {:arglists (quote (["java.time.OffsetTime" "java.time.OffsetTime"]))} (^java.lang.Boolean [^java.time.OffsetTime this13923 ^java.time.OffsetTime java-time-OffsetTime13924] (.isAfter this13923 java-time-OffsetTime13924))) -(clojure.core/defn minus-nanos {:arglists (quote (["java.time.OffsetTime" "long"]))} (^java.time.OffsetTime [^java.time.OffsetTime this13925 ^long long13926] (.minusNanos this13925 long13926))) -(clojure.core/defn is-supported {:arglists (quote (["java.time.OffsetTime" "java.time.temporal.TemporalUnit"] ["java.time.OffsetTime" "java.time.temporal.TemporalField"]))} (^java.lang.Boolean [this13927 G__13928] (clojure.core/cond (clojure.core/and (clojure.core/instance? java.time.temporal.ChronoUnit G__13928)) (clojure.core/let [G__13928 ^"java.time.temporal.ChronoUnit" G__13928] (.isSupported ^java.time.OffsetTime this13927 G__13928)) (clojure.core/and (clojure.core/instance? java.time.temporal.TemporalField G__13928)) (clojure.core/let [G__13928 ^"java.time.temporal.TemporalField" G__13928] (.isSupported ^java.time.OffsetTime this13927 G__13928)) :else (throw (java.lang.IllegalArgumentException. "no corresponding java.time method with these args"))))) -(clojure.core/defn parse {:arglists (quote (["java.lang.CharSequence"] ["java.lang.CharSequence" "java.time.format.DateTimeFormatter"]))} (^java.time.OffsetTime [^java.lang.CharSequence java-lang-CharSequence13929] (java.time.OffsetTime/parse java-lang-CharSequence13929)) (^java.time.OffsetTime [^java.lang.CharSequence java-lang-CharSequence13930 ^java.time.format.DateTimeFormatter java-time-format-DateTimeFormatter13931] (java.time.OffsetTime/parse java-lang-CharSequence13930 java-time-format-DateTimeFormatter13931))) -(clojure.core/defn with-second {:arglists (quote (["java.time.OffsetTime" "int"]))} (^java.time.OffsetTime [^java.time.OffsetTime this13932 ^java.lang.Integer int13933] (.withSecond this13932 int13933))) -(clojure.core/defn get-minute {:arglists (quote (["java.time.OffsetTime"]))} (^java.lang.Integer [^java.time.OffsetTime this13934] (.getMinute this13934))) -(clojure.core/defn hash-code {:arglists (quote (["java.time.OffsetTime"]))} (^java.lang.Integer [^java.time.OffsetTime this13935] (.hashCode this13935))) -(clojure.core/defn adjust-into {:arglists (quote (["java.time.OffsetTime" "java.time.temporal.Temporal"]))} (^java.time.temporal.Temporal [^java.time.OffsetTime this13936 ^java.time.temporal.Temporal java-time-temporal-Temporal13937] (.adjustInto this13936 java-time-temporal-Temporal13937))) -(clojure.core/defn with {:arglists (quote (["java.time.OffsetTime" "java.time.temporal.TemporalAdjuster"] ["java.time.OffsetTime" "java.time.temporal.TemporalField" "long"]))} (^java.time.OffsetTime [^java.time.OffsetTime this13938 ^java.time.temporal.TemporalAdjuster java-time-temporal-TemporalAdjuster13939] (.with this13938 java-time-temporal-TemporalAdjuster13939)) (^java.time.OffsetTime [^java.time.OffsetTime this13940 ^java.time.temporal.TemporalField java-time-temporal-TemporalField13941 ^long long13942] (.with this13940 java-time-temporal-TemporalField13941 long13942))) -(clojure.core/defn now {:arglists (quote ([] ["java.time.ZoneId"] ["java.time.Clock"]))} (^java.time.OffsetTime [] (java.time.OffsetTime/now)) (^java.time.OffsetTime [G__13944] (clojure.core/cond (clojure.core/and (clojure.core/instance? java.time.ZoneId G__13944)) (clojure.core/let [G__13944 ^"java.time.ZoneId" G__13944] (java.time.OffsetTime/now G__13944)) (clojure.core/and (clojure.core/instance? java.time.Clock G__13944)) (clojure.core/let [G__13944 ^"java.time.Clock" G__13944] (java.time.OffsetTime/now G__13944)) :else (throw (java.lang.IllegalArgumentException. "no corresponding java.time method with these args"))))) -(clojure.core/defn compare-to {:arglists (quote (["java.time.OffsetTime" "java.time.OffsetTime"]))} (^java.lang.Integer [^java.time.OffsetTime this13945 ^java.time.OffsetTime java-time-OffsetTime13946] (.compareTo this13945 java-time-OffsetTime13946))) -(clojure.core/defn of-instant {:arglists (quote (["java.time.Instant" "java.time.ZoneId"]))} (^java.time.OffsetTime [^java.time.Instant java-time-Instant13947 ^java.time.ZoneId java-time-ZoneId13948] (java.time.OffsetTime/ofInstant java-time-Instant13947 java-time-ZoneId13948))) -(clojure.core/defn plus-seconds {:arglists (quote (["java.time.OffsetTime" "long"]))} (^java.time.OffsetTime [^java.time.OffsetTime this13949 ^long long13950] (.plusSeconds this13949 long13950))) -(clojure.core/defn get {:arglists (quote (["java.time.OffsetTime" "java.time.temporal.TemporalField"]))} (^java.lang.Integer [^java.time.OffsetTime this13951 ^java.time.temporal.TemporalField java-time-temporal-TemporalField13952] (.get this13951 java-time-temporal-TemporalField13952))) -(clojure.core/defn equals {:arglists (quote (["java.time.OffsetTime" "java.lang.Object"]))} (^java.lang.Boolean [^java.time.OffsetTime this13953 ^java.lang.Object java-lang-Object13954] (.equals this13953 java-lang-Object13954))) -(clojure.core/defn format {:arglists (quote (["java.time.OffsetTime" "java.time.format.DateTimeFormatter"]))} (^java.lang.String [^java.time.OffsetTime this13955 ^java.time.format.DateTimeFormatter java-time-format-DateTimeFormatter13956] (.format this13955 java-time-format-DateTimeFormatter13956))) +(ns cljc.java-time.offset-time + (:refer-clojure :exclude + [abs get range format min max next name resolve short]) + (:require [cljc.java-time.extn.calendar-awareness]) + (:import [java.time OffsetTime])) + +(def min + "The minimum supported {@code OffsetTime}, '00:00:00+18:00'. + This is the time of midnight at the start of the day in the maximum offset + (larger offsets are earlier on the time-line). + This combines {@link LocalTime#MIN} and {@link ZoneOffset#MAX}. + This could be used by an application as a \"far past\" date." + java.time.OffsetTime/MIN) + +(def max + "The maximum supported {@code OffsetTime}, '23:59:59.999999999-18:00'. + This is the time just before midnight at the end of the day in the minimum offset + (larger negative offsets are later on the time-line). + This combines {@link LocalTime#MAX} and {@link ZoneOffset#MIN}. + This could be used by an application as a \"far future\" date." + java.time.OffsetTime/MAX) + +(defn minus-minutes + "Returns a copy of this {@code OffsetTime} with the specified number of minutes subtracted. + + This subtracts the specified number of minutes from this time, returning a new time. + The calculation wraps around midnight. + + This instance is immutable and unaffected by this method call. + + @param minutes the minutes to subtract, may be negative + @return an {@code OffsetTime} based on this time with the minutes subtracted, not null" + {:arglists (quote (["java.time.OffsetTime" "long"]))} + (^java.time.OffsetTime [^java.time.OffsetTime this ^long minutes] + (.minusMinutes this minutes))) + +(defn truncated-to + "Returns a copy of this {@code OffsetTime} with the time truncated. + + Truncation returns a copy of the original time with fields + smaller than the specified unit set to zero. + For example, truncating with the {@link ChronoUnit#MINUTES minutes} unit + will set the second-of-minute and nano-of-second field to zero. + + The unit must have a {@linkplain TemporalUnit#getDuration() duration} + that divides into the length of a standard day without remainder. + This includes all supplied time units on {@link ChronoUnit} and + {@link ChronoUnit#DAYS DAYS}. Other units throw an exception. + + The offset does not affect the calculation and will be the same in the result. + + This instance is immutable and unaffected by this method call. + + @param unit the unit to truncate to, not null + @return an {@code OffsetTime} based on this time with the time truncated, not null + @throws DateTimeException if unable to truncate + @throws UnsupportedTemporalTypeException if the unit is not supported" + {:arglists (quote (["java.time.OffsetTime" + "java.time.temporal.TemporalUnit"]))} + (^java.time.OffsetTime + [^java.time.OffsetTime this ^java.time.temporal.ChronoUnit unit] + (.truncatedTo this unit))) + +(defn range + "Gets the range of valid values for the specified field. + + The range object expresses the minimum and maximum valid values for a field. + This time is used to enhance the accuracy of the returned range. + If it is not possible to return the range, because the field is not supported + or for some other reason, an exception is thrown. + + If the field is a {@link ChronoField} then the query is implemented here. + The {@link #isSupported(TemporalField) supported fields} will return + appropriate range instances. + All other {@code ChronoField} instances will throw an {@code UnsupportedTemporalTypeException}. + + If the field is not a {@code ChronoField}, then the result of this method + is obtained by invoking {@code TemporalField.rangeRefinedBy(TemporalAccessor)} + passing {@code this} as the argument. + Whether the range can be obtained is determined by the field. + + @param field the field to query the range for, not null + @return the range of valid values for the field, not null + @throws DateTimeException if the range for the field cannot be obtained + @throws UnsupportedTemporalTypeException if the field is not supported" + {:arglists (quote (["java.time.OffsetTime" + "java.time.temporal.TemporalField"]))} + (^java.time.temporal.ValueRange + [^java.time.OffsetTime this ^java.time.temporal.TemporalField field] + (.range this field))) + +(defn get-hour + "Gets the hour-of-day field. + + @return the hour-of-day, from 0 to 23" + {:arglists (quote (["java.time.OffsetTime"]))} + (^java.lang.Integer [^java.time.OffsetTime this] (.getHour this))) + +(defn minus-hours + "Returns a copy of this {@code OffsetTime} with the specified number of hours subtracted. + + This subtracts the specified number of hours from this time, returning a new time. + The calculation wraps around midnight. + + This instance is immutable and unaffected by this method call. + + @param hours the hours to subtract, may be negative + @return an {@code OffsetTime} based on this time with the hours subtracted, not null" + {:arglists (quote (["java.time.OffsetTime" "long"]))} + (^java.time.OffsetTime [^java.time.OffsetTime this ^long hours] + (.minusHours this hours))) + +(defn of + {:arglists (quote (["java.time.LocalTime" "java.time.ZoneOffset"] + ["int" "int" "int" "int" "java.time.ZoneOffset"]))} + (^java.time.OffsetTime + [^java.time.LocalTime time ^java.time.ZoneOffset offset] + (java.time.OffsetTime/of time offset)) + (^java.time.OffsetTime + [^java.lang.Integer hour ^java.lang.Integer minute ^java.lang.Integer second + ^java.lang.Integer nano-of-second ^java.time.ZoneOffset offset] + (java.time.OffsetTime/of hour minute second nano-of-second offset))) + +(defn is-equal + "Checks if the instant of this {@code OffsetTime} is equal to that of the + specified time applying both times to a common date. + + This method differs from the comparison in {@link #compareTo} and {@link #equals} + in that it only compares the instant of the time. This is equivalent to converting both + times to an instant using the same date and comparing the instants. + + @param other the other time to compare to, not null + @return true if this is equal to the instant of the specified time" + {:arglists (quote (["java.time.OffsetTime" "java.time.OffsetTime"]))} + (^java.lang.Boolean [^java.time.OffsetTime this ^java.time.OffsetTime other] + (.isEqual this other))) + +(defn get-nano + "Gets the nano-of-second field. + + @return the nano-of-second, from 0 to 999,999,999" + {:arglists (quote (["java.time.OffsetTime"]))} + (^java.lang.Integer [^java.time.OffsetTime this] (.getNano this))) + +(defn minus-seconds + "Returns a copy of this {@code OffsetTime} with the specified number of seconds subtracted. + + This subtracts the specified number of seconds from this time, returning a new time. + The calculation wraps around midnight. + + This instance is immutable and unaffected by this method call. + + @param seconds the seconds to subtract, may be negative + @return an {@code OffsetTime} based on this time with the seconds subtracted, not null" + {:arglists (quote (["java.time.OffsetTime" "long"]))} + (^java.time.OffsetTime [^java.time.OffsetTime this ^long seconds] + (.minusSeconds this seconds))) + +(defn get-second + "Gets the second-of-minute field. + + @return the second-of-minute, from 0 to 59" + {:arglists (quote (["java.time.OffsetTime"]))} + (^java.lang.Integer [^java.time.OffsetTime this] (.getSecond this))) + +(defn plus-nanos + "Returns a copy of this {@code OffsetTime} with the specified number of nanoseconds added. + + This adds the specified number of nanoseconds to this time, returning a new time. + The calculation wraps around midnight. + + This instance is immutable and unaffected by this method call. + + @param nanos the nanos to add, may be negative + @return an {@code OffsetTime} based on this time with the nanoseconds added, not null" + {:arglists (quote (["java.time.OffsetTime" "long"]))} + (^java.time.OffsetTime [^java.time.OffsetTime this ^long nanos] + (.plusNanos this nanos))) + +(defn plus + {:arglists (quote (["java.time.OffsetTime" + "java.time.temporal.TemporalAmount"] + ["java.time.OffsetTime" "long" + "java.time.temporal.TemporalUnit"]))} + (^java.time.OffsetTime + [^java.time.OffsetTime this ^java.time.temporal.TemporalAmount amount-to-add] + (.plus this amount-to-add)) + (^java.time.OffsetTime + [^java.time.OffsetTime this ^long amount-to-add + ^java.time.temporal.ChronoUnit unit] + (.plus this amount-to-add unit))) + +(defn with-hour + "Returns a copy of this {@code OffsetTime} with the hour-of-day altered. + + The offset does not affect the calculation and will be the same in the result. + + This instance is immutable and unaffected by this method call. + + @param hour the hour-of-day to set in the result, from 0 to 23 + @return an {@code OffsetTime} based on this time with the requested hour, not null + @throws DateTimeException if the hour value is invalid" + {:arglists (quote (["java.time.OffsetTime" "int"]))} + (^java.time.OffsetTime [^java.time.OffsetTime this ^java.lang.Integer hour] + (.withHour this hour))) + +(defn with-minute + "Returns a copy of this {@code OffsetTime} with the minute-of-hour altered. + + The offset does not affect the calculation and will be the same in the result. + + This instance is immutable and unaffected by this method call. + + @param minute the minute-of-hour to set in the result, from 0 to 59 + @return an {@code OffsetTime} based on this time with the requested minute, not null + @throws DateTimeException if the minute value is invalid" + {:arglists (quote (["java.time.OffsetTime" "int"]))} + (^java.time.OffsetTime [^java.time.OffsetTime this ^java.lang.Integer minute] + (.withMinute this minute))) + +(defn plus-minutes + "Returns a copy of this {@code OffsetTime} with the specified number of minutes added. + + This adds the specified number of minutes to this time, returning a new time. + The calculation wraps around midnight. + + This instance is immutable and unaffected by this method call. + + @param minutes the minutes to add, may be negative + @return an {@code OffsetTime} based on this time with the minutes added, not null" + {:arglists (quote (["java.time.OffsetTime" "long"]))} + (^java.time.OffsetTime [^java.time.OffsetTime this ^long minutes] + (.plusMinutes this minutes))) + +(defn query + "Queries this time using the specified query. + + This queries this time using the specified query strategy object. + The {@code TemporalQuery} object defines the logic to be used to + obtain the result. Read the documentation of the query to understand + what the result of this method will be. + + The result of this method is obtained by invoking the + {@link TemporalQuery#queryFrom(TemporalAccessor)} method on the + specified query passing {@code this} as the argument. + + @param the type of the result + @param query the query to invoke, not null + @return the query result, null may be returned (defined by the query) + @throws DateTimeException if unable to query (defined by the query) + @throws ArithmeticException if numeric overflow occurs (defined by the query)" + {:arglists (quote (["java.time.OffsetTime" + "java.time.temporal.TemporalQuery"]))} + (^java.lang.Object + [^java.time.OffsetTime this ^java.time.temporal.TemporalQuery query] + (.query this query))) + +(defn at-date + "Combines this time with a date to create an {@code OffsetDateTime}. + + This returns an {@code OffsetDateTime} formed from this time and the specified date. + All possible combinations of date and time are valid. + + @param date the date to combine with, not null + @return the offset date-time formed from this time and the specified date, not null" + {:arglists (quote (["java.time.OffsetTime" "java.time.LocalDate"]))} + (^java.time.OffsetDateTime + [^java.time.OffsetTime this ^java.time.LocalDate date] + (.atDate this date))) + +(defn with-offset-same-instant + "Returns a copy of this {@code OffsetTime} with the specified offset ensuring + that the result is at the same instant on an implied day. + + This method returns an object with the specified {@code ZoneOffset} and a {@code LocalTime} + adjusted by the difference between the two offsets. + This will result in the old and new objects representing the same instant on an implied day. + This is useful for finding the local time in a different offset. + For example, if this time represents {@code 10:30+02:00} and the offset specified is + {@code +03:00}, then this method will return {@code 11:30+03:00}. + + To change the offset without adjusting the local time use {@link #withOffsetSameLocal}. + + This instance is immutable and unaffected by this method call. + + @param offset the zone offset to change to, not null + @return an {@code OffsetTime} based on this time with the requested offset, not null" + {:arglists (quote (["java.time.OffsetTime" "java.time.ZoneOffset"]))} + (^java.time.OffsetTime + [^java.time.OffsetTime this ^java.time.ZoneOffset offset] + (.withOffsetSameInstant this offset))) + +(defn to-string + "Outputs this time as a {@code String}, such as {@code 10:15:30+01:00}. + + The output will be one of the following ISO-8601 formats: +
    +
  • {@code HH:mmXXXXX}
  • +
  • {@code HH:mm:ssXXXXX}
  • +
  • {@code HH:mm:ss.SSSXXXXX}
  • +
  • {@code HH:mm:ss.SSSSSSXXXXX}
  • +
  • {@code HH:mm:ss.SSSSSSSSSXXXXX}
  • +
+ The format used will be the shortest that outputs the full value of + the time where the omitted parts are implied to be zero. + + @return a string representation of this time, not null" + {:arglists (quote (["java.time.OffsetTime"]))} + (^java.lang.String [^java.time.OffsetTime this] (.toString this))) + +(defn is-before + "Checks if the instant of this {@code OffsetTime} is before that of the + specified time applying both times to a common date. + + This method differs from the comparison in {@link #compareTo} in that it + only compares the instant of the time. This is equivalent to converting both + times to an instant using the same date and comparing the instants. + + @param other the other time to compare to, not null + @return true if this is before the instant of the specified time" + {:arglists (quote (["java.time.OffsetTime" "java.time.OffsetTime"]))} + (^java.lang.Boolean [^java.time.OffsetTime this ^java.time.OffsetTime other] + (.isBefore this other))) + +(defn minus + {:arglists (quote (["java.time.OffsetTime" + "java.time.temporal.TemporalAmount"] + ["java.time.OffsetTime" "long" + "java.time.temporal.TemporalUnit"]))} + (^java.time.OffsetTime + [^java.time.OffsetTime this + ^java.time.temporal.TemporalAmount amount-to-subtract] + (.minus this amount-to-subtract)) + (^java.time.OffsetTime + [^java.time.OffsetTime this ^long amount-to-subtract + ^java.time.temporal.ChronoUnit unit] + (.minus this amount-to-subtract unit))) + +(defn plus-hours + "Returns a copy of this {@code OffsetTime} with the specified number of hours added. + + This adds the specified number of hours to this time, returning a new time. + The calculation wraps around midnight. + + This instance is immutable and unaffected by this method call. + + @param hours the hours to add, may be negative + @return an {@code OffsetTime} based on this time with the hours added, not null" + {:arglists (quote (["java.time.OffsetTime" "long"]))} + (^java.time.OffsetTime [^java.time.OffsetTime this ^long hours] + (.plusHours this hours))) + +(defn to-local-time + "Gets the {@code LocalTime} part of this date-time. + + This returns a {@code LocalTime} with the same hour, minute, second and + nanosecond as this date-time. + + @return the time part of this date-time, not null" + {:arglists (quote (["java.time.OffsetTime"]))} + (^java.time.LocalTime [^java.time.OffsetTime this] (.toLocalTime this))) + +(defn get-long + "Gets the value of the specified field from this time as a {@code long}. + + This queries this time for the value of the specified field. + If it is not possible to return the value, because the field is not supported + or for some other reason, an exception is thrown. + + If the field is a {@link ChronoField} then the query is implemented here. + The {@link #isSupported(TemporalField) supported fields} will return valid + values based on this time. + All other {@code ChronoField} instances will throw an {@code UnsupportedTemporalTypeException}. + + If the field is not a {@code ChronoField}, then the result of this method + is obtained by invoking {@code TemporalField.getFrom(TemporalAccessor)} + passing {@code this} as the argument. Whether the value can be obtained, + and what the value represents, is determined by the field. + + @param field the field to get, not null + @return the value for the field + @throws DateTimeException if a value for the field cannot be obtained + @throws UnsupportedTemporalTypeException if the field is not supported + @throws ArithmeticException if numeric overflow occurs" + {:arglists (quote (["java.time.OffsetTime" + "java.time.temporal.TemporalField"]))} + (^long [^java.time.OffsetTime this ^java.time.temporal.TemporalField field] + (.getLong this field))) + +(defn get-offset + "Gets the zone offset, such as '+01:00'. + + This is the offset of the local time from UTC/Greenwich. + + @return the zone offset, not null" + {:arglists (quote (["java.time.OffsetTime"]))} + (^java.time.ZoneOffset [^java.time.OffsetTime this] (.getOffset this))) + +(defn with-nano + "Returns a copy of this {@code OffsetTime} with the nano-of-second altered. + + The offset does not affect the calculation and will be the same in the result. + + This instance is immutable and unaffected by this method call. + + @param nanoOfSecond the nano-of-second to set in the result, from 0 to 999,999,999 + @return an {@code OffsetTime} based on this time with the requested nanosecond, not null + @throws DateTimeException if the nanos value is invalid" + {:arglists (quote (["java.time.OffsetTime" "int"]))} + (^java.time.OffsetTime + [^java.time.OffsetTime this ^java.lang.Integer nano-of-second] + (.withNano this nano-of-second))) + +(defn until + "Calculates the amount of time until another time in terms of the specified unit. + + This calculates the amount of time between two {@code OffsetTime} + objects in terms of a single {@code TemporalUnit}. + The start and end points are {@code this} and the specified time. + The result will be negative if the end is before the start. + For example, the amount in hours between two times can be calculated + using {@code startTime.until(endTime, HOURS)}. + + The {@code Temporal} passed to this method is converted to a + {@code OffsetTime} using {@link #from(TemporalAccessor)}. + If the offset differs between the two times, then the specified + end time is normalized to have the same offset as this time. + + The calculation returns a whole number, representing the number of + complete units between the two times. + For example, the amount in hours between 11:30Z and 13:29Z will only + be one hour as it is one minute short of two hours. + + There are two equivalent ways of using this method. + The first is to invoke this method. + The second is to use {@link TemporalUnit#between(Temporal, Temporal)}: +
+   // these two lines are equivalent
+   amount = start.until(end, MINUTES);
+   amount = MINUTES.between(start, end);
+ 
+ The choice should be made based on which makes the code more readable. + + The calculation is implemented in this method for {@link ChronoUnit}. + The units {@code NANOS}, {@code MICROS}, {@code MILLIS}, {@code SECONDS}, + {@code MINUTES}, {@code HOURS} and {@code HALF_DAYS} are supported. + Other {@code ChronoUnit} values will throw an exception. + + If the unit is not a {@code ChronoUnit}, then the result of this method + is obtained by invoking {@code TemporalUnit.between(Temporal, Temporal)} + passing {@code this} as the first argument and the converted input temporal + as the second argument. + + This instance is immutable and unaffected by this method call. + + @param endExclusive the end time, exclusive, which is converted to an {@code OffsetTime}, not null + @param unit the unit to measure the amount in, not null + @return the amount of time between this time and the end time + @throws DateTimeException if the amount cannot be calculated, or the end + temporal cannot be converted to an {@code OffsetTime} + @throws UnsupportedTemporalTypeException if the unit is not supported + @throws ArithmeticException if numeric overflow occurs" + {:arglists (quote (["java.time.OffsetTime" "java.time.temporal.Temporal" + "java.time.temporal.TemporalUnit"]))} + (^long + [^java.time.OffsetTime this ^java.time.temporal.Temporal end-exclusive + ^java.time.temporal.ChronoUnit unit] + (.until this end-exclusive unit))) + +(defn with-offset-same-local + "Returns a copy of this {@code OffsetTime} with the specified offset ensuring + that the result has the same local time. + + This method returns an object with the same {@code LocalTime} and the specified {@code ZoneOffset}. + No calculation is needed or performed. + For example, if this time represents {@code 10:30+02:00} and the offset specified is + {@code +03:00}, then this method will return {@code 10:30+03:00}. + + To take into account the difference between the offsets, and adjust the time fields, + use {@link #withOffsetSameInstant}. + + This instance is immutable and unaffected by this method call. + + @param offset the zone offset to change to, not null + @return an {@code OffsetTime} based on this time with the requested offset, not null" + {:arglists (quote (["java.time.OffsetTime" "java.time.ZoneOffset"]))} + (^java.time.OffsetTime + [^java.time.OffsetTime this ^java.time.ZoneOffset offset] + (.withOffsetSameLocal this offset))) + +(defn from + "Obtains an instance of {@code OffsetTime} from a temporal object. + + This obtains an offset time based on the specified temporal. + A {@code TemporalAccessor} represents an arbitrary set of date and time information, + which this factory converts to an instance of {@code OffsetTime}. + + The conversion extracts and combines the {@code ZoneOffset} and the + {@code LocalTime} from the temporal object. + Implementations are permitted to perform optimizations such as accessing + those fields that are equivalent to the relevant objects. + + This method matches the signature of the functional interface {@link TemporalQuery} + allowing it to be used as a query via method reference, {@code OffsetTime::from}. + + @param temporal the temporal object to convert, not null + @return the offset time, not null + @throws DateTimeException if unable to convert to an {@code OffsetTime}" + {:arglists (quote (["java.time.temporal.TemporalAccessor"]))} + (^java.time.OffsetTime [^java.time.temporal.TemporalAccessor temporal] + (java.time.OffsetTime/from temporal))) + +(defn is-after + "Checks if the instant of this {@code OffsetTime} is after that of the + specified time applying both times to a common date. + + This method differs from the comparison in {@link #compareTo} in that it + only compares the instant of the time. This is equivalent to converting both + times to an instant using the same date and comparing the instants. + + @param other the other time to compare to, not null + @return true if this is after the instant of the specified time" + {:arglists (quote (["java.time.OffsetTime" "java.time.OffsetTime"]))} + (^java.lang.Boolean [^java.time.OffsetTime this ^java.time.OffsetTime other] + (.isAfter this other))) + +(defn minus-nanos + "Returns a copy of this {@code OffsetTime} with the specified number of nanoseconds subtracted. + + This subtracts the specified number of nanoseconds from this time, returning a new time. + The calculation wraps around midnight. + + This instance is immutable and unaffected by this method call. + + @param nanos the nanos to subtract, may be negative + @return an {@code OffsetTime} based on this time with the nanoseconds subtracted, not null" + {:arglists (quote (["java.time.OffsetTime" "long"]))} + (^java.time.OffsetTime [^java.time.OffsetTime this ^long nanos] + (.minusNanos this nanos))) + +(defn is-supported + {:arglists (quote (["java.time.OffsetTime" "java.time.temporal.TemporalField"] + ["java.time.OffsetTime" + "java.time.temporal.TemporalUnit"]))} + (^java.lang.Boolean [^java.time.OffsetTime this arg0] + (cond (instance? java.time.temporal.TemporalField arg0) + (let [^java.time.temporal.TemporalField field arg0] + (.isSupported this field)) + (instance? java.time.temporal.ChronoUnit arg0) + (let [^java.time.temporal.TemporalUnit unit arg0] + (.isSupported this unit)) + :else (throw (java.lang.IllegalArgumentException. + "no corresponding java.time method with these args"))))) + +(defn parse + {:arglists (quote (["java.lang.CharSequence"] + ["java.lang.CharSequence" + "java.time.format.DateTimeFormatter"]))} + (^java.time.OffsetTime [^java.lang.CharSequence text] + (java.time.OffsetTime/parse text)) + (^java.time.OffsetTime + [^java.lang.CharSequence text ^java.time.format.DateTimeFormatter formatter] + (java.time.OffsetTime/parse text formatter))) + +(defn with-second + "Returns a copy of this {@code OffsetTime} with the second-of-minute altered. + + The offset does not affect the calculation and will be the same in the result. + + This instance is immutable and unaffected by this method call. + + @param second the second-of-minute to set in the result, from 0 to 59 + @return an {@code OffsetTime} based on this time with the requested second, not null + @throws DateTimeException if the second value is invalid" + {:arglists (quote (["java.time.OffsetTime" "int"]))} + (^java.time.OffsetTime [^java.time.OffsetTime this ^java.lang.Integer second] + (.withSecond this second))) + +(defn get-minute + "Gets the minute-of-hour field. + + @return the minute-of-hour, from 0 to 59" + {:arglists (quote (["java.time.OffsetTime"]))} + (^java.lang.Integer [^java.time.OffsetTime this] (.getMinute this))) + +(defn hash-code + "A hash code for this time. + + @return a suitable hash code" + {:arglists (quote (["java.time.OffsetTime"]))} + (^java.lang.Integer [^java.time.OffsetTime this] (.hashCode this))) + +(defn adjust-into + "Adjusts the specified temporal object to have the same offset and time + as this object. + + This returns a temporal object of the same observable type as the input + with the offset and time changed to be the same as this. + + The adjustment is equivalent to using {@link Temporal#with(TemporalField, long)} + twice, passing {@link ChronoField#NANO_OF_DAY} and + {@link ChronoField#OFFSET_SECONDS} as the fields. + + In most cases, it is clearer to reverse the calling pattern by using + {@link Temporal#with(TemporalAdjuster)}: +
+   // these two lines are equivalent, but the second approach is recommended
+   temporal = thisOffsetTime.adjustInto(temporal);
+   temporal = temporal.with(thisOffsetTime);
+ 
+ + This instance is immutable and unaffected by this method call. + + @param temporal the target object to be adjusted, not null + @return the adjusted object, not null + @throws DateTimeException if unable to make the adjustment + @throws ArithmeticException if numeric overflow occurs" + {:arglists (quote (["java.time.OffsetTime" "java.time.temporal.Temporal"]))} + (^java.time.temporal.Temporal + [^java.time.OffsetTime this ^java.time.temporal.Temporal temporal] + (.adjustInto this temporal))) + +(defn with + {:arglists (quote (["java.time.OffsetTime" + "java.time.temporal.TemporalAdjuster"] + ["java.time.OffsetTime" "java.time.temporal.TemporalField" + "long"]))} + (^java.time.OffsetTime + [^java.time.OffsetTime this ^java.time.temporal.TemporalAdjuster adjuster] + (.with this adjuster)) + (^java.time.OffsetTime + [^java.time.OffsetTime this ^java.time.temporal.TemporalField field + ^long new-value] + (.with this field new-value))) + +(defn now + {:arglists (quote ([] ["java.time.Clock"] ["java.time.ZoneId"]))} + (^java.time.OffsetTime [] (java.time.OffsetTime/now)) + (^java.time.OffsetTime [arg0] + (cond (instance? java.time.Clock arg0) (let [^java.time.Clock clock arg0] + (java.time.OffsetTime/now clock)) + (instance? java.time.ZoneId arg0) (let [^java.time.ZoneId zone arg0] + (java.time.OffsetTime/now zone)) + :else (throw (java.lang.IllegalArgumentException. + "no corresponding java.time method with these args"))))) + +(defn compare-to + "Compares this {@code OffsetTime} to another time. + + The comparison is based first on the UTC equivalent instant, then on the local time. + It is \"consistent with equals\", as defined by {@link Comparable}. + + For example, the following is the comparator order: +
    +
  1. {@code 10:30+01:00}
  2. +
  3. {@code 11:00+01:00}
  4. +
  5. {@code 12:00+02:00}
  6. +
  7. {@code 11:30+01:00}
  8. +
  9. {@code 12:00+01:00}
  10. +
  11. {@code 12:30+01:00}
  12. +
+ Values #2 and #3 represent the same instant on the time-line. + When two values represent the same instant, the local time is compared + to distinguish them. This step is needed to make the ordering + consistent with {@code equals()}. + + To compare the underlying local time of two {@code TemporalAccessor} instances, + use {@link ChronoField#NANO_OF_DAY} as a comparator. + + @param other the other time to compare to, not null + @return the comparator value, negative if less, positive if greater + @throws NullPointerException if {@code other} is null" + {:arglists (quote (["java.time.OffsetTime" "java.time.OffsetTime"]))} + (^java.lang.Integer [^java.time.OffsetTime this ^java.time.OffsetTime other] + (.compareTo this other))) + +(defn of-instant + "Obtains an instance of {@code OffsetTime} from an {@code Instant} and zone ID. + + This creates an offset time with the same instant as that specified. + Finding the offset from UTC/Greenwich is simple as there is only one valid + offset for each instant. + + The date component of the instant is dropped during the conversion. + This means that the conversion can never fail due to the instant being + out of the valid range of dates. + + @param instant the instant to create the time from, not null + @param zone the time-zone, which may be an offset, not null + @return the offset time, not null" + {:arglists (quote (["java.time.Instant" "java.time.ZoneId"]))} + (^java.time.OffsetTime [^java.time.Instant instant ^java.time.ZoneId zone] + (java.time.OffsetTime/ofInstant instant zone))) + +(defn plus-seconds + "Returns a copy of this {@code OffsetTime} with the specified number of seconds added. + + This adds the specified number of seconds to this time, returning a new time. + The calculation wraps around midnight. + + This instance is immutable and unaffected by this method call. + + @param seconds the seconds to add, may be negative + @return an {@code OffsetTime} based on this time with the seconds added, not null" + {:arglists (quote (["java.time.OffsetTime" "long"]))} + (^java.time.OffsetTime [^java.time.OffsetTime this ^long seconds] + (.plusSeconds this seconds))) + +(defn get + "Gets the value of the specified field from this time as an {@code int}. + + This queries this time for the value of the specified field. + The returned value will always be within the valid range of values for the field. + If it is not possible to return the value, because the field is not supported + or for some other reason, an exception is thrown. + + If the field is a {@link ChronoField} then the query is implemented here. + The {@link #isSupported(TemporalField) supported fields} will return valid + values based on this time, except {@code NANO_OF_DAY} and {@code MICRO_OF_DAY} + which are too large to fit in an {@code int} and throw a {@code DateTimeException}. + All other {@code ChronoField} instances will throw an {@code UnsupportedTemporalTypeException}. + + If the field is not a {@code ChronoField}, then the result of this method + is obtained by invoking {@code TemporalField.getFrom(TemporalAccessor)} + passing {@code this} as the argument. Whether the value can be obtained, + and what the value represents, is determined by the field. + + @param field the field to get, not null + @return the value for the field + @throws DateTimeException if a value for the field cannot be obtained or + the value is outside the range of valid values for the field + @throws UnsupportedTemporalTypeException if the field is not supported or + the range of values exceeds an {@code int} + @throws ArithmeticException if numeric overflow occurs" + {:arglists (quote (["java.time.OffsetTime" + "java.time.temporal.TemporalField"]))} + (^java.lang.Integer + [^java.time.OffsetTime this ^java.time.temporal.TemporalField field] + (.get this field))) + +(defn equals + "Checks if this time is equal to another time. + + The comparison is based on the local-time and the offset. + To compare for the same instant on the time-line, use {@link #isEqual(OffsetTime)}. + + Only objects of type {@code OffsetTime} are compared, other types return false. + To compare the underlying local time of two {@code TemporalAccessor} instances, + use {@link ChronoField#NANO_OF_DAY} as a comparator. + + @param obj the object to check, null returns false + @return true if this is equal to the other time" + {:arglists (quote (["java.time.OffsetTime" "java.lang.Object"]))} + (^java.lang.Boolean [^java.time.OffsetTime this ^java.lang.Object obj] + (.equals this obj))) + +(defn format + "Formats this time using the specified formatter. + + This time will be passed to the formatter to produce a string. + + @param formatter the formatter to use, not null + @return the formatted time string, not null + @throws DateTimeException if an error occurs during printing" + {:arglists (quote (["java.time.OffsetTime" + "java.time.format.DateTimeFormatter"]))} + (^java.lang.String + [^java.time.OffsetTime this ^java.time.format.DateTimeFormatter formatter] + (.format this formatter))) diff --git a/src/cljc/java_time/offset_time.cljs b/src/cljc/java_time/offset_time.cljs index 3e56aa5..81505ff 100644 --- a/src/cljc/java_time/offset_time.cljs +++ b/src/cljc/java_time/offset_time.cljs @@ -1,48 +1,756 @@ -(ns cljc.java-time.offset-time (:refer-clojure :exclude [abs get range format min max next name resolve short]) (:require [cljc.java-time.extn.calendar-awareness] [goog.object] [java.time :refer [OffsetTime]])) -(def min (goog.object/get java.time.OffsetTime "MIN")) -(def max (goog.object/get java.time.OffsetTime "MAX")) -(clojure.core/defn minus-minutes {:arglists (quote (["java.time.OffsetTime" "long"]))} (^js/JSJoda.OffsetTime [^js/JSJoda.OffsetTime this13957 ^long long13958] (.minusMinutes this13957 long13958))) -(clojure.core/defn truncated-to {:arglists (quote (["java.time.OffsetTime" "java.time.temporal.TemporalUnit"]))} (^js/JSJoda.OffsetTime [^js/JSJoda.OffsetTime this13959 ^js/JSJoda.TemporalUnit java-time-temporal-TemporalUnit13960] (.truncatedTo this13959 java-time-temporal-TemporalUnit13960))) -(clojure.core/defn range {:arglists (quote (["java.time.OffsetTime" "java.time.temporal.TemporalField"]))} (^js/JSJoda.ValueRange [^js/JSJoda.OffsetTime this13961 ^js/JSJoda.TemporalField java-time-temporal-TemporalField13962] (.range this13961 java-time-temporal-TemporalField13962))) -(clojure.core/defn get-hour {:arglists (quote (["java.time.OffsetTime"]))} (^int [^js/JSJoda.OffsetTime this13963] (.hour this13963))) -(clojure.core/defn minus-hours {:arglists (quote (["java.time.OffsetTime" "long"]))} (^js/JSJoda.OffsetTime [^js/JSJoda.OffsetTime this13964 ^long long13965] (.minusHours this13964 long13965))) -(clojure.core/defn of {:arglists (quote (["java.time.LocalTime" "java.time.ZoneOffset"] ["int" "int" "int" "int" "java.time.ZoneOffset"]))} (^js/JSJoda.OffsetTime [^js/JSJoda.LocalTime java-time-LocalTime13966 ^js/JSJoda.ZoneOffset java-time-ZoneOffset13967] (js-invoke java.time.OffsetTime "of" java-time-LocalTime13966 java-time-ZoneOffset13967)) (^js/JSJoda.OffsetTime [^int int13968 ^int int13969 ^int int13970 ^int int13971 ^js/JSJoda.ZoneOffset java-time-ZoneOffset13972] (js-invoke java.time.OffsetTime "of" int13968 int13969 int13970 int13971 java-time-ZoneOffset13972))) -(clojure.core/defn is-equal {:arglists (quote (["java.time.OffsetTime" "java.time.OffsetTime"]))} (^boolean [^js/JSJoda.OffsetTime this13973 ^js/JSJoda.OffsetTime java-time-OffsetTime13974] (.isEqual this13973 java-time-OffsetTime13974))) -(clojure.core/defn get-nano {:arglists (quote (["java.time.OffsetTime"]))} (^int [^js/JSJoda.OffsetTime this13975] (.nano this13975))) -(clojure.core/defn minus-seconds {:arglists (quote (["java.time.OffsetTime" "long"]))} (^js/JSJoda.OffsetTime [^js/JSJoda.OffsetTime this13976 ^long long13977] (.minusSeconds this13976 long13977))) -(clojure.core/defn get-second {:arglists (quote (["java.time.OffsetTime"]))} (^int [^js/JSJoda.OffsetTime this13978] (.second this13978))) -(clojure.core/defn plus-nanos {:arglists (quote (["java.time.OffsetTime" "long"]))} (^js/JSJoda.OffsetTime [^js/JSJoda.OffsetTime this13979 ^long long13980] (.plusNanos this13979 long13980))) -(clojure.core/defn plus {:arglists (quote (["java.time.OffsetTime" "long" "java.time.temporal.TemporalUnit"] ["java.time.OffsetTime" "java.time.temporal.TemporalAmount"]))} (^js/JSJoda.OffsetTime [^js/JSJoda.OffsetTime this13981 ^long long13982 ^js/JSJoda.TemporalUnit java-time-temporal-TemporalUnit13983] (.plus this13981 long13982 java-time-temporal-TemporalUnit13983)) (^js/JSJoda.OffsetTime [^js/JSJoda.OffsetTime this13984 ^js/JSJoda.TemporalAmount java-time-temporal-TemporalAmount13985] (.plus this13984 java-time-temporal-TemporalAmount13985))) -(clojure.core/defn with-hour {:arglists (quote (["java.time.OffsetTime" "int"]))} (^js/JSJoda.OffsetTime [^js/JSJoda.OffsetTime this13986 ^int int13987] (.withHour this13986 int13987))) -(clojure.core/defn with-minute {:arglists (quote (["java.time.OffsetTime" "int"]))} (^js/JSJoda.OffsetTime [^js/JSJoda.OffsetTime this13988 ^int int13989] (.withMinute this13988 int13989))) -(clojure.core/defn plus-minutes {:arglists (quote (["java.time.OffsetTime" "long"]))} (^js/JSJoda.OffsetTime [^js/JSJoda.OffsetTime this13990 ^long long13991] (.plusMinutes this13990 long13991))) -(clojure.core/defn query {:arglists (quote (["java.time.OffsetTime" "java.time.temporal.TemporalQuery"]))} (^java.lang.Object [^js/JSJoda.OffsetTime this13992 ^js/JSJoda.TemporalQuery java-time-temporal-TemporalQuery13993] (.query this13992 java-time-temporal-TemporalQuery13993))) -(clojure.core/defn at-date {:arglists (quote (["java.time.OffsetTime" "java.time.LocalDate"]))} (^js/JSJoda.OffsetDateTime [^js/JSJoda.OffsetTime this13994 ^js/JSJoda.LocalDate java-time-LocalDate13995] (.atDate this13994 java-time-LocalDate13995))) -(clojure.core/defn with-offset-same-instant {:arglists (quote (["java.time.OffsetTime" "java.time.ZoneOffset"]))} (^js/JSJoda.OffsetTime [^js/JSJoda.OffsetTime this13996 ^js/JSJoda.ZoneOffset java-time-ZoneOffset13997] (.withOffsetSameInstant this13996 java-time-ZoneOffset13997))) -(clojure.core/defn to-string {:arglists (quote (["java.time.OffsetTime"]))} (^java.lang.String [^js/JSJoda.OffsetTime this13998] (.toString this13998))) -(clojure.core/defn is-before {:arglists (quote (["java.time.OffsetTime" "java.time.OffsetTime"]))} (^boolean [^js/JSJoda.OffsetTime this13999 ^js/JSJoda.OffsetTime java-time-OffsetTime14000] (.isBefore this13999 java-time-OffsetTime14000))) -(clojure.core/defn minus {:arglists (quote (["java.time.OffsetTime" "long" "java.time.temporal.TemporalUnit"] ["java.time.OffsetTime" "java.time.temporal.TemporalAmount"]))} (^js/JSJoda.OffsetTime [^js/JSJoda.OffsetTime this14001 ^long long14002 ^js/JSJoda.TemporalUnit java-time-temporal-TemporalUnit14003] (.minus this14001 long14002 java-time-temporal-TemporalUnit14003)) (^js/JSJoda.OffsetTime [^js/JSJoda.OffsetTime this14004 ^js/JSJoda.TemporalAmount java-time-temporal-TemporalAmount14005] (.minus this14004 java-time-temporal-TemporalAmount14005))) -(clojure.core/defn plus-hours {:arglists (quote (["java.time.OffsetTime" "long"]))} (^js/JSJoda.OffsetTime [^js/JSJoda.OffsetTime this14006 ^long long14007] (.plusHours this14006 long14007))) -(clojure.core/defn to-local-time {:arglists (quote (["java.time.OffsetTime"]))} (^js/JSJoda.LocalTime [^js/JSJoda.OffsetTime this14008] (.toLocalTime this14008))) -(clojure.core/defn get-long {:arglists (quote (["java.time.OffsetTime" "java.time.temporal.TemporalField"]))} (^long [^js/JSJoda.OffsetTime this14009 ^js/JSJoda.TemporalField java-time-temporal-TemporalField14010] (.getLong this14009 java-time-temporal-TemporalField14010))) -(clojure.core/defn get-offset {:arglists (quote (["java.time.OffsetTime"]))} (^js/JSJoda.ZoneOffset [^js/JSJoda.OffsetTime this14011] (.offset this14011))) -(clojure.core/defn with-nano {:arglists (quote (["java.time.OffsetTime" "int"]))} (^js/JSJoda.OffsetTime [^js/JSJoda.OffsetTime this14012 ^int int14013] (.withNano this14012 int14013))) -(clojure.core/defn until {:arglists (quote (["java.time.OffsetTime" "java.time.temporal.Temporal" "java.time.temporal.TemporalUnit"]))} (^long [^js/JSJoda.OffsetTime this14014 ^js/JSJoda.Temporal java-time-temporal-Temporal14015 ^js/JSJoda.TemporalUnit java-time-temporal-TemporalUnit14016] (.until this14014 java-time-temporal-Temporal14015 java-time-temporal-TemporalUnit14016))) -(clojure.core/defn with-offset-same-local {:arglists (quote (["java.time.OffsetTime" "java.time.ZoneOffset"]))} (^js/JSJoda.OffsetTime [^js/JSJoda.OffsetTime this14017 ^js/JSJoda.ZoneOffset java-time-ZoneOffset14018] (.withOffsetSameLocal this14017 java-time-ZoneOffset14018))) -(clojure.core/defn from {:arglists (quote (["java.time.temporal.TemporalAccessor"]))} (^js/JSJoda.OffsetTime [^js/JSJoda.TemporalAccessor java-time-temporal-TemporalAccessor14019] (js-invoke java.time.OffsetTime "from" java-time-temporal-TemporalAccessor14019))) -(clojure.core/defn is-after {:arglists (quote (["java.time.OffsetTime" "java.time.OffsetTime"]))} (^boolean [^js/JSJoda.OffsetTime this14020 ^js/JSJoda.OffsetTime java-time-OffsetTime14021] (.isAfter this14020 java-time-OffsetTime14021))) -(clojure.core/defn minus-nanos {:arglists (quote (["java.time.OffsetTime" "long"]))} (^js/JSJoda.OffsetTime [^js/JSJoda.OffsetTime this14022 ^long long14023] (.minusNanos this14022 long14023))) -(clojure.core/defn is-supported {:arglists (quote (["java.time.OffsetTime" "java.time.temporal.TemporalUnit"] ["java.time.OffsetTime" "java.time.temporal.TemporalField"]))} (^boolean [this14024 G__14025] (.isSupported ^js/JSJoda.OffsetTime this14024 G__14025))) -(clojure.core/defn parse {:arglists (quote (["java.lang.CharSequence"] ["java.lang.CharSequence" "java.time.format.DateTimeFormatter"]))} (^js/JSJoda.OffsetTime [^java.lang.CharSequence java-lang-CharSequence14026] (js-invoke java.time.OffsetTime "parse" java-lang-CharSequence14026)) (^js/JSJoda.OffsetTime [^java.lang.CharSequence java-lang-CharSequence14027 ^js/JSJoda.DateTimeFormatter java-time-format-DateTimeFormatter14028] (js-invoke java.time.OffsetTime "parse" java-lang-CharSequence14027 java-time-format-DateTimeFormatter14028))) -(clojure.core/defn with-second {:arglists (quote (["java.time.OffsetTime" "int"]))} (^js/JSJoda.OffsetTime [^js/JSJoda.OffsetTime this14029 ^int int14030] (.withSecond this14029 int14030))) -(clojure.core/defn get-minute {:arglists (quote (["java.time.OffsetTime"]))} (^int [^js/JSJoda.OffsetTime this14031] (.minute this14031))) -(clojure.core/defn hash-code {:arglists (quote (["java.time.OffsetTime"]))} (^int [^js/JSJoda.OffsetTime this14032] (.hashCode this14032))) -(clojure.core/defn adjust-into {:arglists (quote (["java.time.OffsetTime" "java.time.temporal.Temporal"]))} (^js/JSJoda.Temporal [^js/JSJoda.OffsetTime this14033 ^js/JSJoda.Temporal java-time-temporal-Temporal14034] (.adjustInto this14033 java-time-temporal-Temporal14034))) -(clojure.core/defn with {:arglists (quote (["java.time.OffsetTime" "java.time.temporal.TemporalAdjuster"] ["java.time.OffsetTime" "java.time.temporal.TemporalField" "long"]))} (^js/JSJoda.OffsetTime [^js/JSJoda.OffsetTime this14035 ^js/JSJoda.TemporalAdjuster java-time-temporal-TemporalAdjuster14036] (.with this14035 java-time-temporal-TemporalAdjuster14036)) (^js/JSJoda.OffsetTime [^js/JSJoda.OffsetTime this14037 ^js/JSJoda.TemporalField java-time-temporal-TemporalField14038 ^long long14039] (.with this14037 java-time-temporal-TemporalField14038 long14039))) -(clojure.core/defn now {:arglists (quote ([] ["java.time.ZoneId"] ["java.time.Clock"]))} (^js/JSJoda.OffsetTime [] (js-invoke java.time.OffsetTime "now")) (^js/JSJoda.OffsetTime [G__14041] (js-invoke java.time.OffsetTime "now" G__14041))) -(clojure.core/defn compare-to {:arglists (quote (["java.time.OffsetTime" "java.time.OffsetTime"]))} (^int [^js/JSJoda.OffsetTime this14042 ^js/JSJoda.OffsetTime java-time-OffsetTime14043] (.compareTo this14042 java-time-OffsetTime14043))) -(clojure.core/defn of-instant {:arglists (quote (["java.time.Instant" "java.time.ZoneId"]))} (^js/JSJoda.OffsetTime [^js/JSJoda.Instant java-time-Instant14044 ^js/JSJoda.ZoneId java-time-ZoneId14045] (js-invoke java.time.OffsetTime "ofInstant" java-time-Instant14044 java-time-ZoneId14045))) -(clojure.core/defn plus-seconds {:arglists (quote (["java.time.OffsetTime" "long"]))} (^js/JSJoda.OffsetTime [^js/JSJoda.OffsetTime this14046 ^long long14047] (.plusSeconds this14046 long14047))) -(clojure.core/defn get {:arglists (quote (["java.time.OffsetTime" "java.time.temporal.TemporalField"]))} (^int [^js/JSJoda.OffsetTime this14048 ^js/JSJoda.TemporalField java-time-temporal-TemporalField14049] (.get this14048 java-time-temporal-TemporalField14049))) -(clojure.core/defn equals {:arglists (quote (["java.time.OffsetTime" "java.lang.Object"]))} (^boolean [^js/JSJoda.OffsetTime this14050 ^java.lang.Object java-lang-Object14051] (.equals this14050 java-lang-Object14051))) -(clojure.core/defn format {:arglists (quote (["java.time.OffsetTime" "java.time.format.DateTimeFormatter"]))} (^java.lang.String [^js/JSJoda.OffsetTime this14052 ^js/JSJoda.DateTimeFormatter java-time-format-DateTimeFormatter14053] (.format this14052 java-time-format-DateTimeFormatter14053))) +(ns cljc.java-time.offset-time + (:refer-clojure :exclude + [abs get range format min max next name resolve short]) + (:require [cljc.java-time.extn.calendar-awareness] + [goog.object] + [java.time :refer [OffsetTime]])) + +(def min + "The minimum supported {@code OffsetTime}, '00:00:00+18:00'. + This is the time of midnight at the start of the day in the maximum offset + (larger offsets are earlier on the time-line). + This combines {@link LocalTime#MIN} and {@link ZoneOffset#MAX}. + This could be used by an application as a \"far past\" date." + (goog.object/get java.time.OffsetTime "MIN")) + +(def max + "The maximum supported {@code OffsetTime}, '23:59:59.999999999-18:00'. + This is the time just before midnight at the end of the day in the minimum offset + (larger negative offsets are later on the time-line). + This combines {@link LocalTime#MAX} and {@link ZoneOffset#MIN}. + This could be used by an application as a \"far future\" date." + (goog.object/get java.time.OffsetTime "MAX")) + +(defn minus-minutes + "Returns a copy of this {@code OffsetTime} with the specified number of minutes subtracted. + + This subtracts the specified number of minutes from this time, returning a new time. + The calculation wraps around midnight. + + This instance is immutable and unaffected by this method call. + + @param minutes the minutes to subtract, may be negative + @return an {@code OffsetTime} based on this time with the minutes subtracted, not null" + {:arglists (quote (["java.time.OffsetTime" "long"]))} + (^js/JSJoda.OffsetTime [^js/JSJoda.OffsetTime this ^long minutes] + (.minusMinutes this minutes))) + +(defn truncated-to + "Returns a copy of this {@code OffsetTime} with the time truncated. + + Truncation returns a copy of the original time with fields + smaller than the specified unit set to zero. + For example, truncating with the {@link ChronoUnit#MINUTES minutes} unit + will set the second-of-minute and nano-of-second field to zero. + + The unit must have a {@linkplain TemporalUnit#getDuration() duration} + that divides into the length of a standard day without remainder. + This includes all supplied time units on {@link ChronoUnit} and + {@link ChronoUnit#DAYS DAYS}. Other units throw an exception. + + The offset does not affect the calculation and will be the same in the result. + + This instance is immutable and unaffected by this method call. + + @param unit the unit to truncate to, not null + @return an {@code OffsetTime} based on this time with the time truncated, not null + @throws DateTimeException if unable to truncate + @throws UnsupportedTemporalTypeException if the unit is not supported" + {:arglists (quote (["java.time.OffsetTime" + "java.time.temporal.TemporalUnit"]))} + (^js/JSJoda.OffsetTime + [^js/JSJoda.OffsetTime this ^js/JSJoda.TemporalUnit unit] + (.truncatedTo this unit))) + +(defn range + "Gets the range of valid values for the specified field. + + The range object expresses the minimum and maximum valid values for a field. + This time is used to enhance the accuracy of the returned range. + If it is not possible to return the range, because the field is not supported + or for some other reason, an exception is thrown. + + If the field is a {@link ChronoField} then the query is implemented here. + The {@link #isSupported(TemporalField) supported fields} will return + appropriate range instances. + All other {@code ChronoField} instances will throw an {@code UnsupportedTemporalTypeException}. + + If the field is not a {@code ChronoField}, then the result of this method + is obtained by invoking {@code TemporalField.rangeRefinedBy(TemporalAccessor)} + passing {@code this} as the argument. + Whether the range can be obtained is determined by the field. + + @param field the field to query the range for, not null + @return the range of valid values for the field, not null + @throws DateTimeException if the range for the field cannot be obtained + @throws UnsupportedTemporalTypeException if the field is not supported" + {:arglists (quote (["java.time.OffsetTime" + "java.time.temporal.TemporalField"]))} + (^js/JSJoda.ValueRange + [^js/JSJoda.OffsetTime this ^js/JSJoda.TemporalField field] + (.range this field))) + +(defn get-hour + "Gets the hour-of-day field. + + @return the hour-of-day, from 0 to 23" + {:arglists (quote (["java.time.OffsetTime"]))} + (^int [^js/JSJoda.OffsetTime this] (.hour this))) + +(defn minus-hours + "Returns a copy of this {@code OffsetTime} with the specified number of hours subtracted. + + This subtracts the specified number of hours from this time, returning a new time. + The calculation wraps around midnight. + + This instance is immutable and unaffected by this method call. + + @param hours the hours to subtract, may be negative + @return an {@code OffsetTime} based on this time with the hours subtracted, not null" + {:arglists (quote (["java.time.OffsetTime" "long"]))} + (^js/JSJoda.OffsetTime [^js/JSJoda.OffsetTime this ^long hours] + (.minusHours this hours))) + +(defn of + {:arglists (quote (["java.time.LocalTime" "java.time.ZoneOffset"] + ["int" "int" "int" "int" "java.time.ZoneOffset"]))} + (^js/JSJoda.OffsetTime + [^js/JSJoda.LocalTime time ^js/JSJoda.ZoneOffset offset] + (js-invoke java.time.OffsetTime "of" time offset)) + (^js/JSJoda.OffsetTime + [^int hour ^int minute ^int second ^int nano-of-second + ^js/JSJoda.ZoneOffset offset] + (js-invoke java.time.OffsetTime + "of" + hour + minute + second + nano-of-second + offset))) + +(defn is-equal + "Checks if the instant of this {@code OffsetTime} is equal to that of the + specified time applying both times to a common date. + + This method differs from the comparison in {@link #compareTo} and {@link #equals} + in that it only compares the instant of the time. This is equivalent to converting both + times to an instant using the same date and comparing the instants. + + @param other the other time to compare to, not null + @return true if this is equal to the instant of the specified time" + {:arglists (quote (["java.time.OffsetTime" "java.time.OffsetTime"]))} + (^boolean [^js/JSJoda.OffsetTime this ^js/JSJoda.OffsetTime other] + (.isEqual this other))) + +(defn get-nano + "Gets the nano-of-second field. + + @return the nano-of-second, from 0 to 999,999,999" + {:arglists (quote (["java.time.OffsetTime"]))} + (^int [^js/JSJoda.OffsetTime this] (.nano this))) + +(defn minus-seconds + "Returns a copy of this {@code OffsetTime} with the specified number of seconds subtracted. + + This subtracts the specified number of seconds from this time, returning a new time. + The calculation wraps around midnight. + + This instance is immutable and unaffected by this method call. + + @param seconds the seconds to subtract, may be negative + @return an {@code OffsetTime} based on this time with the seconds subtracted, not null" + {:arglists (quote (["java.time.OffsetTime" "long"]))} + (^js/JSJoda.OffsetTime [^js/JSJoda.OffsetTime this ^long seconds] + (.minusSeconds this seconds))) + +(defn get-second + "Gets the second-of-minute field. + + @return the second-of-minute, from 0 to 59" + {:arglists (quote (["java.time.OffsetTime"]))} + (^int [^js/JSJoda.OffsetTime this] (.second this))) + +(defn plus-nanos + "Returns a copy of this {@code OffsetTime} with the specified number of nanoseconds added. + + This adds the specified number of nanoseconds to this time, returning a new time. + The calculation wraps around midnight. + + This instance is immutable and unaffected by this method call. + + @param nanos the nanos to add, may be negative + @return an {@code OffsetTime} based on this time with the nanoseconds added, not null" + {:arglists (quote (["java.time.OffsetTime" "long"]))} + (^js/JSJoda.OffsetTime [^js/JSJoda.OffsetTime this ^long nanos] + (.plusNanos this nanos))) + +(defn plus + {:arglists (quote (["java.time.OffsetTime" + "java.time.temporal.TemporalAmount"] + ["java.time.OffsetTime" "long" + "java.time.temporal.TemporalUnit"]))} + (^js/JSJoda.OffsetTime + [^js/JSJoda.OffsetTime this ^js/JSJoda.TemporalAmount amount-to-add] + (.plus this amount-to-add)) + (^js/JSJoda.OffsetTime + [^js/JSJoda.OffsetTime this ^long amount-to-add ^js/JSJoda.TemporalUnit unit] + (.plus this amount-to-add unit))) + +(defn with-hour + "Returns a copy of this {@code OffsetTime} with the hour-of-day altered. + + The offset does not affect the calculation and will be the same in the result. + + This instance is immutable and unaffected by this method call. + + @param hour the hour-of-day to set in the result, from 0 to 23 + @return an {@code OffsetTime} based on this time with the requested hour, not null + @throws DateTimeException if the hour value is invalid" + {:arglists (quote (["java.time.OffsetTime" "int"]))} + (^js/JSJoda.OffsetTime [^js/JSJoda.OffsetTime this ^int hour] + (.withHour this hour))) + +(defn with-minute + "Returns a copy of this {@code OffsetTime} with the minute-of-hour altered. + + The offset does not affect the calculation and will be the same in the result. + + This instance is immutable and unaffected by this method call. + + @param minute the minute-of-hour to set in the result, from 0 to 59 + @return an {@code OffsetTime} based on this time with the requested minute, not null + @throws DateTimeException if the minute value is invalid" + {:arglists (quote (["java.time.OffsetTime" "int"]))} + (^js/JSJoda.OffsetTime [^js/JSJoda.OffsetTime this ^int minute] + (.withMinute this minute))) + +(defn plus-minutes + "Returns a copy of this {@code OffsetTime} with the specified number of minutes added. + + This adds the specified number of minutes to this time, returning a new time. + The calculation wraps around midnight. + + This instance is immutable and unaffected by this method call. + + @param minutes the minutes to add, may be negative + @return an {@code OffsetTime} based on this time with the minutes added, not null" + {:arglists (quote (["java.time.OffsetTime" "long"]))} + (^js/JSJoda.OffsetTime [^js/JSJoda.OffsetTime this ^long minutes] + (.plusMinutes this minutes))) + +(defn query + "Queries this time using the specified query. + + This queries this time using the specified query strategy object. + The {@code TemporalQuery} object defines the logic to be used to + obtain the result. Read the documentation of the query to understand + what the result of this method will be. + + The result of this method is obtained by invoking the + {@link TemporalQuery#queryFrom(TemporalAccessor)} method on the + specified query passing {@code this} as the argument. + + @param the type of the result + @param query the query to invoke, not null + @return the query result, null may be returned (defined by the query) + @throws DateTimeException if unable to query (defined by the query) + @throws ArithmeticException if numeric overflow occurs (defined by the query)" + {:arglists (quote (["java.time.OffsetTime" + "java.time.temporal.TemporalQuery"]))} + (^java.lang.Object [^js/JSJoda.OffsetTime this ^js/JSJoda.TemporalQuery query] + (.query this query))) + +(defn at-date + "Combines this time with a date to create an {@code OffsetDateTime}. + + This returns an {@code OffsetDateTime} formed from this time and the specified date. + All possible combinations of date and time are valid. + + @param date the date to combine with, not null + @return the offset date-time formed from this time and the specified date, not null" + {:arglists (quote (["java.time.OffsetTime" "java.time.LocalDate"]))} + (^js/JSJoda.OffsetDateTime + [^js/JSJoda.OffsetTime this ^js/JSJoda.LocalDate date] + (.atDate this date))) + +(defn with-offset-same-instant + "Returns a copy of this {@code OffsetTime} with the specified offset ensuring + that the result is at the same instant on an implied day. + + This method returns an object with the specified {@code ZoneOffset} and a {@code LocalTime} + adjusted by the difference between the two offsets. + This will result in the old and new objects representing the same instant on an implied day. + This is useful for finding the local time in a different offset. + For example, if this time represents {@code 10:30+02:00} and the offset specified is + {@code +03:00}, then this method will return {@code 11:30+03:00}. + + To change the offset without adjusting the local time use {@link #withOffsetSameLocal}. + + This instance is immutable and unaffected by this method call. + + @param offset the zone offset to change to, not null + @return an {@code OffsetTime} based on this time with the requested offset, not null" + {:arglists (quote (["java.time.OffsetTime" "java.time.ZoneOffset"]))} + (^js/JSJoda.OffsetTime + [^js/JSJoda.OffsetTime this ^js/JSJoda.ZoneOffset offset] + (.withOffsetSameInstant this offset))) + +(defn to-string + "Outputs this time as a {@code String}, such as {@code 10:15:30+01:00}. + + The output will be one of the following ISO-8601 formats: +
    +
  • {@code HH:mmXXXXX}
  • +
  • {@code HH:mm:ssXXXXX}
  • +
  • {@code HH:mm:ss.SSSXXXXX}
  • +
  • {@code HH:mm:ss.SSSSSSXXXXX}
  • +
  • {@code HH:mm:ss.SSSSSSSSSXXXXX}
  • +
+ The format used will be the shortest that outputs the full value of + the time where the omitted parts are implied to be zero. + + @return a string representation of this time, not null" + {:arglists (quote (["java.time.OffsetTime"]))} + (^java.lang.String [^js/JSJoda.OffsetTime this] (.toString this))) + +(defn is-before + "Checks if the instant of this {@code OffsetTime} is before that of the + specified time applying both times to a common date. + + This method differs from the comparison in {@link #compareTo} in that it + only compares the instant of the time. This is equivalent to converting both + times to an instant using the same date and comparing the instants. + + @param other the other time to compare to, not null + @return true if this is before the instant of the specified time" + {:arglists (quote (["java.time.OffsetTime" "java.time.OffsetTime"]))} + (^boolean [^js/JSJoda.OffsetTime this ^js/JSJoda.OffsetTime other] + (.isBefore this other))) + +(defn minus + {:arglists (quote (["java.time.OffsetTime" + "java.time.temporal.TemporalAmount"] + ["java.time.OffsetTime" "long" + "java.time.temporal.TemporalUnit"]))} + (^js/JSJoda.OffsetTime + [^js/JSJoda.OffsetTime this ^js/JSJoda.TemporalAmount amount-to-subtract] + (.minus this amount-to-subtract)) + (^js/JSJoda.OffsetTime + [^js/JSJoda.OffsetTime this ^long amount-to-subtract + ^js/JSJoda.TemporalUnit unit] + (.minus this amount-to-subtract unit))) + +(defn plus-hours + "Returns a copy of this {@code OffsetTime} with the specified number of hours added. + + This adds the specified number of hours to this time, returning a new time. + The calculation wraps around midnight. + + This instance is immutable and unaffected by this method call. + + @param hours the hours to add, may be negative + @return an {@code OffsetTime} based on this time with the hours added, not null" + {:arglists (quote (["java.time.OffsetTime" "long"]))} + (^js/JSJoda.OffsetTime [^js/JSJoda.OffsetTime this ^long hours] + (.plusHours this hours))) + +(defn to-local-time + "Gets the {@code LocalTime} part of this date-time. + + This returns a {@code LocalTime} with the same hour, minute, second and + nanosecond as this date-time. + + @return the time part of this date-time, not null" + {:arglists (quote (["java.time.OffsetTime"]))} + (^js/JSJoda.LocalTime [^js/JSJoda.OffsetTime this] (.toLocalTime this))) + +(defn get-long + "Gets the value of the specified field from this time as a {@code long}. + + This queries this time for the value of the specified field. + If it is not possible to return the value, because the field is not supported + or for some other reason, an exception is thrown. + + If the field is a {@link ChronoField} then the query is implemented here. + The {@link #isSupported(TemporalField) supported fields} will return valid + values based on this time. + All other {@code ChronoField} instances will throw an {@code UnsupportedTemporalTypeException}. + + If the field is not a {@code ChronoField}, then the result of this method + is obtained by invoking {@code TemporalField.getFrom(TemporalAccessor)} + passing {@code this} as the argument. Whether the value can be obtained, + and what the value represents, is determined by the field. + + @param field the field to get, not null + @return the value for the field + @throws DateTimeException if a value for the field cannot be obtained + @throws UnsupportedTemporalTypeException if the field is not supported + @throws ArithmeticException if numeric overflow occurs" + {:arglists (quote (["java.time.OffsetTime" + "java.time.temporal.TemporalField"]))} + (^long [^js/JSJoda.OffsetTime this ^js/JSJoda.TemporalField field] + (.getLong this field))) + +(defn get-offset + "Gets the zone offset, such as '+01:00'. + + This is the offset of the local time from UTC/Greenwich. + + @return the zone offset, not null" + {:arglists (quote (["java.time.OffsetTime"]))} + (^js/JSJoda.ZoneOffset [^js/JSJoda.OffsetTime this] (.offset this))) + +(defn with-nano + "Returns a copy of this {@code OffsetTime} with the nano-of-second altered. + + The offset does not affect the calculation and will be the same in the result. + + This instance is immutable and unaffected by this method call. + + @param nanoOfSecond the nano-of-second to set in the result, from 0 to 999,999,999 + @return an {@code OffsetTime} based on this time with the requested nanosecond, not null + @throws DateTimeException if the nanos value is invalid" + {:arglists (quote (["java.time.OffsetTime" "int"]))} + (^js/JSJoda.OffsetTime [^js/JSJoda.OffsetTime this ^int nano-of-second] + (.withNano this nano-of-second))) + +(defn until + "Calculates the amount of time until another time in terms of the specified unit. + + This calculates the amount of time between two {@code OffsetTime} + objects in terms of a single {@code TemporalUnit}. + The start and end points are {@code this} and the specified time. + The result will be negative if the end is before the start. + For example, the amount in hours between two times can be calculated + using {@code startTime.until(endTime, HOURS)}. + + The {@code Temporal} passed to this method is converted to a + {@code OffsetTime} using {@link #from(TemporalAccessor)}. + If the offset differs between the two times, then the specified + end time is normalized to have the same offset as this time. + + The calculation returns a whole number, representing the number of + complete units between the two times. + For example, the amount in hours between 11:30Z and 13:29Z will only + be one hour as it is one minute short of two hours. + + There are two equivalent ways of using this method. + The first is to invoke this method. + The second is to use {@link TemporalUnit#between(Temporal, Temporal)}: +
+   // these two lines are equivalent
+   amount = start.until(end, MINUTES);
+   amount = MINUTES.between(start, end);
+ 
+ The choice should be made based on which makes the code more readable. + + The calculation is implemented in this method for {@link ChronoUnit}. + The units {@code NANOS}, {@code MICROS}, {@code MILLIS}, {@code SECONDS}, + {@code MINUTES}, {@code HOURS} and {@code HALF_DAYS} are supported. + Other {@code ChronoUnit} values will throw an exception. + + If the unit is not a {@code ChronoUnit}, then the result of this method + is obtained by invoking {@code TemporalUnit.between(Temporal, Temporal)} + passing {@code this} as the first argument and the converted input temporal + as the second argument. + + This instance is immutable and unaffected by this method call. + + @param endExclusive the end time, exclusive, which is converted to an {@code OffsetTime}, not null + @param unit the unit to measure the amount in, not null + @return the amount of time between this time and the end time + @throws DateTimeException if the amount cannot be calculated, or the end + temporal cannot be converted to an {@code OffsetTime} + @throws UnsupportedTemporalTypeException if the unit is not supported + @throws ArithmeticException if numeric overflow occurs" + {:arglists (quote (["java.time.OffsetTime" "java.time.temporal.Temporal" + "java.time.temporal.TemporalUnit"]))} + (^long + [^js/JSJoda.OffsetTime this ^js/JSJoda.Temporal end-exclusive + ^js/JSJoda.TemporalUnit unit] + (.until this end-exclusive unit))) + +(defn with-offset-same-local + "Returns a copy of this {@code OffsetTime} with the specified offset ensuring + that the result has the same local time. + + This method returns an object with the same {@code LocalTime} and the specified {@code ZoneOffset}. + No calculation is needed or performed. + For example, if this time represents {@code 10:30+02:00} and the offset specified is + {@code +03:00}, then this method will return {@code 10:30+03:00}. + + To take into account the difference between the offsets, and adjust the time fields, + use {@link #withOffsetSameInstant}. + + This instance is immutable and unaffected by this method call. + + @param offset the zone offset to change to, not null + @return an {@code OffsetTime} based on this time with the requested offset, not null" + {:arglists (quote (["java.time.OffsetTime" "java.time.ZoneOffset"]))} + (^js/JSJoda.OffsetTime + [^js/JSJoda.OffsetTime this ^js/JSJoda.ZoneOffset offset] + (.withOffsetSameLocal this offset))) + +(defn from + "Obtains an instance of {@code OffsetTime} from a temporal object. + + This obtains an offset time based on the specified temporal. + A {@code TemporalAccessor} represents an arbitrary set of date and time information, + which this factory converts to an instance of {@code OffsetTime}. + + The conversion extracts and combines the {@code ZoneOffset} and the + {@code LocalTime} from the temporal object. + Implementations are permitted to perform optimizations such as accessing + those fields that are equivalent to the relevant objects. + + This method matches the signature of the functional interface {@link TemporalQuery} + allowing it to be used as a query via method reference, {@code OffsetTime::from}. + + @param temporal the temporal object to convert, not null + @return the offset time, not null + @throws DateTimeException if unable to convert to an {@code OffsetTime}" + {:arglists (quote (["java.time.temporal.TemporalAccessor"]))} + (^js/JSJoda.OffsetTime [^js/JSJoda.TemporalAccessor temporal] + (js-invoke java.time.OffsetTime "from" temporal))) + +(defn is-after + "Checks if the instant of this {@code OffsetTime} is after that of the + specified time applying both times to a common date. + + This method differs from the comparison in {@link #compareTo} in that it + only compares the instant of the time. This is equivalent to converting both + times to an instant using the same date and comparing the instants. + + @param other the other time to compare to, not null + @return true if this is after the instant of the specified time" + {:arglists (quote (["java.time.OffsetTime" "java.time.OffsetTime"]))} + (^boolean [^js/JSJoda.OffsetTime this ^js/JSJoda.OffsetTime other] + (.isAfter this other))) + +(defn minus-nanos + "Returns a copy of this {@code OffsetTime} with the specified number of nanoseconds subtracted. + + This subtracts the specified number of nanoseconds from this time, returning a new time. + The calculation wraps around midnight. + + This instance is immutable and unaffected by this method call. + + @param nanos the nanos to subtract, may be negative + @return an {@code OffsetTime} based on this time with the nanoseconds subtracted, not null" + {:arglists (quote (["java.time.OffsetTime" "long"]))} + (^js/JSJoda.OffsetTime [^js/JSJoda.OffsetTime this ^long nanos] + (.minusNanos this nanos))) + +(defn is-supported + {:arglists (quote (["java.time.OffsetTime" "java.time.temporal.TemporalField"] + ["java.time.OffsetTime" + "java.time.temporal.TemporalUnit"]))} + (^boolean [^js/JSJoda.OffsetTime this arg0] + (.isSupported ^js/JSJoda.OffsetTime this arg0))) + +(defn parse + {:arglists (quote (["java.lang.CharSequence"] + ["java.lang.CharSequence" + "java.time.format.DateTimeFormatter"]))} + (^js/JSJoda.OffsetTime [^java.lang.CharSequence text] + (js-invoke java.time.OffsetTime "parse" text)) + (^js/JSJoda.OffsetTime + [^java.lang.CharSequence text ^js/JSJoda.DateTimeFormatter formatter] + (js-invoke java.time.OffsetTime "parse" text formatter))) + +(defn with-second + "Returns a copy of this {@code OffsetTime} with the second-of-minute altered. + + The offset does not affect the calculation and will be the same in the result. + + This instance is immutable and unaffected by this method call. + + @param second the second-of-minute to set in the result, from 0 to 59 + @return an {@code OffsetTime} based on this time with the requested second, not null + @throws DateTimeException if the second value is invalid" + {:arglists (quote (["java.time.OffsetTime" "int"]))} + (^js/JSJoda.OffsetTime [^js/JSJoda.OffsetTime this ^int second] + (.withSecond this second))) + +(defn get-minute + "Gets the minute-of-hour field. + + @return the minute-of-hour, from 0 to 59" + {:arglists (quote (["java.time.OffsetTime"]))} + (^int [^js/JSJoda.OffsetTime this] (.minute this))) + +(defn hash-code + "A hash code for this time. + + @return a suitable hash code" + {:arglists (quote (["java.time.OffsetTime"]))} + (^int [^js/JSJoda.OffsetTime this] (.hashCode this))) + +(defn adjust-into + "Adjusts the specified temporal object to have the same offset and time + as this object. + + This returns a temporal object of the same observable type as the input + with the offset and time changed to be the same as this. + + The adjustment is equivalent to using {@link Temporal#with(TemporalField, long)} + twice, passing {@link ChronoField#NANO_OF_DAY} and + {@link ChronoField#OFFSET_SECONDS} as the fields. + + In most cases, it is clearer to reverse the calling pattern by using + {@link Temporal#with(TemporalAdjuster)}: +
+   // these two lines are equivalent, but the second approach is recommended
+   temporal = thisOffsetTime.adjustInto(temporal);
+   temporal = temporal.with(thisOffsetTime);
+ 
+ + This instance is immutable and unaffected by this method call. + + @param temporal the target object to be adjusted, not null + @return the adjusted object, not null + @throws DateTimeException if unable to make the adjustment + @throws ArithmeticException if numeric overflow occurs" + {:arglists (quote (["java.time.OffsetTime" "java.time.temporal.Temporal"]))} + (^js/JSJoda.Temporal [^js/JSJoda.OffsetTime this ^js/JSJoda.Temporal temporal] + (.adjustInto this temporal))) + +(defn with + {:arglists (quote (["java.time.OffsetTime" + "java.time.temporal.TemporalAdjuster"] + ["java.time.OffsetTime" "java.time.temporal.TemporalField" + "long"]))} + (^js/JSJoda.OffsetTime + [^js/JSJoda.OffsetTime this ^js/JSJoda.TemporalAdjuster adjuster] + (.with this adjuster)) + (^js/JSJoda.OffsetTime + [^js/JSJoda.OffsetTime this ^js/JSJoda.TemporalField field ^long new-value] + (.with this field new-value))) + +(defn now + {:arglists (quote ([] ["java.time.Clock"] ["java.time.ZoneId"]))} + (^js/JSJoda.OffsetTime [] (js-invoke java.time.OffsetTime "now")) + (^js/JSJoda.OffsetTime [arg0] (js-invoke java.time.OffsetTime "now" arg0))) + +(defn compare-to + "Compares this {@code OffsetTime} to another time. + + The comparison is based first on the UTC equivalent instant, then on the local time. + It is \"consistent with equals\", as defined by {@link Comparable}. + + For example, the following is the comparator order: +
    +
  1. {@code 10:30+01:00}
  2. +
  3. {@code 11:00+01:00}
  4. +
  5. {@code 12:00+02:00}
  6. +
  7. {@code 11:30+01:00}
  8. +
  9. {@code 12:00+01:00}
  10. +
  11. {@code 12:30+01:00}
  12. +
+ Values #2 and #3 represent the same instant on the time-line. + When two values represent the same instant, the local time is compared + to distinguish them. This step is needed to make the ordering + consistent with {@code equals()}. + + To compare the underlying local time of two {@code TemporalAccessor} instances, + use {@link ChronoField#NANO_OF_DAY} as a comparator. + + @param other the other time to compare to, not null + @return the comparator value, negative if less, positive if greater + @throws NullPointerException if {@code other} is null" + {:arglists (quote (["java.time.OffsetTime" "java.time.OffsetTime"]))} + (^int [^js/JSJoda.OffsetTime this ^js/JSJoda.OffsetTime other] + (.compareTo this other))) + +(defn of-instant + "Obtains an instance of {@code OffsetTime} from an {@code Instant} and zone ID. + + This creates an offset time with the same instant as that specified. + Finding the offset from UTC/Greenwich is simple as there is only one valid + offset for each instant. + + The date component of the instant is dropped during the conversion. + This means that the conversion can never fail due to the instant being + out of the valid range of dates. + + @param instant the instant to create the time from, not null + @param zone the time-zone, which may be an offset, not null + @return the offset time, not null" + {:arglists (quote (["java.time.Instant" "java.time.ZoneId"]))} + (^js/JSJoda.OffsetTime [^js/JSJoda.Instant instant ^js/JSJoda.ZoneId zone] + (js-invoke java.time.OffsetTime "ofInstant" instant zone))) + +(defn plus-seconds + "Returns a copy of this {@code OffsetTime} with the specified number of seconds added. + + This adds the specified number of seconds to this time, returning a new time. + The calculation wraps around midnight. + + This instance is immutable and unaffected by this method call. + + @param seconds the seconds to add, may be negative + @return an {@code OffsetTime} based on this time with the seconds added, not null" + {:arglists (quote (["java.time.OffsetTime" "long"]))} + (^js/JSJoda.OffsetTime [^js/JSJoda.OffsetTime this ^long seconds] + (.plusSeconds this seconds))) + +(defn get + "Gets the value of the specified field from this time as an {@code int}. + + This queries this time for the value of the specified field. + The returned value will always be within the valid range of values for the field. + If it is not possible to return the value, because the field is not supported + or for some other reason, an exception is thrown. + + If the field is a {@link ChronoField} then the query is implemented here. + The {@link #isSupported(TemporalField) supported fields} will return valid + values based on this time, except {@code NANO_OF_DAY} and {@code MICRO_OF_DAY} + which are too large to fit in an {@code int} and throw a {@code DateTimeException}. + All other {@code ChronoField} instances will throw an {@code UnsupportedTemporalTypeException}. + + If the field is not a {@code ChronoField}, then the result of this method + is obtained by invoking {@code TemporalField.getFrom(TemporalAccessor)} + passing {@code this} as the argument. Whether the value can be obtained, + and what the value represents, is determined by the field. + + @param field the field to get, not null + @return the value for the field + @throws DateTimeException if a value for the field cannot be obtained or + the value is outside the range of valid values for the field + @throws UnsupportedTemporalTypeException if the field is not supported or + the range of values exceeds an {@code int} + @throws ArithmeticException if numeric overflow occurs" + {:arglists (quote (["java.time.OffsetTime" + "java.time.temporal.TemporalField"]))} + (^int [^js/JSJoda.OffsetTime this ^js/JSJoda.TemporalField field] + (.get this field))) + +(defn equals + "Checks if this time is equal to another time. + + The comparison is based on the local-time and the offset. + To compare for the same instant on the time-line, use {@link #isEqual(OffsetTime)}. + + Only objects of type {@code OffsetTime} are compared, other types return false. + To compare the underlying local time of two {@code TemporalAccessor} instances, + use {@link ChronoField#NANO_OF_DAY} as a comparator. + + @param obj the object to check, null returns false + @return true if this is equal to the other time" + {:arglists (quote (["java.time.OffsetTime" "java.lang.Object"]))} + (^boolean [^js/JSJoda.OffsetTime this ^java.lang.Object obj] + (.equals this obj))) + +(defn format + "Formats this time using the specified formatter. + + This time will be passed to the formatter to produce a string. + + @param formatter the formatter to use, not null + @return the formatted time string, not null + @throws DateTimeException if an error occurs during printing" + {:arglists (quote (["java.time.OffsetTime" + "java.time.format.DateTimeFormatter"]))} + (^java.lang.String + [^js/JSJoda.OffsetTime this ^js/JSJoda.DateTimeFormatter formatter] + (.format this formatter))) diff --git a/src/cljc/java_time/period.clj b/src/cljc/java_time/period.clj index dc22931..8364b0f 100644 --- a/src/cljc/java_time/period.clj +++ b/src/cljc/java_time/period.clj @@ -1,38 +1,618 @@ -(ns cljc.java-time.period (:refer-clojure :exclude [abs get range format min max next name resolve short]) (:require [cljc.java-time.extn.calendar-awareness]) (:import [java.time Period])) -(def zero java.time.Period/ZERO) -(clojure.core/defn get-months {:arglists (quote (["java.time.Period"]))} (^java.lang.Integer [^java.time.Period this12932] (.getMonths this12932))) -(clojure.core/defn of-weeks {:arglists (quote (["int"]))} (^java.time.Period [^java.lang.Integer int12933] (java.time.Period/ofWeeks int12933))) -(clojure.core/defn of-days {:arglists (quote (["int"]))} (^java.time.Period [^java.lang.Integer int12934] (java.time.Period/ofDays int12934))) -(clojure.core/defn is-negative {:arglists (quote (["java.time.Period"]))} (^java.lang.Boolean [^java.time.Period this12935] (.isNegative this12935))) -(clojure.core/defn of {:arglists (quote (["int" "int" "int"]))} (^java.time.Period [^java.lang.Integer int12936 ^java.lang.Integer int12937 ^java.lang.Integer int12938] (java.time.Period/of int12936 int12937 int12938))) -(clojure.core/defn is-zero {:arglists (quote (["java.time.Period"]))} (^java.lang.Boolean [^java.time.Period this12939] (.isZero this12939))) -(clojure.core/defn multiplied-by {:arglists (quote (["java.time.Period" "int"]))} (^java.time.Period [^java.time.Period this12940 ^java.lang.Integer int12941] (.multipliedBy this12940 int12941))) -(clojure.core/defn get-units {:arglists (quote (["java.time.Period"]))} (^java.util.List [^java.time.Period this12942] (.getUnits this12942))) -(clojure.core/defn with-days {:arglists (quote (["java.time.Period" "int"]))} (^java.time.Period [^java.time.Period this12943 ^java.lang.Integer int12944] (.withDays this12943 int12944))) -(clojure.core/defn plus {:arglists (quote (["java.time.Period" "java.time.temporal.TemporalAmount"]))} (^java.time.Period [^java.time.Period this12945 ^java.time.temporal.TemporalAmount java-time-temporal-TemporalAmount12946] (.plus this12945 java-time-temporal-TemporalAmount12946))) -(clojure.core/defn of-months {:arglists (quote (["int"]))} (^java.time.Period [^java.lang.Integer int12947] (java.time.Period/ofMonths int12947))) -(clojure.core/defn to-string {:arglists (quote (["java.time.Period"]))} (^java.lang.String [^java.time.Period this12948] (.toString this12948))) -(clojure.core/defn plus-months {:arglists (quote (["java.time.Period" "long"]))} (^java.time.Period [^java.time.Period this12949 ^long long12950] (.plusMonths this12949 long12950))) -(clojure.core/defn minus-months {:arglists (quote (["java.time.Period" "long"]))} (^java.time.Period [^java.time.Period this12951 ^long long12952] (.minusMonths this12951 long12952))) -(clojure.core/defn minus {:arglists (quote (["java.time.Period" "java.time.temporal.TemporalAmount"]))} (^java.time.Period [^java.time.Period this12953 ^java.time.temporal.TemporalAmount java-time-temporal-TemporalAmount12954] (.minus this12953 java-time-temporal-TemporalAmount12954))) -(clojure.core/defn add-to {:arglists (quote (["java.time.Period" "java.time.temporal.Temporal"]))} (^java.time.temporal.Temporal [^java.time.Period this12955 ^java.time.temporal.Temporal java-time-temporal-Temporal12956] (.addTo this12955 java-time-temporal-Temporal12956))) -(clojure.core/defn to-total-months {:arglists (quote (["java.time.Period"]))} (^long [^java.time.Period this12957] (.toTotalMonths this12957))) -(clojure.core/defn plus-days {:arglists (quote (["java.time.Period" "long"]))} (^java.time.Period [^java.time.Period this12958 ^long long12959] (.plusDays this12958 long12959))) -(clojure.core/defn of-years {:arglists (quote (["int"]))} (^java.time.Period [^java.lang.Integer int12960] (java.time.Period/ofYears int12960))) -(clojure.core/defn get-days {:arglists (quote (["java.time.Period"]))} (^java.lang.Integer [^java.time.Period this12961] (.getDays this12961))) -(clojure.core/defn negated {:arglists (quote (["java.time.Period"]))} (^java.time.Period [^java.time.Period this12962] (.negated this12962))) -(clojure.core/defn get-years {:arglists (quote (["java.time.Period"]))} (^java.lang.Integer [^java.time.Period this12963] (.getYears this12963))) -(clojure.core/defn with-years {:arglists (quote (["java.time.Period" "int"]))} (^java.time.Period [^java.time.Period this12964 ^java.lang.Integer int12965] (.withYears this12964 int12965))) -(clojure.core/defn normalized {:arglists (quote (["java.time.Period"]))} (^java.time.Period [^java.time.Period this12966] (.normalized this12966))) -(clojure.core/defn with-months {:arglists (quote (["java.time.Period" "int"]))} (^java.time.Period [^java.time.Period this12967 ^java.lang.Integer int12968] (.withMonths this12967 int12968))) -(clojure.core/defn between {:arglists (quote (["java.time.LocalDate" "java.time.LocalDate"]))} (^java.time.Period [^java.time.LocalDate java-time-LocalDate12969 ^java.time.LocalDate java-time-LocalDate12970] (java.time.Period/between java-time-LocalDate12969 java-time-LocalDate12970))) -(clojure.core/defn from {:arglists (quote (["java.time.temporal.TemporalAmount"]))} (^java.time.Period [^java.time.temporal.TemporalAmount java-time-temporal-TemporalAmount12971] (java.time.Period/from java-time-temporal-TemporalAmount12971))) -(clojure.core/defn minus-years {:arglists (quote (["java.time.Period" "long"]))} (^java.time.Period [^java.time.Period this12972 ^long long12973] (.minusYears this12972 long12973))) -(clojure.core/defn get-chronology {:arglists (quote (["java.time.Period"]))} (^java.time.chrono.IsoChronology [^java.time.Period this12974] (.getChronology this12974))) -(clojure.core/defn parse {:arglists (quote (["java.lang.CharSequence"]))} (^java.time.Period [^java.lang.CharSequence java-lang-CharSequence12975] (java.time.Period/parse java-lang-CharSequence12975))) -(clojure.core/defn hash-code {:arglists (quote (["java.time.Period"]))} (^java.lang.Integer [^java.time.Period this12976] (.hashCode this12976))) -(clojure.core/defn subtract-from {:arglists (quote (["java.time.Period" "java.time.temporal.Temporal"]))} (^java.time.temporal.Temporal [^java.time.Period this12977 ^java.time.temporal.Temporal java-time-temporal-Temporal12978] (.subtractFrom this12977 java-time-temporal-Temporal12978))) -(clojure.core/defn get {:arglists (quote (["java.time.Period" "java.time.temporal.TemporalUnit"]))} (^long [^java.time.Period this12979 ^java.time.temporal.ChronoUnit java-time-temporal-TemporalUnit12980] (.get this12979 java-time-temporal-TemporalUnit12980))) -(clojure.core/defn equals {:arglists (quote (["java.time.Period" "java.lang.Object"]))} (^java.lang.Boolean [^java.time.Period this12981 ^java.lang.Object java-lang-Object12982] (.equals this12981 java-lang-Object12982))) -(clojure.core/defn plus-years {:arglists (quote (["java.time.Period" "long"]))} (^java.time.Period [^java.time.Period this12983 ^long long12984] (.plusYears this12983 long12984))) -(clojure.core/defn minus-days {:arglists (quote (["java.time.Period" "long"]))} (^java.time.Period [^java.time.Period this12985 ^long long12986] (.minusDays this12985 long12986))) +(ns cljc.java-time.period + (:refer-clojure :exclude + [abs get range format min max next name resolve short]) + (:require [cljc.java-time.extn.calendar-awareness]) + (:import [java.time Period])) + +(def zero "A constant for a period of zero." java.time.Period/ZERO) + +(defn get-months + "Gets the amount of months of this period. + + This returns the months unit. + + The months unit is not automatically normalized with the years unit. + This means that a period of \"15 months\" is different to a period + of \"1 year and 3 months\". + + @return the amount of months of this period, may be negative" + {:arglists (quote (["java.time.Period"]))} + (^java.lang.Integer [^java.time.Period this] (.getMonths this))) + +(defn of-weeks + "Obtains a {@code Period} representing a number of weeks. + + The resulting period will be day-based, with the amount of days + equal to the number of weeks multiplied by 7. + The years and months units will be zero. + + @param weeks the number of weeks, positive or negative + @return the period, with the input weeks converted to days, not null" + {:arglists (quote (["int"]))} + (^java.time.Period [^java.lang.Integer weeks] + (java.time.Period/ofWeeks weeks))) + +(defn of-days + "Obtains a {@code Period} representing a number of days. + + The resulting period will have the specified days. + The years and months units will be zero. + + @param days the number of days, positive or negative + @return the period of days, not null" + {:arglists (quote (["int"]))} + (^java.time.Period [^java.lang.Integer days] (java.time.Period/ofDays days))) + +(defn is-negative + "Checks if any of the three units of this period are negative. + + This checks whether the years, months or days units are less than zero. + + @return true if any unit of this period is negative" + {:arglists (quote (["java.time.Period"]))} + (^java.lang.Boolean [^java.time.Period this] (.isNegative this))) + +(defn of + "Obtains a {@code Period} representing a number of years, months and days. + + This creates an instance based on years, months and days. + + @param years the amount of years, may be negative + @param months the amount of months, may be negative + @param days the amount of days, may be negative + @return the period of years, months and days, not null" + {:arglists (quote (["int" "int" "int"]))} + (^java.time.Period + [^java.lang.Integer years ^java.lang.Integer months ^java.lang.Integer days] + (java.time.Period/of years months days))) + +(defn is-zero + "Checks if all three units of this period are zero. + + A zero period has the value zero for the years, months and days units. + + @return true if this period is zero-length" + {:arglists (quote (["java.time.Period"]))} + (^java.lang.Boolean [^java.time.Period this] (.isZero this))) + +(defn multiplied-by + "Returns a new instance with each element in this period multiplied + by the specified scalar. + + This returns a period with each of the years, months and days units + individually multiplied. + For example, a period of \"2 years, -3 months and 4 days\" multiplied by + 3 will return \"6 years, -9 months and 12 days\". + No normalization is performed. + + @param scalar the scalar to multiply by, not null + @return a {@code Period} based on this period with the amounts multiplied by the scalar, not null + @throws ArithmeticException if numeric overflow occurs" + {:arglists (quote (["java.time.Period" "int"]))} + (^java.time.Period [^java.time.Period this ^java.lang.Integer scalar] + (.multipliedBy this scalar))) + +(defn get-units + "Gets the set of units supported by this period. + + The supported units are {@link ChronoUnit#YEARS YEARS}, + {@link ChronoUnit#MONTHS MONTHS} and {@link ChronoUnit#DAYS DAYS}. + They are returned in the order years, months, days. + + This set can be used in conjunction with {@link #get(TemporalUnit)} + to access the entire state of the period. + + @return a list containing the years, months and days units, not null" + {:arglists (quote (["java.time.Period"]))} + (^java.util.List [^java.time.Period this] (.getUnits this))) + +(defn with-days + "Returns a copy of this period with the specified amount of days. + + This sets the amount of the days unit in a copy of this period. + The years and months units are unaffected. + + This instance is immutable and unaffected by this method call. + + @param days the days to represent, may be negative + @return a {@code Period} based on this period with the requested days, not null" + {:arglists (quote (["java.time.Period" "int"]))} + (^java.time.Period [^java.time.Period this ^java.lang.Integer days] + (.withDays this days))) + +(defn plus + "Returns a copy of this period with the specified period added. + + This operates separately on the years, months and days. + No normalization is performed. + + For example, \"1 year, 6 months and 3 days\" plus \"2 years, 2 months and 2 days\" + returns \"3 years, 8 months and 5 days\". + + The specified amount is typically an instance of {@code Period}. + Other types are interpreted using {@link Period#from(TemporalAmount)}. + + This instance is immutable and unaffected by this method call. + + @param amountToAdd the amount to add, not null + @return a {@code Period} based on this period with the requested period added, not null + @throws DateTimeException if the specified amount has a non-ISO chronology or + contains an invalid unit + @throws ArithmeticException if numeric overflow occurs" + {:arglists (quote (["java.time.Period" "java.time.temporal.TemporalAmount"]))} + (^java.time.Period + [^java.time.Period this ^java.time.temporal.TemporalAmount amount-to-add] + (.plus this amount-to-add))) + +(defn of-months + "Obtains a {@code Period} representing a number of months. + + The resulting period will have the specified months. + The years and days units will be zero. + + @param months the number of months, positive or negative + @return the period of months, not null" + {:arglists (quote (["int"]))} + (^java.time.Period [^java.lang.Integer months] + (java.time.Period/ofMonths months))) + +(defn to-string + "Outputs this period as a {@code String}, such as {@code P6Y3M1D}. + + The output will be in the ISO-8601 period format. + A zero period will be represented as zero days, 'P0D'. + + @return a string representation of this period, not null" + {:arglists (quote (["java.time.Period"]))} + (^java.lang.String [^java.time.Period this] (.toString this))) + +(defn plus-months + "Returns a copy of this period with the specified months added. + + This adds the amount to the months unit in a copy of this period. + The years and days units are unaffected. + For example, \"1 year, 6 months and 3 days\" plus 2 months returns \"1 year, 8 months and 3 days\". + + This instance is immutable and unaffected by this method call. + + @param monthsToAdd the months to add, positive or negative + @return a {@code Period} based on this period with the specified months added, not null + @throws ArithmeticException if numeric overflow occurs" + {:arglists (quote (["java.time.Period" "long"]))} + (^java.time.Period [^java.time.Period this ^long months-to-add] + (.plusMonths this months-to-add))) + +(defn minus-months + "Returns a copy of this period with the specified months subtracted. + + This subtracts the amount from the months unit in a copy of this period. + The years and days units are unaffected. + For example, \"1 year, 6 months and 3 days\" minus 2 months returns \"1 year, 4 months and 3 days\". + + This instance is immutable and unaffected by this method call. + + @param monthsToSubtract the years to subtract, positive or negative + @return a {@code Period} based on this period with the specified months subtracted, not null + @throws ArithmeticException if numeric overflow occurs" + {:arglists (quote (["java.time.Period" "long"]))} + (^java.time.Period [^java.time.Period this ^long months-to-subtract] + (.minusMonths this months-to-subtract))) + +(defn minus + "Returns a copy of this period with the specified period subtracted. + + This operates separately on the years, months and days. + No normalization is performed. + + For example, \"1 year, 6 months and 3 days\" minus \"2 years, 2 months and 2 days\" + returns \"-1 years, 4 months and 1 day\". + + The specified amount is typically an instance of {@code Period}. + Other types are interpreted using {@link Period#from(TemporalAmount)}. + + This instance is immutable and unaffected by this method call. + + @param amountToSubtract the amount to subtract, not null + @return a {@code Period} based on this period with the requested period subtracted, not null + @throws DateTimeException if the specified amount has a non-ISO chronology or + contains an invalid unit + @throws ArithmeticException if numeric overflow occurs" + {:arglists (quote (["java.time.Period" "java.time.temporal.TemporalAmount"]))} + (^java.time.Period + [^java.time.Period this + ^java.time.temporal.TemporalAmount amount-to-subtract] + (.minus this amount-to-subtract))) + +(defn add-to + "Adds this period to the specified temporal object. + + This returns a temporal object of the same observable type as the input + with this period added. + If the temporal has a chronology, it must be the ISO chronology. + + In most cases, it is clearer to reverse the calling pattern by using + {@link Temporal#plus(TemporalAmount)}. +
+   // these two lines are equivalent, but the second approach is recommended
+   dateTime = thisPeriod.addTo(dateTime);
+   dateTime = dateTime.plus(thisPeriod);
+ 
+ + The calculation operates as follows. + First, the chronology of the temporal is checked to ensure it is ISO chronology or null. + Second, if the months are zero, the years are added if non-zero, otherwise + the combination of years and months is added if non-zero. + Finally, any days are added. + + This approach ensures that a partial period can be added to a partial date. + For example, a period of years and/or months can be added to a {@code YearMonth}, + but a period including days cannot. + The approach also adds years and months together when necessary, which ensures + correct behaviour at the end of the month. + + This instance is immutable and unaffected by this method call. + + @param temporal the temporal object to adjust, not null + @return an object of the same type with the adjustment made, not null + @throws DateTimeException if unable to add + @throws ArithmeticException if numeric overflow occurs" + {:arglists (quote (["java.time.Period" "java.time.temporal.Temporal"]))} + (^java.time.temporal.Temporal + [^java.time.Period this ^java.time.temporal.Temporal temporal] + (.addTo this temporal))) + +(defn to-total-months + "Gets the total number of months in this period. + + This returns the total number of months in the period by multiplying the + number of years by 12 and adding the number of months. + + This instance is immutable and unaffected by this method call. + + @return the total number of months in the period, may be negative" + {:arglists (quote (["java.time.Period"]))} + (^long [^java.time.Period this] (.toTotalMonths this))) + +(defn plus-days + "Returns a copy of this period with the specified days added. + + This adds the amount to the days unit in a copy of this period. + The years and months units are unaffected. + For example, \"1 year, 6 months and 3 days\" plus 2 days returns \"1 year, 6 months and 5 days\". + + This instance is immutable and unaffected by this method call. + + @param daysToAdd the days to add, positive or negative + @return a {@code Period} based on this period with the specified days added, not null + @throws ArithmeticException if numeric overflow occurs" + {:arglists (quote (["java.time.Period" "long"]))} + (^java.time.Period [^java.time.Period this ^long days-to-add] + (.plusDays this days-to-add))) + +(defn of-years + "Obtains a {@code Period} representing a number of years. + + The resulting period will have the specified years. + The months and days units will be zero. + + @param years the number of years, positive or negative + @return the period of years, not null" + {:arglists (quote (["int"]))} + (^java.time.Period [^java.lang.Integer years] + (java.time.Period/ofYears years))) + +(defn get-days + "Gets the amount of days of this period. + + This returns the days unit. + + @return the amount of days of this period, may be negative" + {:arglists (quote (["java.time.Period"]))} + (^java.lang.Integer [^java.time.Period this] (.getDays this))) + +(defn negated + "Returns a new instance with each amount in this period negated. + + This returns a period with each of the years, months and days units + individually negated. + For example, a period of \"2 years, -3 months and 4 days\" will be + negated to \"-2 years, 3 months and -4 days\". + No normalization is performed. + + @return a {@code Period} based on this period with the amounts negated, not null + @throws ArithmeticException if numeric overflow occurs, which only happens if + one of the units has the value {@code Long.MIN_VALUE}" + {:arglists (quote (["java.time.Period"]))} + (^java.time.Period [^java.time.Period this] (.negated this))) + +(defn get-years + "Gets the amount of years of this period. + + This returns the years unit. + + The months unit is not automatically normalized with the years unit. + This means that a period of \"15 months\" is different to a period + of \"1 year and 3 months\". + + @return the amount of years of this period, may be negative" + {:arglists (quote (["java.time.Period"]))} + (^java.lang.Integer [^java.time.Period this] (.getYears this))) + +(defn with-years + "Returns a copy of this period with the specified amount of years. + + This sets the amount of the years unit in a copy of this period. + The months and days units are unaffected. + + The months unit is not automatically normalized with the years unit. + This means that a period of \"15 months\" is different to a period + of \"1 year and 3 months\". + + This instance is immutable and unaffected by this method call. + + @param years the years to represent, may be negative + @return a {@code Period} based on this period with the requested years, not null" + {:arglists (quote (["java.time.Period" "int"]))} + (^java.time.Period [^java.time.Period this ^java.lang.Integer years] + (.withYears this years))) + +(defn normalized + "Returns a copy of this period with the years and months normalized. + + This normalizes the years and months units, leaving the days unit unchanged. + The months unit is adjusted to have an absolute value less than 11, + with the years unit being adjusted to compensate. For example, a period of + \"1 Year and 15 months\" will be normalized to \"2 years and 3 months\". + + The sign of the years and months units will be the same after normalization. + For example, a period of \"1 year and -25 months\" will be normalized to + \"-1 year and -1 month\". + + This instance is immutable and unaffected by this method call. + + @return a {@code Period} based on this period with excess months normalized to years, not null + @throws ArithmeticException if numeric overflow occurs" + {:arglists (quote (["java.time.Period"]))} + (^java.time.Period [^java.time.Period this] (.normalized this))) + +(defn with-months + "Returns a copy of this period with the specified amount of months. + + This sets the amount of the months unit in a copy of this period. + The years and days units are unaffected. + + The months unit is not automatically normalized with the years unit. + This means that a period of \"15 months\" is different to a period + of \"1 year and 3 months\". + + This instance is immutable and unaffected by this method call. + + @param months the months to represent, may be negative + @return a {@code Period} based on this period with the requested months, not null" + {:arglists (quote (["java.time.Period" "int"]))} + (^java.time.Period [^java.time.Period this ^java.lang.Integer months] + (.withMonths this months))) + +(defn between + "Obtains a {@code Period} consisting of the number of years, months, + and days between two dates. + + The start date is included, but the end date is not. + The period is calculated by removing complete months, then calculating + the remaining number of days, adjusting to ensure that both have the same sign. + The number of months is then split into years and months based on a 12 month year. + A month is considered if the end day-of-month is greater than or equal to the start day-of-month. + For example, from {@code 2010-01-15} to {@code 2011-03-18} is one year, two months and three days. + + The result of this method can be a negative period if the end is before the start. + The negative sign will be the same in each of year, month and day. + + @param startDateInclusive the start date, inclusive, not null + @param endDateExclusive the end date, exclusive, not null + @return the period between this date and the end date, not null + @see ChronoLocalDate#until(ChronoLocalDate)" + {:arglists (quote (["java.time.LocalDate" "java.time.LocalDate"]))} + (^java.time.Period + [^java.time.LocalDate start-date-inclusive + ^java.time.LocalDate end-date-exclusive] + (java.time.Period/between start-date-inclusive end-date-exclusive))) + +(defn from + "Obtains an instance of {@code Period} from a temporal amount. + + This obtains a period based on the specified amount. + A {@code TemporalAmount} represents an amount of time, which may be + date-based or time-based, which this factory extracts to a {@code Period}. + + The conversion loops around the set of units from the amount and uses + the {@link ChronoUnit#YEARS YEARS}, {@link ChronoUnit#MONTHS MONTHS} + and {@link ChronoUnit#DAYS DAYS} units to create a period. + If any other units are found then an exception is thrown. + + If the amount is a {@code ChronoPeriod} then it must use the ISO chronology. + + @param amount the temporal amount to convert, not null + @return the equivalent period, not null + @throws DateTimeException if unable to convert to a {@code Period} + @throws ArithmeticException if the amount of years, months or days exceeds an int" + {:arglists (quote (["java.time.temporal.TemporalAmount"]))} + (^java.time.Period [^java.time.temporal.TemporalAmount amount] + (java.time.Period/from amount))) + +(defn minus-years + "Returns a copy of this period with the specified years subtracted. + + This subtracts the amount from the years unit in a copy of this period. + The months and days units are unaffected. + For example, \"1 year, 6 months and 3 days\" minus 2 years returns \"-1 years, 6 months and 3 days\". + + This instance is immutable and unaffected by this method call. + + @param yearsToSubtract the years to subtract, positive or negative + @return a {@code Period} based on this period with the specified years subtracted, not null + @throws ArithmeticException if numeric overflow occurs" + {:arglists (quote (["java.time.Period" "long"]))} + (^java.time.Period [^java.time.Period this ^long years-to-subtract] + (.minusYears this years-to-subtract))) + +(defn get-chronology + "Gets the chronology of this period, which is the ISO calendar system. + + The {@code Chronology} represents the calendar system in use. + The ISO-8601 calendar system is the modern civil calendar system used today + in most of the world. It is equivalent to the proleptic Gregorian calendar + system, in which today's rules for leap years are applied for all time. + + @return the ISO chronology, not null" + {:arglists (quote (["java.time.Period"]))} + (^java.time.chrono.IsoChronology [^java.time.Period this] + (.getChronology this))) + +(defn parse + "Obtains a {@code Period} from a text string such as {@code PnYnMnD}. + + This will parse the string produced by {@code toString()} which is + based on the ISO-8601 period formats {@code PnYnMnD} and {@code PnW}. + + The string starts with an optional sign, denoted by the ASCII negative + or positive symbol. If negative, the whole period is negated. + The ASCII letter \"P\" is next in upper or lower case. + There are then four sections, each consisting of a number and a suffix. + At least one of the four sections must be present. + The sections have suffixes in ASCII of \"Y\", \"M\", \"W\" and \"D\" for + years, months, weeks and days, accepted in upper or lower case. + The suffixes must occur in order. + The number part of each section must consist of ASCII digits. + The number may be prefixed by the ASCII negative or positive symbol. + The number must parse to an {@code int}. + + The leading plus/minus sign, and negative values for other units are + not part of the ISO-8601 standard. In addition, ISO-8601 does not + permit mixing between the {@code PnYnMnD} and {@code PnW} formats. + Any week-based input is multiplied by 7 and treated as a number of days. + + For example, the following are valid inputs: +
+   \"P2Y\"             -- Period.ofYears(2)
+   \"P3M\"             -- Period.ofMonths(3)
+   \"P4W\"             -- Period.ofWeeks(4)
+   \"P5D\"             -- Period.ofDays(5)
+   \"P1Y2M3D\"         -- Period.of(1, 2, 3)
+   \"P1Y2M3W4D\"       -- Period.of(1, 2, 25)
+   \"P-1Y2M\"          -- Period.of(-1, 2, 0)
+   \"-P1Y2M\"          -- Period.of(-1, -2, 0)
+ 
+ + @param text the text to parse, not null + @return the parsed period, not null + @throws DateTimeParseException if the text cannot be parsed to a period" + {:arglists (quote (["java.lang.CharSequence"]))} + (^java.time.Period [^java.lang.CharSequence text] + (java.time.Period/parse text))) + +(defn hash-code + "A hash code for this period. + + @return a suitable hash code" + {:arglists (quote (["java.time.Period"]))} + (^java.lang.Integer [^java.time.Period this] (.hashCode this))) + +(defn subtract-from + "Subtracts this period from the specified temporal object. + + This returns a temporal object of the same observable type as the input + with this period subtracted. + If the temporal has a chronology, it must be the ISO chronology. + + In most cases, it is clearer to reverse the calling pattern by using + {@link Temporal#minus(TemporalAmount)}. +
+   // these two lines are equivalent, but the second approach is recommended
+   dateTime = thisPeriod.subtractFrom(dateTime);
+   dateTime = dateTime.minus(thisPeriod);
+ 
+ + The calculation operates as follows. + First, the chronology of the temporal is checked to ensure it is ISO chronology or null. + Second, if the months are zero, the years are subtracted if non-zero, otherwise + the combination of years and months is subtracted if non-zero. + Finally, any days are subtracted. + + This approach ensures that a partial period can be subtracted from a partial date. + For example, a period of years and/or months can be subtracted from a {@code YearMonth}, + but a period including days cannot. + The approach also subtracts years and months together when necessary, which ensures + correct behaviour at the end of the month. + + This instance is immutable and unaffected by this method call. + + @param temporal the temporal object to adjust, not null + @return an object of the same type with the adjustment made, not null + @throws DateTimeException if unable to subtract + @throws ArithmeticException if numeric overflow occurs" + {:arglists (quote (["java.time.Period" "java.time.temporal.Temporal"]))} + (^java.time.temporal.Temporal + [^java.time.Period this ^java.time.temporal.Temporal temporal] + (.subtractFrom this temporal))) + +(defn get + "Gets the value of the requested unit. + + This returns a value for each of the three supported units, + {@link ChronoUnit#YEARS YEARS}, {@link ChronoUnit#MONTHS MONTHS} and + {@link ChronoUnit#DAYS DAYS}. + All other units throw an exception. + + @param unit the {@code TemporalUnit} for which to return the value + @return the long value of the unit + @throws DateTimeException if the unit is not supported + @throws UnsupportedTemporalTypeException if the unit is not supported" + {:arglists (quote (["java.time.Period" "java.time.temporal.TemporalUnit"]))} + (^long [^java.time.Period this ^java.time.temporal.ChronoUnit unit] + (.get this unit))) + +(defn equals + "Checks if this period is equal to another period. + + The comparison is based on the type {@code Period} and each of the three amounts. + To be equal, the years, months and days units must be individually equal. + Note that this means that a period of \"15 Months\" is not equal to a period + of \"1 Year and 3 Months\". + + @param obj the object to check, null returns false + @return true if this is equal to the other period" + {:arglists (quote (["java.time.Period" "java.lang.Object"]))} + (^java.lang.Boolean [^java.time.Period this ^java.lang.Object obj] + (.equals this obj))) + +(defn plus-years + "Returns a copy of this period with the specified years added. + + This adds the amount to the years unit in a copy of this period. + The months and days units are unaffected. + For example, \"1 year, 6 months and 3 days\" plus 2 years returns \"3 years, 6 months and 3 days\". + + This instance is immutable and unaffected by this method call. + + @param yearsToAdd the years to add, positive or negative + @return a {@code Period} based on this period with the specified years added, not null + @throws ArithmeticException if numeric overflow occurs" + {:arglists (quote (["java.time.Period" "long"]))} + (^java.time.Period [^java.time.Period this ^long years-to-add] + (.plusYears this years-to-add))) + +(defn minus-days + "Returns a copy of this period with the specified days subtracted. + + This subtracts the amount from the days unit in a copy of this period. + The years and months units are unaffected. + For example, \"1 year, 6 months and 3 days\" minus 2 days returns \"1 year, 6 months and 1 day\". + + This instance is immutable and unaffected by this method call. + + @param daysToSubtract the months to subtract, positive or negative + @return a {@code Period} based on this period with the specified days subtracted, not null + @throws ArithmeticException if numeric overflow occurs" + {:arglists (quote (["java.time.Period" "long"]))} + (^java.time.Period [^java.time.Period this ^long days-to-subtract] + (.minusDays this days-to-subtract))) diff --git a/src/cljc/java_time/period.cljs b/src/cljc/java_time/period.cljs index 66f8afd..4f02a6e 100644 --- a/src/cljc/java_time/period.cljs +++ b/src/cljc/java_time/period.cljs @@ -1,38 +1,615 @@ -(ns cljc.java-time.period (:refer-clojure :exclude [abs get range format min max next name resolve short]) (:require [cljc.java-time.extn.calendar-awareness] [goog.object] [java.time :refer [Period]])) -(def zero (goog.object/get java.time.Period "ZERO")) -(clojure.core/defn get-months {:arglists (quote (["java.time.Period"]))} (^int [^js/JSJoda.Period this12987] (.months this12987))) -(clojure.core/defn of-weeks {:arglists (quote (["int"]))} (^js/JSJoda.Period [^int int12988] (js-invoke java.time.Period "ofWeeks" int12988))) -(clojure.core/defn of-days {:arglists (quote (["int"]))} (^js/JSJoda.Period [^int int12989] (js-invoke java.time.Period "ofDays" int12989))) -(clojure.core/defn is-negative {:arglists (quote (["java.time.Period"]))} (^boolean [^js/JSJoda.Period this12990] (.isNegative this12990))) -(clojure.core/defn of {:arglists (quote (["int" "int" "int"]))} (^js/JSJoda.Period [^int int12991 ^int int12992 ^int int12993] (js-invoke java.time.Period "of" int12991 int12992 int12993))) -(clojure.core/defn is-zero {:arglists (quote (["java.time.Period"]))} (^boolean [^js/JSJoda.Period this12994] (.isZero this12994))) -(clojure.core/defn multiplied-by {:arglists (quote (["java.time.Period" "int"]))} (^js/JSJoda.Period [^js/JSJoda.Period this12995 ^int int12996] (.multipliedBy this12995 int12996))) -(clojure.core/defn get-units {:arglists (quote (["java.time.Period"]))} (^java.util.List [^js/JSJoda.Period this12997] (.units this12997))) -(clojure.core/defn with-days {:arglists (quote (["java.time.Period" "int"]))} (^js/JSJoda.Period [^js/JSJoda.Period this12998 ^int int12999] (.withDays this12998 int12999))) -(clojure.core/defn plus {:arglists (quote (["java.time.Period" "java.time.temporal.TemporalAmount"]))} (^js/JSJoda.Period [^js/JSJoda.Period this13000 ^js/JSJoda.TemporalAmount java-time-temporal-TemporalAmount13001] (.plus this13000 java-time-temporal-TemporalAmount13001))) -(clojure.core/defn of-months {:arglists (quote (["int"]))} (^js/JSJoda.Period [^int int13002] (js-invoke java.time.Period "ofMonths" int13002))) -(clojure.core/defn to-string {:arglists (quote (["java.time.Period"]))} (^java.lang.String [^js/JSJoda.Period this13003] (.toString this13003))) -(clojure.core/defn plus-months {:arglists (quote (["java.time.Period" "long"]))} (^js/JSJoda.Period [^js/JSJoda.Period this13004 ^long long13005] (.plusMonths this13004 long13005))) -(clojure.core/defn minus-months {:arglists (quote (["java.time.Period" "long"]))} (^js/JSJoda.Period [^js/JSJoda.Period this13006 ^long long13007] (.minusMonths this13006 long13007))) -(clojure.core/defn minus {:arglists (quote (["java.time.Period" "java.time.temporal.TemporalAmount"]))} (^js/JSJoda.Period [^js/JSJoda.Period this13008 ^js/JSJoda.TemporalAmount java-time-temporal-TemporalAmount13009] (.minus this13008 java-time-temporal-TemporalAmount13009))) -(clojure.core/defn add-to {:arglists (quote (["java.time.Period" "java.time.temporal.Temporal"]))} (^js/JSJoda.Temporal [^js/JSJoda.Period this13010 ^js/JSJoda.Temporal java-time-temporal-Temporal13011] (.addTo this13010 java-time-temporal-Temporal13011))) -(clojure.core/defn to-total-months {:arglists (quote (["java.time.Period"]))} (^long [^js/JSJoda.Period this13012] (.toTotalMonths this13012))) -(clojure.core/defn plus-days {:arglists (quote (["java.time.Period" "long"]))} (^js/JSJoda.Period [^js/JSJoda.Period this13013 ^long long13014] (.plusDays this13013 long13014))) -(clojure.core/defn of-years {:arglists (quote (["int"]))} (^js/JSJoda.Period [^int int13015] (js-invoke java.time.Period "ofYears" int13015))) -(clojure.core/defn get-days {:arglists (quote (["java.time.Period"]))} (^int [^js/JSJoda.Period this13016] (.days this13016))) -(clojure.core/defn negated {:arglists (quote (["java.time.Period"]))} (^js/JSJoda.Period [^js/JSJoda.Period this13017] (.negated this13017))) -(clojure.core/defn get-years {:arglists (quote (["java.time.Period"]))} (^int [^js/JSJoda.Period this13018] (.years this13018))) -(clojure.core/defn with-years {:arglists (quote (["java.time.Period" "int"]))} (^js/JSJoda.Period [^js/JSJoda.Period this13019 ^int int13020] (.withYears this13019 int13020))) -(clojure.core/defn normalized {:arglists (quote (["java.time.Period"]))} (^js/JSJoda.Period [^js/JSJoda.Period this13021] (.normalized this13021))) -(clojure.core/defn with-months {:arglists (quote (["java.time.Period" "int"]))} (^js/JSJoda.Period [^js/JSJoda.Period this13022 ^int int13023] (.withMonths this13022 int13023))) -(clojure.core/defn between {:arglists (quote (["java.time.LocalDate" "java.time.LocalDate"]))} (^js/JSJoda.Period [^js/JSJoda.LocalDate java-time-LocalDate13024 ^js/JSJoda.LocalDate java-time-LocalDate13025] (js-invoke java.time.Period "between" java-time-LocalDate13024 java-time-LocalDate13025))) -(clojure.core/defn from {:arglists (quote (["java.time.temporal.TemporalAmount"]))} (^js/JSJoda.Period [^js/JSJoda.TemporalAmount java-time-temporal-TemporalAmount13026] (js-invoke java.time.Period "from" java-time-temporal-TemporalAmount13026))) -(clojure.core/defn minus-years {:arglists (quote (["java.time.Period" "long"]))} (^js/JSJoda.Period [^js/JSJoda.Period this13027 ^long long13028] (.minusYears this13027 long13028))) -(clojure.core/defn get-chronology {:arglists (quote (["java.time.Period"]))} (^js/JSJoda.IsoChronology [^js/JSJoda.Period this13029] (.chronology this13029))) -(clojure.core/defn parse {:arglists (quote (["java.lang.CharSequence"]))} (^js/JSJoda.Period [^java.lang.CharSequence java-lang-CharSequence13030] (js-invoke java.time.Period "parse" java-lang-CharSequence13030))) -(clojure.core/defn hash-code {:arglists (quote (["java.time.Period"]))} (^int [^js/JSJoda.Period this13031] (.hashCode this13031))) -(clojure.core/defn subtract-from {:arglists (quote (["java.time.Period" "java.time.temporal.Temporal"]))} (^js/JSJoda.Temporal [^js/JSJoda.Period this13032 ^js/JSJoda.Temporal java-time-temporal-Temporal13033] (.subtractFrom this13032 java-time-temporal-Temporal13033))) -(clojure.core/defn get {:arglists (quote (["java.time.Period" "java.time.temporal.TemporalUnit"]))} (^long [^js/JSJoda.Period this13034 ^js/JSJoda.TemporalUnit java-time-temporal-TemporalUnit13035] (.get this13034 java-time-temporal-TemporalUnit13035))) -(clojure.core/defn equals {:arglists (quote (["java.time.Period" "java.lang.Object"]))} (^boolean [^js/JSJoda.Period this13036 ^java.lang.Object java-lang-Object13037] (.equals this13036 java-lang-Object13037))) -(clojure.core/defn plus-years {:arglists (quote (["java.time.Period" "long"]))} (^js/JSJoda.Period [^js/JSJoda.Period this13038 ^long long13039] (.plusYears this13038 long13039))) -(clojure.core/defn minus-days {:arglists (quote (["java.time.Period" "long"]))} (^js/JSJoda.Period [^js/JSJoda.Period this13040 ^long long13041] (.minusDays this13040 long13041))) +(ns cljc.java-time.period + (:refer-clojure :exclude + [abs get range format min max next name resolve short]) + (:require [cljc.java-time.extn.calendar-awareness] + [goog.object] + [java.time :refer [Period]])) + +(def zero + "A constant for a period of zero." + (goog.object/get java.time.Period "ZERO")) + +(defn get-months + "Gets the amount of months of this period. + + This returns the months unit. + + The months unit is not automatically normalized with the years unit. + This means that a period of \"15 months\" is different to a period + of \"1 year and 3 months\". + + @return the amount of months of this period, may be negative" + {:arglists (quote (["java.time.Period"]))} + (^int [^js/JSJoda.Period this] (.months this))) + +(defn of-weeks + "Obtains a {@code Period} representing a number of weeks. + + The resulting period will be day-based, with the amount of days + equal to the number of weeks multiplied by 7. + The years and months units will be zero. + + @param weeks the number of weeks, positive or negative + @return the period, with the input weeks converted to days, not null" + {:arglists (quote (["int"]))} + (^js/JSJoda.Period [^int weeks] (js-invoke java.time.Period "ofWeeks" weeks))) + +(defn of-days + "Obtains a {@code Period} representing a number of days. + + The resulting period will have the specified days. + The years and months units will be zero. + + @param days the number of days, positive or negative + @return the period of days, not null" + {:arglists (quote (["int"]))} + (^js/JSJoda.Period [^int days] (js-invoke java.time.Period "ofDays" days))) + +(defn is-negative + "Checks if any of the three units of this period are negative. + + This checks whether the years, months or days units are less than zero. + + @return true if any unit of this period is negative" + {:arglists (quote (["java.time.Period"]))} + (^boolean [^js/JSJoda.Period this] (.isNegative this))) + +(defn of + "Obtains a {@code Period} representing a number of years, months and days. + + This creates an instance based on years, months and days. + + @param years the amount of years, may be negative + @param months the amount of months, may be negative + @param days the amount of days, may be negative + @return the period of years, months and days, not null" + {:arglists (quote (["int" "int" "int"]))} + (^js/JSJoda.Period [^int years ^int months ^int days] + (js-invoke java.time.Period "of" years months days))) + +(defn is-zero + "Checks if all three units of this period are zero. + + A zero period has the value zero for the years, months and days units. + + @return true if this period is zero-length" + {:arglists (quote (["java.time.Period"]))} + (^boolean [^js/JSJoda.Period this] (.isZero this))) + +(defn multiplied-by + "Returns a new instance with each element in this period multiplied + by the specified scalar. + + This returns a period with each of the years, months and days units + individually multiplied. + For example, a period of \"2 years, -3 months and 4 days\" multiplied by + 3 will return \"6 years, -9 months and 12 days\". + No normalization is performed. + + @param scalar the scalar to multiply by, not null + @return a {@code Period} based on this period with the amounts multiplied by the scalar, not null + @throws ArithmeticException if numeric overflow occurs" + {:arglists (quote (["java.time.Period" "int"]))} + (^js/JSJoda.Period [^js/JSJoda.Period this ^int scalar] + (.multipliedBy this scalar))) + +(defn get-units + "Gets the set of units supported by this period. + + The supported units are {@link ChronoUnit#YEARS YEARS}, + {@link ChronoUnit#MONTHS MONTHS} and {@link ChronoUnit#DAYS DAYS}. + They are returned in the order years, months, days. + + This set can be used in conjunction with {@link #get(TemporalUnit)} + to access the entire state of the period. + + @return a list containing the years, months and days units, not null" + {:arglists (quote (["java.time.Period"]))} + (^java.util.List [^js/JSJoda.Period this] (.units this))) + +(defn with-days + "Returns a copy of this period with the specified amount of days. + + This sets the amount of the days unit in a copy of this period. + The years and months units are unaffected. + + This instance is immutable and unaffected by this method call. + + @param days the days to represent, may be negative + @return a {@code Period} based on this period with the requested days, not null" + {:arglists (quote (["java.time.Period" "int"]))} + (^js/JSJoda.Period [^js/JSJoda.Period this ^int days] (.withDays this days))) + +(defn plus + "Returns a copy of this period with the specified period added. + + This operates separately on the years, months and days. + No normalization is performed. + + For example, \"1 year, 6 months and 3 days\" plus \"2 years, 2 months and 2 days\" + returns \"3 years, 8 months and 5 days\". + + The specified amount is typically an instance of {@code Period}. + Other types are interpreted using {@link Period#from(TemporalAmount)}. + + This instance is immutable and unaffected by this method call. + + @param amountToAdd the amount to add, not null + @return a {@code Period} based on this period with the requested period added, not null + @throws DateTimeException if the specified amount has a non-ISO chronology or + contains an invalid unit + @throws ArithmeticException if numeric overflow occurs" + {:arglists (quote (["java.time.Period" "java.time.temporal.TemporalAmount"]))} + (^js/JSJoda.Period + [^js/JSJoda.Period this ^js/JSJoda.TemporalAmount amount-to-add] + (.plus this amount-to-add))) + +(defn of-months + "Obtains a {@code Period} representing a number of months. + + The resulting period will have the specified months. + The years and days units will be zero. + + @param months the number of months, positive or negative + @return the period of months, not null" + {:arglists (quote (["int"]))} + (^js/JSJoda.Period [^int months] + (js-invoke java.time.Period "ofMonths" months))) + +(defn to-string + "Outputs this period as a {@code String}, such as {@code P6Y3M1D}. + + The output will be in the ISO-8601 period format. + A zero period will be represented as zero days, 'P0D'. + + @return a string representation of this period, not null" + {:arglists (quote (["java.time.Period"]))} + (^java.lang.String [^js/JSJoda.Period this] (.toString this))) + +(defn plus-months + "Returns a copy of this period with the specified months added. + + This adds the amount to the months unit in a copy of this period. + The years and days units are unaffected. + For example, \"1 year, 6 months and 3 days\" plus 2 months returns \"1 year, 8 months and 3 days\". + + This instance is immutable and unaffected by this method call. + + @param monthsToAdd the months to add, positive or negative + @return a {@code Period} based on this period with the specified months added, not null + @throws ArithmeticException if numeric overflow occurs" + {:arglists (quote (["java.time.Period" "long"]))} + (^js/JSJoda.Period [^js/JSJoda.Period this ^long months-to-add] + (.plusMonths this months-to-add))) + +(defn minus-months + "Returns a copy of this period with the specified months subtracted. + + This subtracts the amount from the months unit in a copy of this period. + The years and days units are unaffected. + For example, \"1 year, 6 months and 3 days\" minus 2 months returns \"1 year, 4 months and 3 days\". + + This instance is immutable and unaffected by this method call. + + @param monthsToSubtract the years to subtract, positive or negative + @return a {@code Period} based on this period with the specified months subtracted, not null + @throws ArithmeticException if numeric overflow occurs" + {:arglists (quote (["java.time.Period" "long"]))} + (^js/JSJoda.Period [^js/JSJoda.Period this ^long months-to-subtract] + (.minusMonths this months-to-subtract))) + +(defn minus + "Returns a copy of this period with the specified period subtracted. + + This operates separately on the years, months and days. + No normalization is performed. + + For example, \"1 year, 6 months and 3 days\" minus \"2 years, 2 months and 2 days\" + returns \"-1 years, 4 months and 1 day\". + + The specified amount is typically an instance of {@code Period}. + Other types are interpreted using {@link Period#from(TemporalAmount)}. + + This instance is immutable and unaffected by this method call. + + @param amountToSubtract the amount to subtract, not null + @return a {@code Period} based on this period with the requested period subtracted, not null + @throws DateTimeException if the specified amount has a non-ISO chronology or + contains an invalid unit + @throws ArithmeticException if numeric overflow occurs" + {:arglists (quote (["java.time.Period" "java.time.temporal.TemporalAmount"]))} + (^js/JSJoda.Period + [^js/JSJoda.Period this ^js/JSJoda.TemporalAmount amount-to-subtract] + (.minus this amount-to-subtract))) + +(defn add-to + "Adds this period to the specified temporal object. + + This returns a temporal object of the same observable type as the input + with this period added. + If the temporal has a chronology, it must be the ISO chronology. + + In most cases, it is clearer to reverse the calling pattern by using + {@link Temporal#plus(TemporalAmount)}. +
+   // these two lines are equivalent, but the second approach is recommended
+   dateTime = thisPeriod.addTo(dateTime);
+   dateTime = dateTime.plus(thisPeriod);
+ 
+ + The calculation operates as follows. + First, the chronology of the temporal is checked to ensure it is ISO chronology or null. + Second, if the months are zero, the years are added if non-zero, otherwise + the combination of years and months is added if non-zero. + Finally, any days are added. + + This approach ensures that a partial period can be added to a partial date. + For example, a period of years and/or months can be added to a {@code YearMonth}, + but a period including days cannot. + The approach also adds years and months together when necessary, which ensures + correct behaviour at the end of the month. + + This instance is immutable and unaffected by this method call. + + @param temporal the temporal object to adjust, not null + @return an object of the same type with the adjustment made, not null + @throws DateTimeException if unable to add + @throws ArithmeticException if numeric overflow occurs" + {:arglists (quote (["java.time.Period" "java.time.temporal.Temporal"]))} + (^js/JSJoda.Temporal [^js/JSJoda.Period this ^js/JSJoda.Temporal temporal] + (.addTo this temporal))) + +(defn to-total-months + "Gets the total number of months in this period. + + This returns the total number of months in the period by multiplying the + number of years by 12 and adding the number of months. + + This instance is immutable and unaffected by this method call. + + @return the total number of months in the period, may be negative" + {:arglists (quote (["java.time.Period"]))} + (^long [^js/JSJoda.Period this] (.toTotalMonths this))) + +(defn plus-days + "Returns a copy of this period with the specified days added. + + This adds the amount to the days unit in a copy of this period. + The years and months units are unaffected. + For example, \"1 year, 6 months and 3 days\" plus 2 days returns \"1 year, 6 months and 5 days\". + + This instance is immutable and unaffected by this method call. + + @param daysToAdd the days to add, positive or negative + @return a {@code Period} based on this period with the specified days added, not null + @throws ArithmeticException if numeric overflow occurs" + {:arglists (quote (["java.time.Period" "long"]))} + (^js/JSJoda.Period [^js/JSJoda.Period this ^long days-to-add] + (.plusDays this days-to-add))) + +(defn of-years + "Obtains a {@code Period} representing a number of years. + + The resulting period will have the specified years. + The months and days units will be zero. + + @param years the number of years, positive or negative + @return the period of years, not null" + {:arglists (quote (["int"]))} + (^js/JSJoda.Period [^int years] (js-invoke java.time.Period "ofYears" years))) + +(defn get-days + "Gets the amount of days of this period. + + This returns the days unit. + + @return the amount of days of this period, may be negative" + {:arglists (quote (["java.time.Period"]))} + (^int [^js/JSJoda.Period this] (.days this))) + +(defn negated + "Returns a new instance with each amount in this period negated. + + This returns a period with each of the years, months and days units + individually negated. + For example, a period of \"2 years, -3 months and 4 days\" will be + negated to \"-2 years, 3 months and -4 days\". + No normalization is performed. + + @return a {@code Period} based on this period with the amounts negated, not null + @throws ArithmeticException if numeric overflow occurs, which only happens if + one of the units has the value {@code Long.MIN_VALUE}" + {:arglists (quote (["java.time.Period"]))} + (^js/JSJoda.Period [^js/JSJoda.Period this] (.negated this))) + +(defn get-years + "Gets the amount of years of this period. + + This returns the years unit. + + The months unit is not automatically normalized with the years unit. + This means that a period of \"15 months\" is different to a period + of \"1 year and 3 months\". + + @return the amount of years of this period, may be negative" + {:arglists (quote (["java.time.Period"]))} + (^int [^js/JSJoda.Period this] (.years this))) + +(defn with-years + "Returns a copy of this period with the specified amount of years. + + This sets the amount of the years unit in a copy of this period. + The months and days units are unaffected. + + The months unit is not automatically normalized with the years unit. + This means that a period of \"15 months\" is different to a period + of \"1 year and 3 months\". + + This instance is immutable and unaffected by this method call. + + @param years the years to represent, may be negative + @return a {@code Period} based on this period with the requested years, not null" + {:arglists (quote (["java.time.Period" "int"]))} + (^js/JSJoda.Period [^js/JSJoda.Period this ^int years] + (.withYears this years))) + +(defn normalized + "Returns a copy of this period with the years and months normalized. + + This normalizes the years and months units, leaving the days unit unchanged. + The months unit is adjusted to have an absolute value less than 11, + with the years unit being adjusted to compensate. For example, a period of + \"1 Year and 15 months\" will be normalized to \"2 years and 3 months\". + + The sign of the years and months units will be the same after normalization. + For example, a period of \"1 year and -25 months\" will be normalized to + \"-1 year and -1 month\". + + This instance is immutable and unaffected by this method call. + + @return a {@code Period} based on this period with excess months normalized to years, not null + @throws ArithmeticException if numeric overflow occurs" + {:arglists (quote (["java.time.Period"]))} + (^js/JSJoda.Period [^js/JSJoda.Period this] (.normalized this))) + +(defn with-months + "Returns a copy of this period with the specified amount of months. + + This sets the amount of the months unit in a copy of this period. + The years and days units are unaffected. + + The months unit is not automatically normalized with the years unit. + This means that a period of \"15 months\" is different to a period + of \"1 year and 3 months\". + + This instance is immutable and unaffected by this method call. + + @param months the months to represent, may be negative + @return a {@code Period} based on this period with the requested months, not null" + {:arglists (quote (["java.time.Period" "int"]))} + (^js/JSJoda.Period [^js/JSJoda.Period this ^int months] + (.withMonths this months))) + +(defn between + "Obtains a {@code Period} consisting of the number of years, months, + and days between two dates. + + The start date is included, but the end date is not. + The period is calculated by removing complete months, then calculating + the remaining number of days, adjusting to ensure that both have the same sign. + The number of months is then split into years and months based on a 12 month year. + A month is considered if the end day-of-month is greater than or equal to the start day-of-month. + For example, from {@code 2010-01-15} to {@code 2011-03-18} is one year, two months and three days. + + The result of this method can be a negative period if the end is before the start. + The negative sign will be the same in each of year, month and day. + + @param startDateInclusive the start date, inclusive, not null + @param endDateExclusive the end date, exclusive, not null + @return the period between this date and the end date, not null + @see ChronoLocalDate#until(ChronoLocalDate)" + {:arglists (quote (["java.time.LocalDate" "java.time.LocalDate"]))} + (^js/JSJoda.Period + [^js/JSJoda.LocalDate start-date-inclusive + ^js/JSJoda.LocalDate end-date-exclusive] + (js-invoke java.time.Period + "between" + start-date-inclusive + end-date-exclusive))) + +(defn from + "Obtains an instance of {@code Period} from a temporal amount. + + This obtains a period based on the specified amount. + A {@code TemporalAmount} represents an amount of time, which may be + date-based or time-based, which this factory extracts to a {@code Period}. + + The conversion loops around the set of units from the amount and uses + the {@link ChronoUnit#YEARS YEARS}, {@link ChronoUnit#MONTHS MONTHS} + and {@link ChronoUnit#DAYS DAYS} units to create a period. + If any other units are found then an exception is thrown. + + If the amount is a {@code ChronoPeriod} then it must use the ISO chronology. + + @param amount the temporal amount to convert, not null + @return the equivalent period, not null + @throws DateTimeException if unable to convert to a {@code Period} + @throws ArithmeticException if the amount of years, months or days exceeds an int" + {:arglists (quote (["java.time.temporal.TemporalAmount"]))} + (^js/JSJoda.Period [^js/JSJoda.TemporalAmount amount] + (js-invoke java.time.Period "from" amount))) + +(defn minus-years + "Returns a copy of this period with the specified years subtracted. + + This subtracts the amount from the years unit in a copy of this period. + The months and days units are unaffected. + For example, \"1 year, 6 months and 3 days\" minus 2 years returns \"-1 years, 6 months and 3 days\". + + This instance is immutable and unaffected by this method call. + + @param yearsToSubtract the years to subtract, positive or negative + @return a {@code Period} based on this period with the specified years subtracted, not null + @throws ArithmeticException if numeric overflow occurs" + {:arglists (quote (["java.time.Period" "long"]))} + (^js/JSJoda.Period [^js/JSJoda.Period this ^long years-to-subtract] + (.minusYears this years-to-subtract))) + +(defn get-chronology + "Gets the chronology of this period, which is the ISO calendar system. + + The {@code Chronology} represents the calendar system in use. + The ISO-8601 calendar system is the modern civil calendar system used today + in most of the world. It is equivalent to the proleptic Gregorian calendar + system, in which today's rules for leap years are applied for all time. + + @return the ISO chronology, not null" + {:arglists (quote (["java.time.Period"]))} + (^js/JSJoda.IsoChronology [^js/JSJoda.Period this] (.chronology this))) + +(defn parse + "Obtains a {@code Period} from a text string such as {@code PnYnMnD}. + + This will parse the string produced by {@code toString()} which is + based on the ISO-8601 period formats {@code PnYnMnD} and {@code PnW}. + + The string starts with an optional sign, denoted by the ASCII negative + or positive symbol. If negative, the whole period is negated. + The ASCII letter \"P\" is next in upper or lower case. + There are then four sections, each consisting of a number and a suffix. + At least one of the four sections must be present. + The sections have suffixes in ASCII of \"Y\", \"M\", \"W\" and \"D\" for + years, months, weeks and days, accepted in upper or lower case. + The suffixes must occur in order. + The number part of each section must consist of ASCII digits. + The number may be prefixed by the ASCII negative or positive symbol. + The number must parse to an {@code int}. + + The leading plus/minus sign, and negative values for other units are + not part of the ISO-8601 standard. In addition, ISO-8601 does not + permit mixing between the {@code PnYnMnD} and {@code PnW} formats. + Any week-based input is multiplied by 7 and treated as a number of days. + + For example, the following are valid inputs: +
+   \"P2Y\"             -- Period.ofYears(2)
+   \"P3M\"             -- Period.ofMonths(3)
+   \"P4W\"             -- Period.ofWeeks(4)
+   \"P5D\"             -- Period.ofDays(5)
+   \"P1Y2M3D\"         -- Period.of(1, 2, 3)
+   \"P1Y2M3W4D\"       -- Period.of(1, 2, 25)
+   \"P-1Y2M\"          -- Period.of(-1, 2, 0)
+   \"-P1Y2M\"          -- Period.of(-1, -2, 0)
+ 
+ + @param text the text to parse, not null + @return the parsed period, not null + @throws DateTimeParseException if the text cannot be parsed to a period" + {:arglists (quote (["java.lang.CharSequence"]))} + (^js/JSJoda.Period [^java.lang.CharSequence text] + (js-invoke java.time.Period "parse" text))) + +(defn hash-code + "A hash code for this period. + + @return a suitable hash code" + {:arglists (quote (["java.time.Period"]))} + (^int [^js/JSJoda.Period this] (.hashCode this))) + +(defn subtract-from + "Subtracts this period from the specified temporal object. + + This returns a temporal object of the same observable type as the input + with this period subtracted. + If the temporal has a chronology, it must be the ISO chronology. + + In most cases, it is clearer to reverse the calling pattern by using + {@link Temporal#minus(TemporalAmount)}. +
+   // these two lines are equivalent, but the second approach is recommended
+   dateTime = thisPeriod.subtractFrom(dateTime);
+   dateTime = dateTime.minus(thisPeriod);
+ 
+ + The calculation operates as follows. + First, the chronology of the temporal is checked to ensure it is ISO chronology or null. + Second, if the months are zero, the years are subtracted if non-zero, otherwise + the combination of years and months is subtracted if non-zero. + Finally, any days are subtracted. + + This approach ensures that a partial period can be subtracted from a partial date. + For example, a period of years and/or months can be subtracted from a {@code YearMonth}, + but a period including days cannot. + The approach also subtracts years and months together when necessary, which ensures + correct behaviour at the end of the month. + + This instance is immutable and unaffected by this method call. + + @param temporal the temporal object to adjust, not null + @return an object of the same type with the adjustment made, not null + @throws DateTimeException if unable to subtract + @throws ArithmeticException if numeric overflow occurs" + {:arglists (quote (["java.time.Period" "java.time.temporal.Temporal"]))} + (^js/JSJoda.Temporal [^js/JSJoda.Period this ^js/JSJoda.Temporal temporal] + (.subtractFrom this temporal))) + +(defn get + "Gets the value of the requested unit. + + This returns a value for each of the three supported units, + {@link ChronoUnit#YEARS YEARS}, {@link ChronoUnit#MONTHS MONTHS} and + {@link ChronoUnit#DAYS DAYS}. + All other units throw an exception. + + @param unit the {@code TemporalUnit} for which to return the value + @return the long value of the unit + @throws DateTimeException if the unit is not supported + @throws UnsupportedTemporalTypeException if the unit is not supported" + {:arglists (quote (["java.time.Period" "java.time.temporal.TemporalUnit"]))} + (^long [^js/JSJoda.Period this ^js/JSJoda.TemporalUnit unit] + (.get this unit))) + +(defn equals + "Checks if this period is equal to another period. + + The comparison is based on the type {@code Period} and each of the three amounts. + To be equal, the years, months and days units must be individually equal. + Note that this means that a period of \"15 Months\" is not equal to a period + of \"1 Year and 3 Months\". + + @param obj the object to check, null returns false + @return true if this is equal to the other period" + {:arglists (quote (["java.time.Period" "java.lang.Object"]))} + (^boolean [^js/JSJoda.Period this ^java.lang.Object obj] (.equals this obj))) + +(defn plus-years + "Returns a copy of this period with the specified years added. + + This adds the amount to the years unit in a copy of this period. + The months and days units are unaffected. + For example, \"1 year, 6 months and 3 days\" plus 2 years returns \"3 years, 6 months and 3 days\". + + This instance is immutable and unaffected by this method call. + + @param yearsToAdd the years to add, positive or negative + @return a {@code Period} based on this period with the specified years added, not null + @throws ArithmeticException if numeric overflow occurs" + {:arglists (quote (["java.time.Period" "long"]))} + (^js/JSJoda.Period [^js/JSJoda.Period this ^long years-to-add] + (.plusYears this years-to-add))) + +(defn minus-days + "Returns a copy of this period with the specified days subtracted. + + This subtracts the amount from the days unit in a copy of this period. + The years and months units are unaffected. + For example, \"1 year, 6 months and 3 days\" minus 2 days returns \"1 year, 6 months and 1 day\". + + This instance is immutable and unaffected by this method call. + + @param daysToSubtract the months to subtract, positive or negative + @return a {@code Period} based on this period with the specified days subtracted, not null + @throws ArithmeticException if numeric overflow occurs" + {:arglists (quote (["java.time.Period" "long"]))} + (^js/JSJoda.Period [^js/JSJoda.Period this ^long days-to-subtract] + (.minusDays this days-to-subtract))) diff --git a/src/cljc/java_time/temporal/chrono_field.clj b/src/cljc/java_time/temporal/chrono_field.clj index 817ef37..6e10edf 100644 --- a/src/cljc/java_time/temporal/chrono_field.clj +++ b/src/cljc/java_time/temporal/chrono_field.clj @@ -1,53 +1,780 @@ -(ns cljc.java-time.temporal.chrono-field (:refer-clojure :exclude [abs get range format min max next name resolve short]) (:require [cljc.java-time.extn.calendar-awareness]) (:import [java.time.temporal ChronoField])) -(def milli-of-second java.time.temporal.ChronoField/MILLI_OF_SECOND) -(def year-of-era java.time.temporal.ChronoField/YEAR_OF_ERA) -(def clock-hour-of-day java.time.temporal.ChronoField/CLOCK_HOUR_OF_DAY) -(def era java.time.temporal.ChronoField/ERA) -(def instant-seconds java.time.temporal.ChronoField/INSTANT_SECONDS) -(def ampm-of-day java.time.temporal.ChronoField/AMPM_OF_DAY) -(def offset-seconds java.time.temporal.ChronoField/OFFSET_SECONDS) -(def nano-of-second java.time.temporal.ChronoField/NANO_OF_SECOND) -(def nano-of-day java.time.temporal.ChronoField/NANO_OF_DAY) -(def aligned-day-of-week-in-month java.time.temporal.ChronoField/ALIGNED_DAY_OF_WEEK_IN_MONTH) -(def month-of-year java.time.temporal.ChronoField/MONTH_OF_YEAR) -(def hour-of-ampm java.time.temporal.ChronoField/HOUR_OF_AMPM) -(def year java.time.temporal.ChronoField/YEAR) -(def micro-of-second java.time.temporal.ChronoField/MICRO_OF_SECOND) -(def aligned-week-of-year java.time.temporal.ChronoField/ALIGNED_WEEK_OF_YEAR) -(def proleptic-month java.time.temporal.ChronoField/PROLEPTIC_MONTH) -(def day-of-month java.time.temporal.ChronoField/DAY_OF_MONTH) -(def second-of-minute java.time.temporal.ChronoField/SECOND_OF_MINUTE) -(def second-of-day java.time.temporal.ChronoField/SECOND_OF_DAY) -(def epoch-day java.time.temporal.ChronoField/EPOCH_DAY) -(def day-of-year java.time.temporal.ChronoField/DAY_OF_YEAR) -(def aligned-week-of-month java.time.temporal.ChronoField/ALIGNED_WEEK_OF_MONTH) -(def day-of-week java.time.temporal.ChronoField/DAY_OF_WEEK) -(def clock-hour-of-ampm java.time.temporal.ChronoField/CLOCK_HOUR_OF_AMPM) -(def minute-of-day java.time.temporal.ChronoField/MINUTE_OF_DAY) -(def aligned-day-of-week-in-year java.time.temporal.ChronoField/ALIGNED_DAY_OF_WEEK_IN_YEAR) -(def minute-of-hour java.time.temporal.ChronoField/MINUTE_OF_HOUR) -(def hour-of-day java.time.temporal.ChronoField/HOUR_OF_DAY) -(def milli-of-day java.time.temporal.ChronoField/MILLI_OF_DAY) -(def micro-of-day java.time.temporal.ChronoField/MICRO_OF_DAY) -(clojure.core/defn get-range-unit {:arglists (quote (["java.time.temporal.ChronoField"]))} (^java.time.temporal.ChronoUnit [^java.time.temporal.ChronoField this15620] (.getRangeUnit this15620))) -(clojure.core/defn range {:arglists (quote (["java.time.temporal.ChronoField"]))} (^java.time.temporal.ValueRange [^java.time.temporal.ChronoField this15621] (.range this15621))) -(clojure.core/defn values {:arglists (quote ([]))} (^"java.lang.Class" [] (java.time.temporal.ChronoField/values))) -(clojure.core/defn value-of {:arglists (quote (["java.lang.String"] ["java.lang.Class" "java.lang.String"]))} (^java.time.temporal.ChronoField [^java.lang.String java-lang-String15622] (java.time.temporal.ChronoField/valueOf java-lang-String15622)) (^java.lang.Enum [^java.lang.Class java-lang-Class15623 ^java.lang.String java-lang-String15624] (java.time.temporal.ChronoField/valueOf java-lang-Class15623 java-lang-String15624))) -(clojure.core/defn resolve {:arglists (quote (["java.time.temporal.ChronoField" "java.util.Map" "java.time.temporal.TemporalAccessor" "java.time.format.ResolverStyle"]))} (^java.time.temporal.TemporalAccessor [^java.time.temporal.ChronoField this15625 ^java.util.Map java-util-Map15626 ^java.time.temporal.TemporalAccessor java-time-temporal-TemporalAccessor15627 ^java.time.format.ResolverStyle java-time-format-ResolverStyle15628] (.resolve this15625 java-util-Map15626 java-time-temporal-TemporalAccessor15627 java-time-format-ResolverStyle15628))) -(clojure.core/defn ordinal {:arglists (quote (["java.time.temporal.ChronoField"]))} (^java.lang.Integer [^java.time.temporal.ChronoField this15629] (.ordinal this15629))) -(clojure.core/defn check-valid-int-value {:arglists (quote (["java.time.temporal.ChronoField" "long"]))} (^java.lang.Integer [^java.time.temporal.ChronoField this15630 ^long long15631] (.checkValidIntValue this15630 long15631))) -(clojure.core/defn get-base-unit {:arglists (quote (["java.time.temporal.ChronoField"]))} (^java.time.temporal.ChronoUnit [^java.time.temporal.ChronoField this15632] (.getBaseUnit this15632))) -(clojure.core/defn to-string {:arglists (quote (["java.time.temporal.ChronoField"]))} (^java.lang.String [^java.time.temporal.ChronoField this15633] (.toString this15633))) -(clojure.core/defn is-date-based {:arglists (quote (["java.time.temporal.ChronoField"]))} (^java.lang.Boolean [^java.time.temporal.ChronoField this15634] (.isDateBased this15634))) -(clojure.core/defn get-display-name {:arglists (quote (["java.time.temporal.ChronoField" "java.util.Locale"]))} (^java.lang.String [^java.time.temporal.ChronoField this15635 ^java.util.Locale java-util-Locale15636] (.getDisplayName this15635 java-util-Locale15636))) -(clojure.core/defn name {:arglists (quote (["java.time.temporal.ChronoField"]))} (^java.lang.String [^java.time.temporal.ChronoField this15637] (.name this15637))) -(clojure.core/defn is-supported-by {:arglists (quote (["java.time.temporal.ChronoField" "java.time.temporal.TemporalAccessor"]))} (^java.lang.Boolean [^java.time.temporal.ChronoField this15638 ^java.time.temporal.TemporalAccessor java-time-temporal-TemporalAccessor15639] (.isSupportedBy this15638 java-time-temporal-TemporalAccessor15639))) -(clojure.core/defn range-refined-by {:arglists (quote (["java.time.temporal.ChronoField" "java.time.temporal.TemporalAccessor"]))} (^java.time.temporal.ValueRange [^java.time.temporal.ChronoField this15640 ^java.time.temporal.TemporalAccessor java-time-temporal-TemporalAccessor15641] (.rangeRefinedBy this15640 java-time-temporal-TemporalAccessor15641))) -(clojure.core/defn get-declaring-class {:arglists (quote (["java.time.temporal.ChronoField"]))} (^java.lang.Class [^java.time.temporal.ChronoField this15642] (.getDeclaringClass this15642))) -(clojure.core/defn hash-code {:arglists (quote (["java.time.temporal.ChronoField"]))} (^java.lang.Integer [^java.time.temporal.ChronoField this15643] (.hashCode this15643))) -(clojure.core/defn adjust-into {:arglists (quote (["java.time.temporal.ChronoField" "java.time.temporal.Temporal" "long"]))} (^java.time.temporal.Temporal [^java.time.temporal.ChronoField this15644 ^java.time.temporal.Temporal java-time-temporal-Temporal15645 ^long long15646] (.adjustInto this15644 java-time-temporal-Temporal15645 long15646))) -(clojure.core/defn get-from {:arglists (quote (["java.time.temporal.ChronoField" "java.time.temporal.TemporalAccessor"]))} (^long [^java.time.temporal.ChronoField this15647 ^java.time.temporal.TemporalAccessor java-time-temporal-TemporalAccessor15648] (.getFrom this15647 java-time-temporal-TemporalAccessor15648))) -(clojure.core/defn compare-to {:arglists (quote (["java.time.temporal.ChronoField" "java.lang.Enum"]))} (^java.lang.Integer [^java.time.temporal.ChronoField this15649 ^java.lang.Enum java-lang-Enum15650] (.compareTo this15649 java-lang-Enum15650))) -(clojure.core/defn equals {:arglists (quote (["java.time.temporal.ChronoField" "java.lang.Object"]))} (^java.lang.Boolean [^java.time.temporal.ChronoField this15651 ^java.lang.Object java-lang-Object15652] (.equals this15651 java-lang-Object15652))) -(clojure.core/defn is-time-based {:arglists (quote (["java.time.temporal.ChronoField"]))} (^java.lang.Boolean [^java.time.temporal.ChronoField this15653] (.isTimeBased this15653))) -(clojure.core/defn check-valid-value {:arglists (quote (["java.time.temporal.ChronoField" "long"]))} (^long [^java.time.temporal.ChronoField this15654 ^long long15655] (.checkValidValue this15654 long15655))) +(ns cljc.java-time.temporal.chrono-field + (:refer-clojure :exclude + [abs get range format min max next name resolve short]) + (:require [cljc.java-time.extn.calendar-awareness]) + (:import [java.time.temporal ChronoField])) + +(def milli-of-second + "The milli-of-second. + + This counts the millisecond within the second, from 0 to 999. + This field has the same meaning for all calendar systems. + + This field is used to represent the milli-of-second handling any fraction of the second. + Implementations of {@code TemporalAccessor} should provide a value for this field if + they can return a value for {@link #SECOND_OF_MINUTE}, {@link #SECOND_OF_DAY} or + {@link #INSTANT_SECONDS} filling unknown precision with zero. + + When this field is used for setting a value, it should behave in the same way as + setting {@link #NANO_OF_SECOND} with the value multiplied by 1,000,000. + + When parsing this field it behaves equivalent to the following: + The value is validated in strict and smart mode but not in lenient mode. + The field is resolved in combination with {@code MICRO_OF_SECOND} to produce + {@code NANO_OF_SECOND}." + java.time.temporal.ChronoField/MILLI_OF_SECOND) + +(def year-of-era + "The year within the era. + + This represents the concept of the year within the era. + This field is typically used with {@link #ERA}. + + The standard mental model for a date is based on three concepts - year, month and day. + These map onto the {@code YEAR}, {@code MONTH_OF_YEAR} and {@code DAY_OF_MONTH} fields. + Note that there is no reference to eras. + The full model for a date requires four concepts - era, year, month and day. These map onto + the {@code ERA}, {@code YEAR_OF_ERA}, {@code MONTH_OF_YEAR} and {@code DAY_OF_MONTH} fields. + Whether this field or {@code YEAR} is used depends on which mental model is being used. + See {@link ChronoLocalDate} for more discussion on this topic. + + In the default ISO calendar system, there are two eras defined, 'BCE' and 'CE'. + The era 'CE' is the one currently in use and year-of-era runs from 1 to the maximum value. + The era 'BCE' is the previous era, and the year-of-era runs backwards. + + For example, subtracting a year each time yield the following:
+ - year-proleptic 2 = 'CE' year-of-era 2
+ - year-proleptic 1 = 'CE' year-of-era 1
+ - year-proleptic 0 = 'BCE' year-of-era 1
+ - year-proleptic -1 = 'BCE' year-of-era 2
+ + Note that the ISO-8601 standard does not actually define eras. + Note also that the ISO eras do not align with the well-known AD/BC eras due to the + change between the Julian and Gregorian calendar systems. + + Non-ISO calendar systems should implement this field using the most recognized + year-of-era value for users of the calendar system. + Since most calendar systems have only two eras, the year-of-era numbering approach + will typically be the same as that used by the ISO calendar system. + The year-of-era value should typically always be positive, however this is not required." + java.time.temporal.ChronoField/YEAR_OF_ERA) + +(def clock-hour-of-day + "The clock-hour-of-day. + + This counts the hour within the AM/PM, from 1 to 24. + This is the hour that would be observed on a 24-hour analog wall clock. + This field has the same meaning for all calendar systems. + + When parsing this field it behaves equivalent to the following: + The value is validated from 1 to 24 in strict mode and from + 0 to 24 in smart mode. In lenient mode the value is not validated. + The field is converted to an {@code HOUR_OF_DAY} with the same value, + unless the value is 24, in which case it is converted to 0." + java.time.temporal.ChronoField/CLOCK_HOUR_OF_DAY) + +(def era + "The era. + + This represents the concept of the era, which is the largest division of the time-line. + This field is typically used with {@link #YEAR_OF_ERA}. + + In the default ISO calendar system, there are two eras defined, 'BCE' and 'CE'. + The era 'CE' is the one currently in use and year-of-era runs from 1 to the maximum value. + The era 'BCE' is the previous era, and the year-of-era runs backwards. + See {@link #YEAR_OF_ERA} for a full example. + + Non-ISO calendar systems should implement this field to define eras. + The value of the era that was active on 1970-01-01 (ISO) must be assigned the value 1. + Earlier eras must have sequentially smaller values. + Later eras must have sequentially larger values," + java.time.temporal.ChronoField/ERA) + +(def instant-seconds + "The instant epoch-seconds. + + This represents the concept of the sequential count of seconds where + 1970-01-01T00:00Z (ISO) is zero. + This field may be used with {@link #NANO_OF_SECOND} to represent the fraction of the second. + + An {@link Instant} represents an instantaneous point on the time-line. + On their own, an instant has insufficient information to allow a local date-time to be obtained. + Only when paired with an offset or time-zone can the local date or time be calculated. + + This field is strictly defined to have the same meaning in all calendar systems. + This is necessary to ensure interoperation between calendars." + java.time.temporal.ChronoField/INSTANT_SECONDS) + +(def ampm-of-day + "The am-pm-of-day. + + This counts the AM/PM within the day, from 0 (AM) to 1 (PM). + This field has the same meaning for all calendar systems. + + When parsing this field it behaves equivalent to the following: + The value is validated from 0 to 1 in strict and smart mode. + In lenient mode the value is not validated. It is combined with + {@code HOUR_OF_AMPM} to form {@code HOUR_OF_DAY} by multiplying + the {AMPM_OF_DAY} value by 12." + java.time.temporal.ChronoField/AMPM_OF_DAY) + +(def offset-seconds + "The offset from UTC/Greenwich. + + This represents the concept of the offset in seconds of local time from UTC/Greenwich. + + A {@link ZoneOffset} represents the period of time that local time differs from UTC/Greenwich. + This is usually a fixed number of hours and minutes. + It is equivalent to the {@link ZoneOffset#getTotalSeconds() total amount} of the offset in seconds. + For example, during the winter Paris has an offset of {@code +01:00}, which is 3600 seconds. + + This field is strictly defined to have the same meaning in all calendar systems. + This is necessary to ensure interoperation between calendars." + java.time.temporal.ChronoField/OFFSET_SECONDS) + +(def nano-of-second + "The nano-of-second. + + This counts the nanosecond within the second, from 0 to 999,999,999. + This field has the same meaning for all calendar systems. + + This field is used to represent the nano-of-second handling any fraction of the second. + Implementations of {@code TemporalAccessor} should provide a value for this field if + they can return a value for {@link #SECOND_OF_MINUTE}, {@link #SECOND_OF_DAY} or + {@link #INSTANT_SECONDS} filling unknown precision with zero. + + When this field is used for setting a value, it should set as much precision as the + object stores, using integer division to remove excess precision. + For example, if the {@code TemporalAccessor} stores time to millisecond precision, + then the nano-of-second must be divided by 1,000,000 before replacing the milli-of-second. + + When parsing this field it behaves equivalent to the following: + The value is validated in strict and smart mode but not in lenient mode. + The field is resolved in combination with {@code MILLI_OF_SECOND} and {@code MICRO_OF_SECOND}." + java.time.temporal.ChronoField/NANO_OF_SECOND) + +(def nano-of-day + "The nano-of-day. + + This counts the nanosecond within the day, from 0 to (24 * 60 * 60 * 1,000,000,000) - 1. + This field has the same meaning for all calendar systems. + + This field is used to represent the nano-of-day handling any fraction of the second. + Implementations of {@code TemporalAccessor} should provide a value for this field if + they can return a value for {@link #SECOND_OF_DAY} filling unknown precision with zero. + + When parsing this field it behaves equivalent to the following: + The value is validated in strict and smart mode but not in lenient mode. + The value is split to form {@code NANO_OF_SECOND}, {@code SECOND_OF_MINUTE}, + {@code MINUTE_OF_HOUR} and {@code HOUR_OF_DAY} fields." + java.time.temporal.ChronoField/NANO_OF_DAY) + +(def aligned-day-of-week-in-month + "The aligned day-of-week within a month. + + This represents concept of the count of days within the period of a week + where the weeks are aligned to the start of the month. + This field is typically used with {@link #ALIGNED_WEEK_OF_MONTH}. + + For example, in a calendar systems with a seven day week, the first aligned-week-of-month + starts on day-of-month 1, the second aligned-week starts on day-of-month 8, and so on. + Within each of these aligned-weeks, the days are numbered from 1 to 7 and returned + as the value of this field. + As such, day-of-month 1 to 7 will have aligned-day-of-week values from 1 to 7. + And day-of-month 8 to 14 will repeat this with aligned-day-of-week values from 1 to 7. + + Calendar systems that do not have a seven day week should typically implement this + field in the same way, but using the alternate week length." + java.time.temporal.ChronoField/ALIGNED_DAY_OF_WEEK_IN_MONTH) + +(def month-of-year + "The month-of-year, such as March. + + This represents the concept of the month within the year. + In the default ISO calendar system, this has values from January (1) to December (12). + + Non-ISO calendar systems should implement this field using the most recognized + month-of-year values for users of the calendar system. + Normally, this is a count of months starting from 1." + java.time.temporal.ChronoField/MONTH_OF_YEAR) + +(def hour-of-ampm + "The hour-of-am-pm. + + This counts the hour within the AM/PM, from 0 to 11. + This is the hour that would be observed on a standard 12-hour digital clock. + This field has the same meaning for all calendar systems. + + When parsing this field it behaves equivalent to the following: + The value is validated from 0 to 11 in strict and smart mode. + In lenient mode the value is not validated. It is combined with + {@code AMPM_OF_DAY} to form {@code HOUR_OF_DAY} by multiplying + the {AMPM_OF_DAY} value by 12." + java.time.temporal.ChronoField/HOUR_OF_AMPM) + +(def year + "The proleptic year, such as 2012. + + This represents the concept of the year, counting sequentially and using negative numbers. + The proleptic year is not interpreted in terms of the era. + See {@link #YEAR_OF_ERA} for an example showing the mapping from proleptic year to year-of-era. + + The standard mental model for a date is based on three concepts - year, month and day. + These map onto the {@code YEAR}, {@code MONTH_OF_YEAR} and {@code DAY_OF_MONTH} fields. + Note that there is no reference to eras. + The full model for a date requires four concepts - era, year, month and day. These map onto + the {@code ERA}, {@code YEAR_OF_ERA}, {@code MONTH_OF_YEAR} and {@code DAY_OF_MONTH} fields. + Whether this field or {@code YEAR_OF_ERA} is used depends on which mental model is being used. + See {@link ChronoLocalDate} for more discussion on this topic. + + Non-ISO calendar systems should implement this field as follows. + If the calendar system has only two eras, before and after a fixed date, then the + proleptic-year value must be the same as the year-of-era value for the later era, + and increasingly negative for the earlier era. + If the calendar system has more than two eras, then the proleptic-year value may be + defined with any appropriate value, although defining it to be the same as ISO may be + the best option." + java.time.temporal.ChronoField/YEAR) + +(def micro-of-second + "The micro-of-second. + + This counts the microsecond within the second, from 0 to 999,999. + This field has the same meaning for all calendar systems. + + This field is used to represent the micro-of-second handling any fraction of the second. + Implementations of {@code TemporalAccessor} should provide a value for this field if + they can return a value for {@link #SECOND_OF_MINUTE}, {@link #SECOND_OF_DAY} or + {@link #INSTANT_SECONDS} filling unknown precision with zero. + + When this field is used for setting a value, it should behave in the same way as + setting {@link #NANO_OF_SECOND} with the value multiplied by 1,000. + + When parsing this field it behaves equivalent to the following: + The value is validated in strict and smart mode but not in lenient mode. + The field is resolved in combination with {@code MILLI_OF_SECOND} to produce + {@code NANO_OF_SECOND}." + java.time.temporal.ChronoField/MICRO_OF_SECOND) + +(def aligned-week-of-year + "The aligned week within a year. + + This represents concept of the count of weeks within the period of a year + where the weeks are aligned to the start of the year. + This field is typically used with {@link #ALIGNED_DAY_OF_WEEK_IN_YEAR}. + + For example, in a calendar systems with a seven day week, the first aligned-week-of-year + starts on day-of-year 1, the second aligned-week starts on day-of-year 8, and so on. + Thus, day-of-year values 1 to 7 are in aligned-week 1, while day-of-year values + 8 to 14 are in aligned-week 2, and so on. + + Calendar systems that do not have a seven day week should typically implement this + field in the same way, but using the alternate week length." + java.time.temporal.ChronoField/ALIGNED_WEEK_OF_YEAR) + +(def proleptic-month + "The proleptic-month based, counting months sequentially from year 0. + + This field is the sequential count of months where the first month + in proleptic-year zero has the value zero. + Later months have increasingly larger values. + Earlier months have increasingly small values. + There are no gaps or breaks in the sequence of months. + Note that this uses the local time-line, ignoring offset and time-zone. + + In the default ISO calendar system, June 2012 would have the value + {@code (2012 * 12 + 6 - 1)}. This field is primarily for internal use. + + Non-ISO calendar systems must implement this field as per the definition above. + It is just a simple zero-based count of elapsed months from the start of proleptic-year 0. + All calendar systems with a full proleptic-year definition will have a year zero. + If the calendar system has a minimum year that excludes year zero, then one must + be extrapolated in order for this method to be defined." + java.time.temporal.ChronoField/PROLEPTIC_MONTH) + +(def day-of-month + "The day-of-month. + + This represents the concept of the day within the month. + In the default ISO calendar system, this has values from 1 to 31 in most months. + April, June, September, November have days from 1 to 30, while February has days + from 1 to 28, or 29 in a leap year. + + Non-ISO calendar systems should implement this field using the most recognized + day-of-month values for users of the calendar system. + Normally, this is a count of days from 1 to the length of the month." + java.time.temporal.ChronoField/DAY_OF_MONTH) + +(def second-of-minute + "The second-of-minute. + + This counts the second within the minute, from 0 to 59. + This field has the same meaning for all calendar systems. + + When parsing this field it behaves equivalent to the following: + The value is validated in strict and smart mode but not in lenient mode." + java.time.temporal.ChronoField/SECOND_OF_MINUTE) + +(def second-of-day + "The second-of-day. + + This counts the second within the day, from 0 to (24 * 60 * 60) - 1. + This field has the same meaning for all calendar systems. + + When parsing this field it behaves equivalent to the following: + The value is validated in strict and smart mode but not in lenient mode. + The value is split to form {@code SECOND_OF_MINUTE}, {@code MINUTE_OF_HOUR} + and {@code HOUR_OF_DAY} fields." + java.time.temporal.ChronoField/SECOND_OF_DAY) + +(def epoch-day + "The epoch-day, based on the Java epoch of 1970-01-01 (ISO). + + This field is the sequential count of days where 1970-01-01 (ISO) is zero. + Note that this uses the local time-line, ignoring offset and time-zone. + + This field is strictly defined to have the same meaning in all calendar systems. + This is necessary to ensure interoperation between calendars." + java.time.temporal.ChronoField/EPOCH_DAY) + +(def day-of-year + "The day-of-year. + + This represents the concept of the day within the year. + In the default ISO calendar system, this has values from 1 to 365 in standard + years and 1 to 366 in leap years. + + Non-ISO calendar systems should implement this field using the most recognized + day-of-year values for users of the calendar system. + Normally, this is a count of days from 1 to the length of the year. + + Note that a non-ISO calendar system may have year numbering system that changes + at a different point to the natural reset in the month numbering. An example + of this is the Japanese calendar system where a change of era, which resets + the year number to 1, can happen on any date. The era and year reset also cause + the day-of-year to be reset to 1, but not the month-of-year or day-of-month." + java.time.temporal.ChronoField/DAY_OF_YEAR) + +(def aligned-week-of-month + "The aligned week within a month. + + This represents concept of the count of weeks within the period of a month + where the weeks are aligned to the start of the month. + This field is typically used with {@link #ALIGNED_DAY_OF_WEEK_IN_MONTH}. + + For example, in a calendar systems with a seven day week, the first aligned-week-of-month + starts on day-of-month 1, the second aligned-week starts on day-of-month 8, and so on. + Thus, day-of-month values 1 to 7 are in aligned-week 1, while day-of-month values + 8 to 14 are in aligned-week 2, and so on. + + Calendar systems that do not have a seven day week should typically implement this + field in the same way, but using the alternate week length." + java.time.temporal.ChronoField/ALIGNED_WEEK_OF_MONTH) + +(def day-of-week + "The day-of-week, such as Tuesday. + + This represents the standard concept of the day of the week. + In the default ISO calendar system, this has values from Monday (1) to Sunday (7). + The {@link DayOfWeek} class can be used to interpret the result. + + Most non-ISO calendar systems also define a seven day week that aligns with ISO. + Those calendar systems must also use the same numbering system, from Monday (1) to + Sunday (7), which allows {@code DayOfWeek} to be used. + + Calendar systems that do not have a standard seven day week should implement this field + if they have a similar concept of named or numbered days within a period similar + to a week. It is recommended that the numbering starts from 1." + java.time.temporal.ChronoField/DAY_OF_WEEK) + +(def clock-hour-of-ampm + "The clock-hour-of-am-pm. + + This counts the hour within the AM/PM, from 1 to 12. + This is the hour that would be observed on a standard 12-hour analog wall clock. + This field has the same meaning for all calendar systems. + + When parsing this field it behaves equivalent to the following: + The value is validated from 1 to 12 in strict mode and from + 0 to 12 in smart mode. In lenient mode the value is not validated. + The field is converted to an {@code HOUR_OF_AMPM} with the same value, + unless the value is 12, in which case it is converted to 0." + java.time.temporal.ChronoField/CLOCK_HOUR_OF_AMPM) + +(def minute-of-day + "The minute-of-day. + + This counts the minute within the day, from 0 to (24 * 60) - 1. + This field has the same meaning for all calendar systems. + + When parsing this field it behaves equivalent to the following: + The value is validated in strict and smart mode but not in lenient mode. + The value is split to form {@code MINUTE_OF_HOUR} and {@code HOUR_OF_DAY} fields." + java.time.temporal.ChronoField/MINUTE_OF_DAY) + +(def aligned-day-of-week-in-year + "The aligned day-of-week within a year. + + This represents concept of the count of days within the period of a week + where the weeks are aligned to the start of the year. + This field is typically used with {@link #ALIGNED_WEEK_OF_YEAR}. + + For example, in a calendar systems with a seven day week, the first aligned-week-of-year + starts on day-of-year 1, the second aligned-week starts on day-of-year 8, and so on. + Within each of these aligned-weeks, the days are numbered from 1 to 7 and returned + as the value of this field. + As such, day-of-year 1 to 7 will have aligned-day-of-week values from 1 to 7. + And day-of-year 8 to 14 will repeat this with aligned-day-of-week values from 1 to 7. + + Calendar systems that do not have a seven day week should typically implement this + field in the same way, but using the alternate week length." + java.time.temporal.ChronoField/ALIGNED_DAY_OF_WEEK_IN_YEAR) + +(def minute-of-hour + "The minute-of-hour. + + This counts the minute within the hour, from 0 to 59. + This field has the same meaning for all calendar systems. + + When parsing this field it behaves equivalent to the following: + The value is validated in strict and smart mode but not in lenient mode." + java.time.temporal.ChronoField/MINUTE_OF_HOUR) + +(def hour-of-day + "The hour-of-day. + + This counts the hour within the day, from 0 to 23. + This is the hour that would be observed on a standard 24-hour digital clock. + This field has the same meaning for all calendar systems. + + When parsing this field it behaves equivalent to the following: + The value is validated in strict and smart mode but not in lenient mode. + The field is combined with {@code MINUTE_OF_HOUR}, {@code SECOND_OF_MINUTE} and + {@code NANO_OF_SECOND} to produce a {@code LocalTime}. + In lenient mode, any excess days are added to the parsed date, or + made available via {@link java.time.format.DateTimeFormatter#parsedExcessDays()}." + java.time.temporal.ChronoField/HOUR_OF_DAY) + +(def milli-of-day + "The milli-of-day. + + This counts the millisecond within the day, from 0 to (24 * 60 * 60 * 1,000) - 1. + This field has the same meaning for all calendar systems. + + This field is used to represent the milli-of-day handling any fraction of the second. + Implementations of {@code TemporalAccessor} should provide a value for this field if + they can return a value for {@link #SECOND_OF_DAY} filling unknown precision with zero. + + When this field is used for setting a value, it should behave in the same way as + setting {@link #NANO_OF_DAY} with the value multiplied by 1,000,000. + + When parsing this field it behaves equivalent to the following: + The value is validated in strict and smart mode but not in lenient mode. + The value is split to form {@code MILLI_OF_SECOND}, {@code SECOND_OF_MINUTE}, + {@code MINUTE_OF_HOUR} and {@code HOUR_OF_DAY} fields." + java.time.temporal.ChronoField/MILLI_OF_DAY) + +(def micro-of-day + "The micro-of-day. + + This counts the microsecond within the day, from 0 to (24 * 60 * 60 * 1,000,000) - 1. + This field has the same meaning for all calendar systems. + + This field is used to represent the micro-of-day handling any fraction of the second. + Implementations of {@code TemporalAccessor} should provide a value for this field if + they can return a value for {@link #SECOND_OF_DAY} filling unknown precision with zero. + + When this field is used for setting a value, it should behave in the same way as + setting {@link #NANO_OF_DAY} with the value multiplied by 1,000. + + When parsing this field it behaves equivalent to the following: + The value is validated in strict and smart mode but not in lenient mode. + The value is split to form {@code MICRO_OF_SECOND}, {@code SECOND_OF_MINUTE}, + {@code MINUTE_OF_HOUR} and {@code HOUR_OF_DAY} fields." + java.time.temporal.ChronoField/MICRO_OF_DAY) + +(defn get-range-unit + {:arglists (quote (["java.time.temporal.ChronoField"]))} + (^java.time.temporal.ChronoUnit [^java.time.temporal.ChronoField this] + (.getRangeUnit this))) + +(defn range + "Gets the range of valid values for the field. + + All fields can be expressed as a {@code long} integer. + This method returns an object that describes the valid range for that value. + + This method returns the range of the field in the ISO-8601 calendar system. + This range may be incorrect for other calendar systems. + Use {@link Chronology#range(ChronoField)} to access the correct range + for a different calendar system. + + Note that the result only describes the minimum and maximum valid values + and it is important not to read too much into them. For example, there + could be values within the range that are invalid for the field. + + @return the range of valid values for the field, not null" + {:arglists (quote (["java.time.temporal.ChronoField"]))} + (^java.time.temporal.ValueRange [^java.time.temporal.ChronoField this] + (.range this))) + +(defn values + {:arglists (quote ([]))} + (^"java.lang.Class" [] (java.time.temporal.ChronoField/values))) + +(defn value-of + {:arglists (quote (["java.lang.String"] + ["java.lang.Class" "java.lang.String"]))} + (^java.time.temporal.ChronoField [^java.lang.String name] + (java.time.temporal.ChronoField/valueOf name)) + (^java.lang.Enum [^java.lang.Class enum-type ^java.lang.String name] + (java.time.temporal.ChronoField/valueOf enum-type name))) + +(defn resolve + "Resolves this field to provide a simpler alternative or a date. + + This method is invoked during the resolve phase of parsing. + It is designed to allow application defined fields to be simplified into + more standard fields, such as those on {@code ChronoField}, or into a date. + + Applications should not normally invoke this method directly. + + @implSpec + If an implementation represents a field that can be simplified, or + combined with others, then this method must be implemented. + + The specified map contains the current state of the parse. + The map is mutable and must be mutated to resolve the field and + any related fields. This method will only be invoked during parsing + if the map contains this field, and implementations should therefore + assume this field is present. + + Resolving a field will consist of looking at the value of this field, + and potentially other fields, and either updating the map with a + simpler value, such as a {@code ChronoField}, or returning a + complete {@code ChronoLocalDate}. If a resolve is successful, + the code must remove all the fields that were resolved from the map, + including this field. + + For example, the {@code IsoFields} class contains the quarter-of-year + and day-of-quarter fields. The implementation of this method in that class + resolves the two fields plus the {@link ChronoField#YEAR YEAR} into a + complete {@code LocalDate}. The resolve method will remove all three + fields from the map before returning the {@code LocalDate}. + + A partially complete temporal is used to allow the chronology and zone + to be queried. In general, only the chronology will be needed. + Querying items other than the zone or chronology is undefined and + must not be relied on. + The behavior of other methods such as {@code get}, {@code getLong}, + {@code range} and {@code isSupported} is unpredictable and the results undefined. + + If resolution should be possible, but the data is invalid, the resolver + style should be used to determine an appropriate level of leniency, which + may require throwing a {@code DateTimeException} or {@code ArithmeticException}. + If no resolution is possible, the resolve method must return null. + + When resolving time fields, the map will be altered and null returned. + When resolving date fields, the date is normally returned from the method, + with the map altered to remove the resolved fields. However, it would also + be acceptable for the date fields to be resolved into other {@code ChronoField} + instances that can produce a date, such as {@code EPOCH_DAY}. + + Not all {@code TemporalAccessor} implementations are accepted as return values. + Implementations that call this method must accept {@code ChronoLocalDate}, + {@code ChronoLocalDateTime}, {@code ChronoZonedDateTime} and {@code LocalTime}. + + The default implementation must return null. + + @param fieldValues the map of fields to values, which can be updated, not null + @param partialTemporal the partially complete temporal to query for zone and + chronology; querying for other things is undefined and not recommended, not null + @param resolverStyle the requested type of resolve, not null + @return the resolved temporal object; null if resolving only + changed the map, or no resolve occurred + @throws ArithmeticException if numeric overflow occurs + @throws DateTimeException if resolving results in an error. This must not be thrown + by querying a field on the temporal without first checking if it is supported" + {:arglists (quote (["java.time.temporal.ChronoField" "java.util.Map" + "java.time.temporal.TemporalAccessor" + "java.time.format.ResolverStyle"]))} + (^java.time.temporal.TemporalAccessor + [^java.time.temporal.ChronoField this ^java.util.Map field-values + ^java.time.temporal.TemporalAccessor partial-temporal + ^java.time.format.ResolverStyle resolver-style] + (.resolve this field-values partial-temporal resolver-style))) + +(defn ordinal + "Returns the ordinal of this enumeration constant (its position + in its enum declaration, where the initial constant is assigned + an ordinal of zero). + + Most programmers will have no use for this method. It is + designed for use by sophisticated enum-based data structures, such + as {@link java.util.EnumSet} and {@link java.util.EnumMap}. + + @return the ordinal of this enumeration constant" + {:arglists (quote (["java.time.temporal.ChronoField"]))} + (^java.lang.Integer [^java.time.temporal.ChronoField this] (.ordinal this))) + +(defn check-valid-int-value + "Checks that the specified value is valid and fits in an {@code int}. + + This validates that the value is within the outer range of valid values + returned by {@link #range()}. + It also checks that all valid values are within the bounds of an {@code int}. + + This method checks against the range of the field in the ISO-8601 calendar system. + This range may be incorrect for other calendar systems. + Use {@link Chronology#range(ChronoField)} to access the correct range + for a different calendar system. + + @param value the value to check + @return the value that was passed in" + {:arglists (quote (["java.time.temporal.ChronoField" "long"]))} + (^java.lang.Integer [^java.time.temporal.ChronoField this ^long value] + (.checkValidIntValue this value))) + +(defn get-base-unit + {:arglists (quote (["java.time.temporal.ChronoField"]))} + (^java.time.temporal.ChronoUnit [^java.time.temporal.ChronoField this] + (.getBaseUnit this))) + +(defn to-string + {:arglists (quote (["java.time.temporal.ChronoField"]))} + (^java.lang.String [^java.time.temporal.ChronoField this] (.toString this))) + +(defn is-date-based + "Checks if this field represents a component of a date. + + Fields from day-of-week to era are date-based. + + @return true if it is a component of a date" + {:arglists (quote (["java.time.temporal.ChronoField"]))} + (^java.lang.Boolean [^java.time.temporal.ChronoField this] + (.isDateBased this))) + +(defn get-display-name + {:arglists (quote (["java.time.temporal.ChronoField" "java.util.Locale"]))} + (^java.lang.String + [^java.time.temporal.ChronoField this ^java.util.Locale locale] + (.getDisplayName this locale))) + +(defn name + "Returns the name of this enum constant, exactly as declared in its + enum declaration. + + Most programmers should use the {@link #toString} method in + preference to this one, as the toString method may return + a more user-friendly name. This method is designed primarily for + use in specialized situations where correctness depends on getting the + exact name, which will not vary from release to release. + + @return the name of this enum constant" + {:arglists (quote (["java.time.temporal.ChronoField"]))} + (^java.lang.String [^java.time.temporal.ChronoField this] (.name this))) + +(defn is-supported-by + {:arglists (quote (["java.time.temporal.ChronoField" + "java.time.temporal.TemporalAccessor"]))} + (^java.lang.Boolean + [^java.time.temporal.ChronoField this + ^java.time.temporal.TemporalAccessor temporal] + (.isSupportedBy this temporal))) + +(defn range-refined-by + {:arglists (quote (["java.time.temporal.ChronoField" + "java.time.temporal.TemporalAccessor"]))} + (^java.time.temporal.ValueRange + [^java.time.temporal.ChronoField this + ^java.time.temporal.TemporalAccessor temporal] + (.rangeRefinedBy this temporal))) + +(defn get-declaring-class + "Returns the Class object corresponding to this enum constant's + enum type. Two enum constants e1 and e2 are of the + same enum type if and only if + e1.getDeclaringClass() == e2.getDeclaringClass(). + (The value returned by this method may differ from the one returned + by the {@link Object#getClass} method for enum constants with + constant-specific class bodies.) + + @return the Class object corresponding to this enum constant's + enum type" + {:arglists (quote (["java.time.temporal.ChronoField"]))} + (^java.lang.Class [^java.time.temporal.ChronoField this] + (.getDeclaringClass this))) + +(defn hash-code + "Returns a hash code for this enum constant. + + @return a hash code for this enum constant." + {:arglists (quote (["java.time.temporal.ChronoField"]))} + (^java.lang.Integer [^java.time.temporal.ChronoField this] (.hashCode this))) + +(defn adjust-into + {:arglists (quote (["java.time.temporal.ChronoField" + "java.time.temporal.Temporal" "long"]))} + (^java.time.temporal.Temporal + [^java.time.temporal.ChronoField this ^java.time.temporal.Temporal temporal + ^long new-value] + (.adjustInto this temporal new-value))) + +(defn get-from + {:arglists (quote (["java.time.temporal.ChronoField" + "java.time.temporal.TemporalAccessor"]))} + (^long + [^java.time.temporal.ChronoField this + ^java.time.temporal.TemporalAccessor temporal] + (.getFrom this temporal))) + +(defn compare-to + "Compares this enum with the specified object for order. Returns a + negative integer, zero, or a positive integer as this object is less + than, equal to, or greater than the specified object. + + Enum constants are only comparable to other enum constants of the + same enum type. The natural order implemented by this + method is the order in which the constants are declared." + {:arglists (quote (["java.time.temporal.ChronoField" "java.lang.Enum"]))} + (^java.lang.Integer [^java.time.temporal.ChronoField this ^java.lang.Enum o] + (.compareTo this o))) + +(defn equals + "Returns true if the specified object is equal to this + enum constant. + + @param other the object to be compared for equality with this object. + @return true if the specified object is equal to this + enum constant." + {:arglists (quote (["java.time.temporal.ChronoField" "java.lang.Object"]))} + (^java.lang.Boolean + [^java.time.temporal.ChronoField this ^java.lang.Object other] + (.equals this other))) + +(defn is-time-based + "Checks if this field represents a component of a time. + + Fields from nano-of-second to am-pm-of-day are time-based. + + @return true if it is a component of a time" + {:arglists (quote (["java.time.temporal.ChronoField"]))} + (^java.lang.Boolean [^java.time.temporal.ChronoField this] + (.isTimeBased this))) + +(defn check-valid-value + "Checks that the specified value is valid for this field. + + This validates that the value is within the outer range of valid values + returned by {@link #range()}. + + This method checks against the range of the field in the ISO-8601 calendar system. + This range may be incorrect for other calendar systems. + Use {@link Chronology#range(ChronoField)} to access the correct range + for a different calendar system. + + @param value the value to check + @return the value that was passed in" + {:arglists (quote (["java.time.temporal.ChronoField" "long"]))} + (^long [^java.time.temporal.ChronoField this ^long value] + (.checkValidValue this value))) diff --git a/src/cljc/java_time/temporal/chrono_field.cljs b/src/cljc/java_time/temporal/chrono_field.cljs index 7b94645..bca9894 100644 --- a/src/cljc/java_time/temporal/chrono_field.cljs +++ b/src/cljc/java_time/temporal/chrono_field.cljs @@ -1,53 +1,768 @@ -(ns cljc.java-time.temporal.chrono-field (:refer-clojure :exclude [abs get range format min max next name resolve short]) (:require [cljc.java-time.extn.calendar-awareness] [goog.object] [java.time.temporal :refer [ChronoField]])) -(def milli-of-second (goog.object/get java.time.temporal.ChronoField "MILLI_OF_SECOND")) -(def year-of-era (goog.object/get java.time.temporal.ChronoField "YEAR_OF_ERA")) -(def clock-hour-of-day (goog.object/get java.time.temporal.ChronoField "CLOCK_HOUR_OF_DAY")) -(def era (goog.object/get java.time.temporal.ChronoField "ERA")) -(def instant-seconds (goog.object/get java.time.temporal.ChronoField "INSTANT_SECONDS")) -(def ampm-of-day (goog.object/get java.time.temporal.ChronoField "AMPM_OF_DAY")) -(def offset-seconds (goog.object/get java.time.temporal.ChronoField "OFFSET_SECONDS")) -(def nano-of-second (goog.object/get java.time.temporal.ChronoField "NANO_OF_SECOND")) -(def nano-of-day (goog.object/get java.time.temporal.ChronoField "NANO_OF_DAY")) -(def aligned-day-of-week-in-month (goog.object/get java.time.temporal.ChronoField "ALIGNED_DAY_OF_WEEK_IN_MONTH")) -(def month-of-year (goog.object/get java.time.temporal.ChronoField "MONTH_OF_YEAR")) -(def hour-of-ampm (goog.object/get java.time.temporal.ChronoField "HOUR_OF_AMPM")) -(def year (goog.object/get java.time.temporal.ChronoField "YEAR")) -(def micro-of-second (goog.object/get java.time.temporal.ChronoField "MICRO_OF_SECOND")) -(def aligned-week-of-year (goog.object/get java.time.temporal.ChronoField "ALIGNED_WEEK_OF_YEAR")) -(def proleptic-month (goog.object/get java.time.temporal.ChronoField "PROLEPTIC_MONTH")) -(def day-of-month (goog.object/get java.time.temporal.ChronoField "DAY_OF_MONTH")) -(def second-of-minute (goog.object/get java.time.temporal.ChronoField "SECOND_OF_MINUTE")) -(def second-of-day (goog.object/get java.time.temporal.ChronoField "SECOND_OF_DAY")) -(def epoch-day (goog.object/get java.time.temporal.ChronoField "EPOCH_DAY")) -(def day-of-year (goog.object/get java.time.temporal.ChronoField "DAY_OF_YEAR")) -(def aligned-week-of-month (goog.object/get java.time.temporal.ChronoField "ALIGNED_WEEK_OF_MONTH")) -(def day-of-week (goog.object/get java.time.temporal.ChronoField "DAY_OF_WEEK")) -(def clock-hour-of-ampm (goog.object/get java.time.temporal.ChronoField "CLOCK_HOUR_OF_AMPM")) -(def minute-of-day (goog.object/get java.time.temporal.ChronoField "MINUTE_OF_DAY")) -(def aligned-day-of-week-in-year (goog.object/get java.time.temporal.ChronoField "ALIGNED_DAY_OF_WEEK_IN_YEAR")) -(def minute-of-hour (goog.object/get java.time.temporal.ChronoField "MINUTE_OF_HOUR")) -(def hour-of-day (goog.object/get java.time.temporal.ChronoField "HOUR_OF_DAY")) -(def milli-of-day (goog.object/get java.time.temporal.ChronoField "MILLI_OF_DAY")) -(def micro-of-day (goog.object/get java.time.temporal.ChronoField "MICRO_OF_DAY")) -(clojure.core/defn get-range-unit {:arglists (quote (["java.time.temporal.ChronoField"]))} (^js/JSJoda.TemporalUnit [^js/JSJoda.ChronoField this15656] (.rangeUnit this15656))) -(clojure.core/defn range {:arglists (quote (["java.time.temporal.ChronoField"]))} (^js/JSJoda.ValueRange [^js/JSJoda.ChronoField this15657] (.range this15657))) -(clojure.core/defn values {:arglists (quote ([]))} (^"java.lang.Class" [] (js-invoke java.time.temporal.ChronoField "values"))) -(clojure.core/defn value-of {:arglists (quote (["java.lang.String"] ["java.lang.Class" "java.lang.String"]))} (^js/JSJoda.ChronoField [^java.lang.String java-lang-String15658] (js-invoke java.time.temporal.ChronoField "valueOf" java-lang-String15658)) (^java.lang.Enum [^java.lang.Class java-lang-Class15659 ^java.lang.String java-lang-String15660] (js-invoke java.time.temporal.ChronoField "valueOf" java-lang-Class15659 java-lang-String15660))) -(clojure.core/defn resolve {:arglists (quote (["java.time.temporal.ChronoField" "java.util.Map" "java.time.temporal.TemporalAccessor" "java.time.format.ResolverStyle"]))} (^js/JSJoda.TemporalAccessor [^js/JSJoda.ChronoField this15661 ^java.util.Map java-util-Map15662 ^js/JSJoda.TemporalAccessor java-time-temporal-TemporalAccessor15663 ^js/JSJoda.ResolverStyle java-time-format-ResolverStyle15664] (.resolve this15661 java-util-Map15662 java-time-temporal-TemporalAccessor15663 java-time-format-ResolverStyle15664))) -(clojure.core/defn ordinal {:arglists (quote (["java.time.temporal.ChronoField"]))} (^int [^js/JSJoda.ChronoField this15665] (.ordinal this15665))) -(clojure.core/defn check-valid-int-value {:arglists (quote (["java.time.temporal.ChronoField" "long"]))} (^int [^js/JSJoda.ChronoField this15666 ^long long15667] (.checkValidIntValue this15666 long15667))) -(clojure.core/defn get-base-unit {:arglists (quote (["java.time.temporal.ChronoField"]))} (^js/JSJoda.TemporalUnit [^js/JSJoda.ChronoField this15668] (.baseUnit this15668))) -(clojure.core/defn to-string {:arglists (quote (["java.time.temporal.ChronoField"]))} (^java.lang.String [^js/JSJoda.ChronoField this15669] (.toString this15669))) -(clojure.core/defn is-date-based {:arglists (quote (["java.time.temporal.ChronoField"]))} (^boolean [^js/JSJoda.ChronoField this15670] (.isDateBased this15670))) -(clojure.core/defn get-display-name {:arglists (quote (["java.time.temporal.ChronoField" "java.util.Locale"]))} (^java.lang.String [^js/JSJoda.ChronoField this15671 ^java.util.Locale java-util-Locale15672] (.displayName this15671 java-util-Locale15672))) -(clojure.core/defn name {:arglists (quote (["java.time.temporal.ChronoField"]))} (^java.lang.String [^js/JSJoda.ChronoField this15673] (.name this15673))) -(clojure.core/defn is-supported-by {:arglists (quote (["java.time.temporal.ChronoField" "java.time.temporal.TemporalAccessor"]))} (^boolean [^js/JSJoda.ChronoField this15674 ^js/JSJoda.TemporalAccessor java-time-temporal-TemporalAccessor15675] (.isSupportedBy this15674 java-time-temporal-TemporalAccessor15675))) -(clojure.core/defn range-refined-by {:arglists (quote (["java.time.temporal.ChronoField" "java.time.temporal.TemporalAccessor"]))} (^js/JSJoda.ValueRange [^js/JSJoda.ChronoField this15676 ^js/JSJoda.TemporalAccessor java-time-temporal-TemporalAccessor15677] (.rangeRefinedBy this15676 java-time-temporal-TemporalAccessor15677))) -(clojure.core/defn get-declaring-class {:arglists (quote (["java.time.temporal.ChronoField"]))} (^java.lang.Class [^js/JSJoda.ChronoField this15678] (.declaringClass this15678))) -(clojure.core/defn hash-code {:arglists (quote (["java.time.temporal.ChronoField"]))} (^int [^js/JSJoda.ChronoField this15679] (.hashCode this15679))) -(clojure.core/defn adjust-into {:arglists (quote (["java.time.temporal.ChronoField" "java.time.temporal.Temporal" "long"]))} (^js/JSJoda.Temporal [^js/JSJoda.ChronoField this15680 ^js/JSJoda.Temporal java-time-temporal-Temporal15681 ^long long15682] (.adjustInto this15680 java-time-temporal-Temporal15681 long15682))) -(clojure.core/defn get-from {:arglists (quote (["java.time.temporal.ChronoField" "java.time.temporal.TemporalAccessor"]))} (^long [^js/JSJoda.ChronoField this15683 ^js/JSJoda.TemporalAccessor java-time-temporal-TemporalAccessor15684] (.from this15683 java-time-temporal-TemporalAccessor15684))) -(clojure.core/defn compare-to {:arglists (quote (["java.time.temporal.ChronoField" "java.lang.Enum"]))} (^int [^js/JSJoda.ChronoField this15685 ^java.lang.Enum java-lang-Enum15686] (.compareTo this15685 java-lang-Enum15686))) -(clojure.core/defn equals {:arglists (quote (["java.time.temporal.ChronoField" "java.lang.Object"]))} (^boolean [^js/JSJoda.ChronoField this15687 ^java.lang.Object java-lang-Object15688] (.equals this15687 java-lang-Object15688))) -(clojure.core/defn is-time-based {:arglists (quote (["java.time.temporal.ChronoField"]))} (^boolean [^js/JSJoda.ChronoField this15689] (.isTimeBased this15689))) -(clojure.core/defn check-valid-value {:arglists (quote (["java.time.temporal.ChronoField" "long"]))} (^long [^js/JSJoda.ChronoField this15690 ^long long15691] (.checkValidValue this15690 long15691))) +(ns cljc.java-time.temporal.chrono-field + (:refer-clojure :exclude + [abs get range format min max next name resolve short]) + (:require [cljc.java-time.extn.calendar-awareness] + [goog.object] + [java.time.temporal :refer [ChronoField]])) + +(def milli-of-second + "The milli-of-second. + + This counts the millisecond within the second, from 0 to 999. + This field has the same meaning for all calendar systems. + + This field is used to represent the milli-of-second handling any fraction of the second. + Implementations of {@code TemporalAccessor} should provide a value for this field if + they can return a value for {@link #SECOND_OF_MINUTE}, {@link #SECOND_OF_DAY} or + {@link #INSTANT_SECONDS} filling unknown precision with zero. + + When this field is used for setting a value, it should behave in the same way as + setting {@link #NANO_OF_SECOND} with the value multiplied by 1,000,000. + + When parsing this field it behaves equivalent to the following: + The value is validated in strict and smart mode but not in lenient mode. + The field is resolved in combination with {@code MICRO_OF_SECOND} to produce + {@code NANO_OF_SECOND}." + (goog.object/get java.time.temporal.ChronoField "MILLI_OF_SECOND")) + +(def year-of-era + "The year within the era. + + This represents the concept of the year within the era. + This field is typically used with {@link #ERA}. + + The standard mental model for a date is based on three concepts - year, month and day. + These map onto the {@code YEAR}, {@code MONTH_OF_YEAR} and {@code DAY_OF_MONTH} fields. + Note that there is no reference to eras. + The full model for a date requires four concepts - era, year, month and day. These map onto + the {@code ERA}, {@code YEAR_OF_ERA}, {@code MONTH_OF_YEAR} and {@code DAY_OF_MONTH} fields. + Whether this field or {@code YEAR} is used depends on which mental model is being used. + See {@link ChronoLocalDate} for more discussion on this topic. + + In the default ISO calendar system, there are two eras defined, 'BCE' and 'CE'. + The era 'CE' is the one currently in use and year-of-era runs from 1 to the maximum value. + The era 'BCE' is the previous era, and the year-of-era runs backwards. + + For example, subtracting a year each time yield the following:
+ - year-proleptic 2 = 'CE' year-of-era 2
+ - year-proleptic 1 = 'CE' year-of-era 1
+ - year-proleptic 0 = 'BCE' year-of-era 1
+ - year-proleptic -1 = 'BCE' year-of-era 2
+ + Note that the ISO-8601 standard does not actually define eras. + Note also that the ISO eras do not align with the well-known AD/BC eras due to the + change between the Julian and Gregorian calendar systems. + + Non-ISO calendar systems should implement this field using the most recognized + year-of-era value for users of the calendar system. + Since most calendar systems have only two eras, the year-of-era numbering approach + will typically be the same as that used by the ISO calendar system. + The year-of-era value should typically always be positive, however this is not required." + (goog.object/get java.time.temporal.ChronoField "YEAR_OF_ERA")) + +(def clock-hour-of-day + "The clock-hour-of-day. + + This counts the hour within the AM/PM, from 1 to 24. + This is the hour that would be observed on a 24-hour analog wall clock. + This field has the same meaning for all calendar systems. + + When parsing this field it behaves equivalent to the following: + The value is validated from 1 to 24 in strict mode and from + 0 to 24 in smart mode. In lenient mode the value is not validated. + The field is converted to an {@code HOUR_OF_DAY} with the same value, + unless the value is 24, in which case it is converted to 0." + (goog.object/get java.time.temporal.ChronoField "CLOCK_HOUR_OF_DAY")) + +(def era + "The era. + + This represents the concept of the era, which is the largest division of the time-line. + This field is typically used with {@link #YEAR_OF_ERA}. + + In the default ISO calendar system, there are two eras defined, 'BCE' and 'CE'. + The era 'CE' is the one currently in use and year-of-era runs from 1 to the maximum value. + The era 'BCE' is the previous era, and the year-of-era runs backwards. + See {@link #YEAR_OF_ERA} for a full example. + + Non-ISO calendar systems should implement this field to define eras. + The value of the era that was active on 1970-01-01 (ISO) must be assigned the value 1. + Earlier eras must have sequentially smaller values. + Later eras must have sequentially larger values," + (goog.object/get java.time.temporal.ChronoField "ERA")) + +(def instant-seconds + "The instant epoch-seconds. + + This represents the concept of the sequential count of seconds where + 1970-01-01T00:00Z (ISO) is zero. + This field may be used with {@link #NANO_OF_SECOND} to represent the fraction of the second. + + An {@link Instant} represents an instantaneous point on the time-line. + On their own, an instant has insufficient information to allow a local date-time to be obtained. + Only when paired with an offset or time-zone can the local date or time be calculated. + + This field is strictly defined to have the same meaning in all calendar systems. + This is necessary to ensure interoperation between calendars." + (goog.object/get java.time.temporal.ChronoField "INSTANT_SECONDS")) + +(def ampm-of-day + "The am-pm-of-day. + + This counts the AM/PM within the day, from 0 (AM) to 1 (PM). + This field has the same meaning for all calendar systems. + + When parsing this field it behaves equivalent to the following: + The value is validated from 0 to 1 in strict and smart mode. + In lenient mode the value is not validated. It is combined with + {@code HOUR_OF_AMPM} to form {@code HOUR_OF_DAY} by multiplying + the {AMPM_OF_DAY} value by 12." + (goog.object/get java.time.temporal.ChronoField "AMPM_OF_DAY")) + +(def offset-seconds + "The offset from UTC/Greenwich. + + This represents the concept of the offset in seconds of local time from UTC/Greenwich. + + A {@link ZoneOffset} represents the period of time that local time differs from UTC/Greenwich. + This is usually a fixed number of hours and minutes. + It is equivalent to the {@link ZoneOffset#getTotalSeconds() total amount} of the offset in seconds. + For example, during the winter Paris has an offset of {@code +01:00}, which is 3600 seconds. + + This field is strictly defined to have the same meaning in all calendar systems. + This is necessary to ensure interoperation between calendars." + (goog.object/get java.time.temporal.ChronoField "OFFSET_SECONDS")) + +(def nano-of-second + "The nano-of-second. + + This counts the nanosecond within the second, from 0 to 999,999,999. + This field has the same meaning for all calendar systems. + + This field is used to represent the nano-of-second handling any fraction of the second. + Implementations of {@code TemporalAccessor} should provide a value for this field if + they can return a value for {@link #SECOND_OF_MINUTE}, {@link #SECOND_OF_DAY} or + {@link #INSTANT_SECONDS} filling unknown precision with zero. + + When this field is used for setting a value, it should set as much precision as the + object stores, using integer division to remove excess precision. + For example, if the {@code TemporalAccessor} stores time to millisecond precision, + then the nano-of-second must be divided by 1,000,000 before replacing the milli-of-second. + + When parsing this field it behaves equivalent to the following: + The value is validated in strict and smart mode but not in lenient mode. + The field is resolved in combination with {@code MILLI_OF_SECOND} and {@code MICRO_OF_SECOND}." + (goog.object/get java.time.temporal.ChronoField "NANO_OF_SECOND")) + +(def nano-of-day + "The nano-of-day. + + This counts the nanosecond within the day, from 0 to (24 * 60 * 60 * 1,000,000,000) - 1. + This field has the same meaning for all calendar systems. + + This field is used to represent the nano-of-day handling any fraction of the second. + Implementations of {@code TemporalAccessor} should provide a value for this field if + they can return a value for {@link #SECOND_OF_DAY} filling unknown precision with zero. + + When parsing this field it behaves equivalent to the following: + The value is validated in strict and smart mode but not in lenient mode. + The value is split to form {@code NANO_OF_SECOND}, {@code SECOND_OF_MINUTE}, + {@code MINUTE_OF_HOUR} and {@code HOUR_OF_DAY} fields." + (goog.object/get java.time.temporal.ChronoField "NANO_OF_DAY")) + +(def aligned-day-of-week-in-month + "The aligned day-of-week within a month. + + This represents concept of the count of days within the period of a week + where the weeks are aligned to the start of the month. + This field is typically used with {@link #ALIGNED_WEEK_OF_MONTH}. + + For example, in a calendar systems with a seven day week, the first aligned-week-of-month + starts on day-of-month 1, the second aligned-week starts on day-of-month 8, and so on. + Within each of these aligned-weeks, the days are numbered from 1 to 7 and returned + as the value of this field. + As such, day-of-month 1 to 7 will have aligned-day-of-week values from 1 to 7. + And day-of-month 8 to 14 will repeat this with aligned-day-of-week values from 1 to 7. + + Calendar systems that do not have a seven day week should typically implement this + field in the same way, but using the alternate week length." + (goog.object/get java.time.temporal.ChronoField + "ALIGNED_DAY_OF_WEEK_IN_MONTH")) + +(def month-of-year + "The month-of-year, such as March. + + This represents the concept of the month within the year. + In the default ISO calendar system, this has values from January (1) to December (12). + + Non-ISO calendar systems should implement this field using the most recognized + month-of-year values for users of the calendar system. + Normally, this is a count of months starting from 1." + (goog.object/get java.time.temporal.ChronoField "MONTH_OF_YEAR")) + +(def hour-of-ampm + "The hour-of-am-pm. + + This counts the hour within the AM/PM, from 0 to 11. + This is the hour that would be observed on a standard 12-hour digital clock. + This field has the same meaning for all calendar systems. + + When parsing this field it behaves equivalent to the following: + The value is validated from 0 to 11 in strict and smart mode. + In lenient mode the value is not validated. It is combined with + {@code AMPM_OF_DAY} to form {@code HOUR_OF_DAY} by multiplying + the {AMPM_OF_DAY} value by 12." + (goog.object/get java.time.temporal.ChronoField "HOUR_OF_AMPM")) + +(def year + "The proleptic year, such as 2012. + + This represents the concept of the year, counting sequentially and using negative numbers. + The proleptic year is not interpreted in terms of the era. + See {@link #YEAR_OF_ERA} for an example showing the mapping from proleptic year to year-of-era. + + The standard mental model for a date is based on three concepts - year, month and day. + These map onto the {@code YEAR}, {@code MONTH_OF_YEAR} and {@code DAY_OF_MONTH} fields. + Note that there is no reference to eras. + The full model for a date requires four concepts - era, year, month and day. These map onto + the {@code ERA}, {@code YEAR_OF_ERA}, {@code MONTH_OF_YEAR} and {@code DAY_OF_MONTH} fields. + Whether this field or {@code YEAR_OF_ERA} is used depends on which mental model is being used. + See {@link ChronoLocalDate} for more discussion on this topic. + + Non-ISO calendar systems should implement this field as follows. + If the calendar system has only two eras, before and after a fixed date, then the + proleptic-year value must be the same as the year-of-era value for the later era, + and increasingly negative for the earlier era. + If the calendar system has more than two eras, then the proleptic-year value may be + defined with any appropriate value, although defining it to be the same as ISO may be + the best option." + (goog.object/get java.time.temporal.ChronoField "YEAR")) + +(def micro-of-second + "The micro-of-second. + + This counts the microsecond within the second, from 0 to 999,999. + This field has the same meaning for all calendar systems. + + This field is used to represent the micro-of-second handling any fraction of the second. + Implementations of {@code TemporalAccessor} should provide a value for this field if + they can return a value for {@link #SECOND_OF_MINUTE}, {@link #SECOND_OF_DAY} or + {@link #INSTANT_SECONDS} filling unknown precision with zero. + + When this field is used for setting a value, it should behave in the same way as + setting {@link #NANO_OF_SECOND} with the value multiplied by 1,000. + + When parsing this field it behaves equivalent to the following: + The value is validated in strict and smart mode but not in lenient mode. + The field is resolved in combination with {@code MILLI_OF_SECOND} to produce + {@code NANO_OF_SECOND}." + (goog.object/get java.time.temporal.ChronoField "MICRO_OF_SECOND")) + +(def aligned-week-of-year + "The aligned week within a year. + + This represents concept of the count of weeks within the period of a year + where the weeks are aligned to the start of the year. + This field is typically used with {@link #ALIGNED_DAY_OF_WEEK_IN_YEAR}. + + For example, in a calendar systems with a seven day week, the first aligned-week-of-year + starts on day-of-year 1, the second aligned-week starts on day-of-year 8, and so on. + Thus, day-of-year values 1 to 7 are in aligned-week 1, while day-of-year values + 8 to 14 are in aligned-week 2, and so on. + + Calendar systems that do not have a seven day week should typically implement this + field in the same way, but using the alternate week length." + (goog.object/get java.time.temporal.ChronoField "ALIGNED_WEEK_OF_YEAR")) + +(def proleptic-month + "The proleptic-month based, counting months sequentially from year 0. + + This field is the sequential count of months where the first month + in proleptic-year zero has the value zero. + Later months have increasingly larger values. + Earlier months have increasingly small values. + There are no gaps or breaks in the sequence of months. + Note that this uses the local time-line, ignoring offset and time-zone. + + In the default ISO calendar system, June 2012 would have the value + {@code (2012 * 12 + 6 - 1)}. This field is primarily for internal use. + + Non-ISO calendar systems must implement this field as per the definition above. + It is just a simple zero-based count of elapsed months from the start of proleptic-year 0. + All calendar systems with a full proleptic-year definition will have a year zero. + If the calendar system has a minimum year that excludes year zero, then one must + be extrapolated in order for this method to be defined." + (goog.object/get java.time.temporal.ChronoField "PROLEPTIC_MONTH")) + +(def day-of-month + "The day-of-month. + + This represents the concept of the day within the month. + In the default ISO calendar system, this has values from 1 to 31 in most months. + April, June, September, November have days from 1 to 30, while February has days + from 1 to 28, or 29 in a leap year. + + Non-ISO calendar systems should implement this field using the most recognized + day-of-month values for users of the calendar system. + Normally, this is a count of days from 1 to the length of the month." + (goog.object/get java.time.temporal.ChronoField "DAY_OF_MONTH")) + +(def second-of-minute + "The second-of-minute. + + This counts the second within the minute, from 0 to 59. + This field has the same meaning for all calendar systems. + + When parsing this field it behaves equivalent to the following: + The value is validated in strict and smart mode but not in lenient mode." + (goog.object/get java.time.temporal.ChronoField "SECOND_OF_MINUTE")) + +(def second-of-day + "The second-of-day. + + This counts the second within the day, from 0 to (24 * 60 * 60) - 1. + This field has the same meaning for all calendar systems. + + When parsing this field it behaves equivalent to the following: + The value is validated in strict and smart mode but not in lenient mode. + The value is split to form {@code SECOND_OF_MINUTE}, {@code MINUTE_OF_HOUR} + and {@code HOUR_OF_DAY} fields." + (goog.object/get java.time.temporal.ChronoField "SECOND_OF_DAY")) + +(def epoch-day + "The epoch-day, based on the Java epoch of 1970-01-01 (ISO). + + This field is the sequential count of days where 1970-01-01 (ISO) is zero. + Note that this uses the local time-line, ignoring offset and time-zone. + + This field is strictly defined to have the same meaning in all calendar systems. + This is necessary to ensure interoperation between calendars." + (goog.object/get java.time.temporal.ChronoField "EPOCH_DAY")) + +(def day-of-year + "The day-of-year. + + This represents the concept of the day within the year. + In the default ISO calendar system, this has values from 1 to 365 in standard + years and 1 to 366 in leap years. + + Non-ISO calendar systems should implement this field using the most recognized + day-of-year values for users of the calendar system. + Normally, this is a count of days from 1 to the length of the year. + + Note that a non-ISO calendar system may have year numbering system that changes + at a different point to the natural reset in the month numbering. An example + of this is the Japanese calendar system where a change of era, which resets + the year number to 1, can happen on any date. The era and year reset also cause + the day-of-year to be reset to 1, but not the month-of-year or day-of-month." + (goog.object/get java.time.temporal.ChronoField "DAY_OF_YEAR")) + +(def aligned-week-of-month + "The aligned week within a month. + + This represents concept of the count of weeks within the period of a month + where the weeks are aligned to the start of the month. + This field is typically used with {@link #ALIGNED_DAY_OF_WEEK_IN_MONTH}. + + For example, in a calendar systems with a seven day week, the first aligned-week-of-month + starts on day-of-month 1, the second aligned-week starts on day-of-month 8, and so on. + Thus, day-of-month values 1 to 7 are in aligned-week 1, while day-of-month values + 8 to 14 are in aligned-week 2, and so on. + + Calendar systems that do not have a seven day week should typically implement this + field in the same way, but using the alternate week length." + (goog.object/get java.time.temporal.ChronoField "ALIGNED_WEEK_OF_MONTH")) + +(def day-of-week + "The day-of-week, such as Tuesday. + + This represents the standard concept of the day of the week. + In the default ISO calendar system, this has values from Monday (1) to Sunday (7). + The {@link DayOfWeek} class can be used to interpret the result. + + Most non-ISO calendar systems also define a seven day week that aligns with ISO. + Those calendar systems must also use the same numbering system, from Monday (1) to + Sunday (7), which allows {@code DayOfWeek} to be used. + + Calendar systems that do not have a standard seven day week should implement this field + if they have a similar concept of named or numbered days within a period similar + to a week. It is recommended that the numbering starts from 1." + (goog.object/get java.time.temporal.ChronoField "DAY_OF_WEEK")) + +(def clock-hour-of-ampm + "The clock-hour-of-am-pm. + + This counts the hour within the AM/PM, from 1 to 12. + This is the hour that would be observed on a standard 12-hour analog wall clock. + This field has the same meaning for all calendar systems. + + When parsing this field it behaves equivalent to the following: + The value is validated from 1 to 12 in strict mode and from + 0 to 12 in smart mode. In lenient mode the value is not validated. + The field is converted to an {@code HOUR_OF_AMPM} with the same value, + unless the value is 12, in which case it is converted to 0." + (goog.object/get java.time.temporal.ChronoField "CLOCK_HOUR_OF_AMPM")) + +(def minute-of-day + "The minute-of-day. + + This counts the minute within the day, from 0 to (24 * 60) - 1. + This field has the same meaning for all calendar systems. + + When parsing this field it behaves equivalent to the following: + The value is validated in strict and smart mode but not in lenient mode. + The value is split to form {@code MINUTE_OF_HOUR} and {@code HOUR_OF_DAY} fields." + (goog.object/get java.time.temporal.ChronoField "MINUTE_OF_DAY")) + +(def aligned-day-of-week-in-year + "The aligned day-of-week within a year. + + This represents concept of the count of days within the period of a week + where the weeks are aligned to the start of the year. + This field is typically used with {@link #ALIGNED_WEEK_OF_YEAR}. + + For example, in a calendar systems with a seven day week, the first aligned-week-of-year + starts on day-of-year 1, the second aligned-week starts on day-of-year 8, and so on. + Within each of these aligned-weeks, the days are numbered from 1 to 7 and returned + as the value of this field. + As such, day-of-year 1 to 7 will have aligned-day-of-week values from 1 to 7. + And day-of-year 8 to 14 will repeat this with aligned-day-of-week values from 1 to 7. + + Calendar systems that do not have a seven day week should typically implement this + field in the same way, but using the alternate week length." + (goog.object/get java.time.temporal.ChronoField + "ALIGNED_DAY_OF_WEEK_IN_YEAR")) + +(def minute-of-hour + "The minute-of-hour. + + This counts the minute within the hour, from 0 to 59. + This field has the same meaning for all calendar systems. + + When parsing this field it behaves equivalent to the following: + The value is validated in strict and smart mode but not in lenient mode." + (goog.object/get java.time.temporal.ChronoField "MINUTE_OF_HOUR")) + +(def hour-of-day + "The hour-of-day. + + This counts the hour within the day, from 0 to 23. + This is the hour that would be observed on a standard 24-hour digital clock. + This field has the same meaning for all calendar systems. + + When parsing this field it behaves equivalent to the following: + The value is validated in strict and smart mode but not in lenient mode. + The field is combined with {@code MINUTE_OF_HOUR}, {@code SECOND_OF_MINUTE} and + {@code NANO_OF_SECOND} to produce a {@code LocalTime}. + In lenient mode, any excess days are added to the parsed date, or + made available via {@link java.time.format.DateTimeFormatter#parsedExcessDays()}." + (goog.object/get java.time.temporal.ChronoField "HOUR_OF_DAY")) + +(def milli-of-day + "The milli-of-day. + + This counts the millisecond within the day, from 0 to (24 * 60 * 60 * 1,000) - 1. + This field has the same meaning for all calendar systems. + + This field is used to represent the milli-of-day handling any fraction of the second. + Implementations of {@code TemporalAccessor} should provide a value for this field if + they can return a value for {@link #SECOND_OF_DAY} filling unknown precision with zero. + + When this field is used for setting a value, it should behave in the same way as + setting {@link #NANO_OF_DAY} with the value multiplied by 1,000,000. + + When parsing this field it behaves equivalent to the following: + The value is validated in strict and smart mode but not in lenient mode. + The value is split to form {@code MILLI_OF_SECOND}, {@code SECOND_OF_MINUTE}, + {@code MINUTE_OF_HOUR} and {@code HOUR_OF_DAY} fields." + (goog.object/get java.time.temporal.ChronoField "MILLI_OF_DAY")) + +(def micro-of-day + "The micro-of-day. + + This counts the microsecond within the day, from 0 to (24 * 60 * 60 * 1,000,000) - 1. + This field has the same meaning for all calendar systems. + + This field is used to represent the micro-of-day handling any fraction of the second. + Implementations of {@code TemporalAccessor} should provide a value for this field if + they can return a value for {@link #SECOND_OF_DAY} filling unknown precision with zero. + + When this field is used for setting a value, it should behave in the same way as + setting {@link #NANO_OF_DAY} with the value multiplied by 1,000. + + When parsing this field it behaves equivalent to the following: + The value is validated in strict and smart mode but not in lenient mode. + The value is split to form {@code MICRO_OF_SECOND}, {@code SECOND_OF_MINUTE}, + {@code MINUTE_OF_HOUR} and {@code HOUR_OF_DAY} fields." + (goog.object/get java.time.temporal.ChronoField "MICRO_OF_DAY")) + +(defn get-range-unit + {:arglists (quote (["java.time.temporal.ChronoField"]))} + (^js/JSJoda.TemporalUnit [^js/JSJoda.ChronoField this] (.rangeUnit this))) + +(defn range + "Gets the range of valid values for the field. + + All fields can be expressed as a {@code long} integer. + This method returns an object that describes the valid range for that value. + + This method returns the range of the field in the ISO-8601 calendar system. + This range may be incorrect for other calendar systems. + Use {@link Chronology#range(ChronoField)} to access the correct range + for a different calendar system. + + Note that the result only describes the minimum and maximum valid values + and it is important not to read too much into them. For example, there + could be values within the range that are invalid for the field. + + @return the range of valid values for the field, not null" + {:arglists (quote (["java.time.temporal.ChronoField"]))} + (^js/JSJoda.ValueRange [^js/JSJoda.ChronoField this] (.range this))) + +(defn values + {:arglists (quote ([]))} + (^"java.lang.Class" [] (js-invoke java.time.temporal.ChronoField "values"))) + +(defn value-of + {:arglists (quote (["java.lang.String"] + ["java.lang.Class" "java.lang.String"]))} + (^js/JSJoda.ChronoField [^java.lang.String name] + (js-invoke java.time.temporal.ChronoField "valueOf" name)) + (^java.lang.Enum [^java.lang.Class enum-type ^java.lang.String name] + (js-invoke java.time.temporal.ChronoField "valueOf" enum-type name))) + +(defn resolve + "Resolves this field to provide a simpler alternative or a date. + + This method is invoked during the resolve phase of parsing. + It is designed to allow application defined fields to be simplified into + more standard fields, such as those on {@code ChronoField}, or into a date. + + Applications should not normally invoke this method directly. + + @implSpec + If an implementation represents a field that can be simplified, or + combined with others, then this method must be implemented. + + The specified map contains the current state of the parse. + The map is mutable and must be mutated to resolve the field and + any related fields. This method will only be invoked during parsing + if the map contains this field, and implementations should therefore + assume this field is present. + + Resolving a field will consist of looking at the value of this field, + and potentially other fields, and either updating the map with a + simpler value, such as a {@code ChronoField}, or returning a + complete {@code ChronoLocalDate}. If a resolve is successful, + the code must remove all the fields that were resolved from the map, + including this field. + + For example, the {@code IsoFields} class contains the quarter-of-year + and day-of-quarter fields. The implementation of this method in that class + resolves the two fields plus the {@link ChronoField#YEAR YEAR} into a + complete {@code LocalDate}. The resolve method will remove all three + fields from the map before returning the {@code LocalDate}. + + A partially complete temporal is used to allow the chronology and zone + to be queried. In general, only the chronology will be needed. + Querying items other than the zone or chronology is undefined and + must not be relied on. + The behavior of other methods such as {@code get}, {@code getLong}, + {@code range} and {@code isSupported} is unpredictable and the results undefined. + + If resolution should be possible, but the data is invalid, the resolver + style should be used to determine an appropriate level of leniency, which + may require throwing a {@code DateTimeException} or {@code ArithmeticException}. + If no resolution is possible, the resolve method must return null. + + When resolving time fields, the map will be altered and null returned. + When resolving date fields, the date is normally returned from the method, + with the map altered to remove the resolved fields. However, it would also + be acceptable for the date fields to be resolved into other {@code ChronoField} + instances that can produce a date, such as {@code EPOCH_DAY}. + + Not all {@code TemporalAccessor} implementations are accepted as return values. + Implementations that call this method must accept {@code ChronoLocalDate}, + {@code ChronoLocalDateTime}, {@code ChronoZonedDateTime} and {@code LocalTime}. + + The default implementation must return null. + + @param fieldValues the map of fields to values, which can be updated, not null + @param partialTemporal the partially complete temporal to query for zone and + chronology; querying for other things is undefined and not recommended, not null + @param resolverStyle the requested type of resolve, not null + @return the resolved temporal object; null if resolving only + changed the map, or no resolve occurred + @throws ArithmeticException if numeric overflow occurs + @throws DateTimeException if resolving results in an error. This must not be thrown + by querying a field on the temporal without first checking if it is supported" + {:arglists (quote (["java.time.temporal.ChronoField" "java.util.Map" + "java.time.temporal.TemporalAccessor" + "java.time.format.ResolverStyle"]))} + (^js/JSJoda.TemporalAccessor + [^js/JSJoda.ChronoField this ^java.util.Map field-values + ^js/JSJoda.TemporalAccessor partial-temporal + ^js/JSJoda.ResolverStyle resolver-style] + (.resolve this field-values partial-temporal resolver-style))) + +(defn ordinal + "Returns the ordinal of this enumeration constant (its position + in its enum declaration, where the initial constant is assigned + an ordinal of zero). + + Most programmers will have no use for this method. It is + designed for use by sophisticated enum-based data structures, such + as {@link java.util.EnumSet} and {@link java.util.EnumMap}. + + @return the ordinal of this enumeration constant" + {:arglists (quote (["java.time.temporal.ChronoField"]))} + (^int [^js/JSJoda.ChronoField this] (.ordinal this))) + +(defn check-valid-int-value + "Checks that the specified value is valid and fits in an {@code int}. + + This validates that the value is within the outer range of valid values + returned by {@link #range()}. + It also checks that all valid values are within the bounds of an {@code int}. + + This method checks against the range of the field in the ISO-8601 calendar system. + This range may be incorrect for other calendar systems. + Use {@link Chronology#range(ChronoField)} to access the correct range + for a different calendar system. + + @param value the value to check + @return the value that was passed in" + {:arglists (quote (["java.time.temporal.ChronoField" "long"]))} + (^int [^js/JSJoda.ChronoField this ^long value] + (.checkValidIntValue this value))) + +(defn get-base-unit + {:arglists (quote (["java.time.temporal.ChronoField"]))} + (^js/JSJoda.TemporalUnit [^js/JSJoda.ChronoField this] (.baseUnit this))) + +(defn to-string + {:arglists (quote (["java.time.temporal.ChronoField"]))} + (^java.lang.String [^js/JSJoda.ChronoField this] (.toString this))) + +(defn is-date-based + "Checks if this field represents a component of a date. + + Fields from day-of-week to era are date-based. + + @return true if it is a component of a date" + {:arglists (quote (["java.time.temporal.ChronoField"]))} + (^boolean [^js/JSJoda.ChronoField this] (.isDateBased this))) + +(defn get-display-name + {:arglists (quote (["java.time.temporal.ChronoField" "java.util.Locale"]))} + (^java.lang.String [^js/JSJoda.ChronoField this ^java.util.Locale locale] + (.displayName this locale))) + +(defn name + "Returns the name of this enum constant, exactly as declared in its + enum declaration. + + Most programmers should use the {@link #toString} method in + preference to this one, as the toString method may return + a more user-friendly name. This method is designed primarily for + use in specialized situations where correctness depends on getting the + exact name, which will not vary from release to release. + + @return the name of this enum constant" + {:arglists (quote (["java.time.temporal.ChronoField"]))} + (^java.lang.String [^js/JSJoda.ChronoField this] (.name this))) + +(defn is-supported-by + {:arglists (quote (["java.time.temporal.ChronoField" + "java.time.temporal.TemporalAccessor"]))} + (^boolean [^js/JSJoda.ChronoField this ^js/JSJoda.TemporalAccessor temporal] + (.isSupportedBy this temporal))) + +(defn range-refined-by + {:arglists (quote (["java.time.temporal.ChronoField" + "java.time.temporal.TemporalAccessor"]))} + (^js/JSJoda.ValueRange + [^js/JSJoda.ChronoField this ^js/JSJoda.TemporalAccessor temporal] + (.rangeRefinedBy this temporal))) + +(defn get-declaring-class + "Returns the Class object corresponding to this enum constant's + enum type. Two enum constants e1 and e2 are of the + same enum type if and only if + e1.getDeclaringClass() == e2.getDeclaringClass(). + (The value returned by this method may differ from the one returned + by the {@link Object#getClass} method for enum constants with + constant-specific class bodies.) + + @return the Class object corresponding to this enum constant's + enum type" + {:arglists (quote (["java.time.temporal.ChronoField"]))} + (^java.lang.Class [^js/JSJoda.ChronoField this] (.declaringClass this))) + +(defn hash-code + "Returns a hash code for this enum constant. + + @return a hash code for this enum constant." + {:arglists (quote (["java.time.temporal.ChronoField"]))} + (^int [^js/JSJoda.ChronoField this] (.hashCode this))) + +(defn adjust-into + {:arglists (quote (["java.time.temporal.ChronoField" + "java.time.temporal.Temporal" "long"]))} + (^js/JSJoda.Temporal + [^js/JSJoda.ChronoField this ^js/JSJoda.Temporal temporal ^long new-value] + (.adjustInto this temporal new-value))) + +(defn get-from + {:arglists (quote (["java.time.temporal.ChronoField" + "java.time.temporal.TemporalAccessor"]))} + (^long [^js/JSJoda.ChronoField this ^js/JSJoda.TemporalAccessor temporal] + (.from this temporal))) + +(defn compare-to + "Compares this enum with the specified object for order. Returns a + negative integer, zero, or a positive integer as this object is less + than, equal to, or greater than the specified object. + + Enum constants are only comparable to other enum constants of the + same enum type. The natural order implemented by this + method is the order in which the constants are declared." + {:arglists (quote (["java.time.temporal.ChronoField" "java.lang.Enum"]))} + (^int [^js/JSJoda.ChronoField this ^java.lang.Enum o] (.compareTo this o))) + +(defn equals + "Returns true if the specified object is equal to this + enum constant. + + @param other the object to be compared for equality with this object. + @return true if the specified object is equal to this + enum constant." + {:arglists (quote (["java.time.temporal.ChronoField" "java.lang.Object"]))} + (^boolean [^js/JSJoda.ChronoField this ^java.lang.Object other] + (.equals this other))) + +(defn is-time-based + "Checks if this field represents a component of a time. + + Fields from nano-of-second to am-pm-of-day are time-based. + + @return true if it is a component of a time" + {:arglists (quote (["java.time.temporal.ChronoField"]))} + (^boolean [^js/JSJoda.ChronoField this] (.isTimeBased this))) + +(defn check-valid-value + "Checks that the specified value is valid for this field. + + This validates that the value is within the outer range of valid values + returned by {@link #range()}. + + This method checks against the range of the field in the ISO-8601 calendar system. + This range may be incorrect for other calendar systems. + Use {@link Chronology#range(ChronoField)} to access the correct range + for a different calendar system. + + @param value the value to check + @return the value that was passed in" + {:arglists (quote (["java.time.temporal.ChronoField" "long"]))} + (^long [^js/JSJoda.ChronoField this ^long value] + (.checkValidValue this value))) diff --git a/src/cljc/java_time/temporal/chrono_unit.clj b/src/cljc/java_time/temporal/chrono_unit.clj index c1d97f2..9631687 100644 --- a/src/cljc/java_time/temporal/chrono_unit.clj +++ b/src/cljc/java_time/temporal/chrono_unit.clj @@ -1,33 +1,278 @@ -(ns cljc.java-time.temporal.chrono-unit (:refer-clojure :exclude [abs get range format min max next name resolve short]) (:require [cljc.java-time.extn.calendar-awareness]) (:import [java.time.temporal ChronoUnit])) -(def millis java.time.temporal.ChronoUnit/MILLIS) -(def minutes java.time.temporal.ChronoUnit/MINUTES) -(def micros java.time.temporal.ChronoUnit/MICROS) -(def half-days java.time.temporal.ChronoUnit/HALF_DAYS) -(def millennia java.time.temporal.ChronoUnit/MILLENNIA) -(def years java.time.temporal.ChronoUnit/YEARS) -(def decades java.time.temporal.ChronoUnit/DECADES) -(def days java.time.temporal.ChronoUnit/DAYS) -(def centuries java.time.temporal.ChronoUnit/CENTURIES) -(def weeks java.time.temporal.ChronoUnit/WEEKS) -(def hours java.time.temporal.ChronoUnit/HOURS) -(def eras java.time.temporal.ChronoUnit/ERAS) -(def seconds java.time.temporal.ChronoUnit/SECONDS) -(def months java.time.temporal.ChronoUnit/MONTHS) -(def nanos java.time.temporal.ChronoUnit/NANOS) -(def forever java.time.temporal.ChronoUnit/FOREVER) -(clojure.core/defn values {:arglists (quote ([]))} (^"java.lang.Class" [] (java.time.temporal.ChronoUnit/values))) -(clojure.core/defn value-of {:arglists (quote (["java.lang.String"] ["java.lang.Class" "java.lang.String"]))} (^java.time.temporal.ChronoUnit [^java.lang.String java-lang-String15572] (java.time.temporal.ChronoUnit/valueOf java-lang-String15572)) (^java.lang.Enum [^java.lang.Class java-lang-Class15573 ^java.lang.String java-lang-String15574] (java.time.temporal.ChronoUnit/valueOf java-lang-Class15573 java-lang-String15574))) -(clojure.core/defn ordinal {:arglists (quote (["java.time.temporal.ChronoUnit"]))} (^java.lang.Integer [^java.time.temporal.ChronoUnit this15575] (.ordinal this15575))) -(clojure.core/defn is-duration-estimated {:arglists (quote (["java.time.temporal.ChronoUnit"]))} (^java.lang.Boolean [^java.time.temporal.ChronoUnit this15576] (.isDurationEstimated this15576))) -(clojure.core/defn to-string {:arglists (quote (["java.time.temporal.ChronoUnit"]))} (^java.lang.String [^java.time.temporal.ChronoUnit this15577] (.toString this15577))) -(clojure.core/defn is-date-based {:arglists (quote (["java.time.temporal.ChronoUnit"]))} (^java.lang.Boolean [^java.time.temporal.ChronoUnit this15578] (.isDateBased this15578))) -(clojure.core/defn add-to {:arglists (quote (["java.time.temporal.ChronoUnit" "java.time.temporal.Temporal" "long"]))} (^java.time.temporal.Temporal [^java.time.temporal.ChronoUnit this15579 ^java.time.temporal.Temporal java-time-temporal-Temporal15580 ^long long15581] (.addTo this15579 java-time-temporal-Temporal15580 long15581))) -(clojure.core/defn name {:arglists (quote (["java.time.temporal.ChronoUnit"]))} (^java.lang.String [^java.time.temporal.ChronoUnit this15582] (.name this15582))) -(clojure.core/defn is-supported-by {:arglists (quote (["java.time.temporal.ChronoUnit" "java.time.temporal.Temporal"]))} (^java.lang.Boolean [^java.time.temporal.ChronoUnit this15583 ^java.time.temporal.Temporal java-time-temporal-Temporal15584] (.isSupportedBy this15583 java-time-temporal-Temporal15584))) -(clojure.core/defn get-declaring-class {:arglists (quote (["java.time.temporal.ChronoUnit"]))} (^java.lang.Class [^java.time.temporal.ChronoUnit this15585] (.getDeclaringClass this15585))) -(clojure.core/defn between {:arglists (quote (["java.time.temporal.ChronoUnit" "java.time.temporal.Temporal" "java.time.temporal.Temporal"]))} (^long [^java.time.temporal.ChronoUnit this15586 ^java.time.temporal.Temporal java-time-temporal-Temporal15587 ^java.time.temporal.Temporal java-time-temporal-Temporal15588] (.between this15586 java-time-temporal-Temporal15587 java-time-temporal-Temporal15588))) -(clojure.core/defn hash-code {:arglists (quote (["java.time.temporal.ChronoUnit"]))} (^java.lang.Integer [^java.time.temporal.ChronoUnit this15589] (.hashCode this15589))) -(clojure.core/defn compare-to {:arglists (quote (["java.time.temporal.ChronoUnit" "java.lang.Enum"]))} (^java.lang.Integer [^java.time.temporal.ChronoUnit this15590 ^java.lang.Enum java-lang-Enum15591] (.compareTo this15590 java-lang-Enum15591))) -(clojure.core/defn get-duration {:arglists (quote (["java.time.temporal.ChronoUnit"]))} (^java.time.Duration [^java.time.temporal.ChronoUnit this15592] (.getDuration this15592))) -(clojure.core/defn equals {:arglists (quote (["java.time.temporal.ChronoUnit" "java.lang.Object"]))} (^java.lang.Boolean [^java.time.temporal.ChronoUnit this15593 ^java.lang.Object java-lang-Object15594] (.equals this15593 java-lang-Object15594))) -(clojure.core/defn is-time-based {:arglists (quote (["java.time.temporal.ChronoUnit"]))} (^java.lang.Boolean [^java.time.temporal.ChronoUnit this15595] (.isTimeBased this15595))) +(ns cljc.java-time.temporal.chrono-unit + (:refer-clojure :exclude + [abs get range format min max next name resolve short]) + (:require [cljc.java-time.extn.calendar-awareness]) + (:import [java.time.temporal ChronoUnit])) + +(def millis + "Unit that represents the concept of a millisecond. + For the ISO calendar system, it is equal to the 1000th part of the second unit." + java.time.temporal.ChronoUnit/MILLIS) + +(def minutes + "Unit that represents the concept of a minute. + For the ISO calendar system, it is equal to 60 seconds." + java.time.temporal.ChronoUnit/MINUTES) + +(def micros + "Unit that represents the concept of a microsecond. + For the ISO calendar system, it is equal to the 1,000,000th part of the second unit." + java.time.temporal.ChronoUnit/MICROS) + +(def half-days + "Unit that represents the concept of half a day, as used in AM/PM. + For the ISO calendar system, it is equal to 12 hours." + java.time.temporal.ChronoUnit/HALF_DAYS) + +(def millennia + "Unit that represents the concept of a millennium. + For the ISO calendar system, it is equal to 1000 years. + + When used with other calendar systems it must correspond to an integral number of days + and is normally an integral number of years." + java.time.temporal.ChronoUnit/MILLENNIA) + +(def years + "Unit that represents the concept of a year. + For the ISO calendar system, it is equal to 12 months. + The estimated duration of a year is {@code 365.2425 Days}. + + When used with other calendar systems it must correspond to an integral number of days + or months roughly equal to a year defined by the passage of the Earth around the Sun." + java.time.temporal.ChronoUnit/YEARS) + +(def decades + "Unit that represents the concept of a decade. + For the ISO calendar system, it is equal to 10 years. + + When used with other calendar systems it must correspond to an integral number of days + and is normally an integral number of years." + java.time.temporal.ChronoUnit/DECADES) + +(def days + "Unit that represents the concept of a day. + For the ISO calendar system, it is the standard day from midnight to midnight. + The estimated duration of a day is {@code 24 Hours}. + + When used with other calendar systems it must correspond to the day defined by + the rising and setting of the Sun on Earth. It is not required that days begin + at midnight - when converting between calendar systems, the date should be + equivalent at midday." + java.time.temporal.ChronoUnit/DAYS) + +(def centuries + "Unit that represents the concept of a century. + For the ISO calendar system, it is equal to 100 years. + + When used with other calendar systems it must correspond to an integral number of days + and is normally an integral number of years." + java.time.temporal.ChronoUnit/CENTURIES) + +(def weeks + "Unit that represents the concept of a week. + For the ISO calendar system, it is equal to 7 days. + + When used with other calendar systems it must correspond to an integral number of days." + java.time.temporal.ChronoUnit/WEEKS) + +(def hours + "Unit that represents the concept of an hour. + For the ISO calendar system, it is equal to 60 minutes." + java.time.temporal.ChronoUnit/HOURS) + +(def eras + "Unit that represents the concept of an era. + The ISO calendar system doesn't have eras thus it is impossible to add + an era to a date or date-time. + The estimated duration of the era is artificially defined as {@code 1,000,000,000 Years}. + + When used with other calendar systems there are no restrictions on the unit." + java.time.temporal.ChronoUnit/ERAS) + +(def seconds + "Unit that represents the concept of a second. + For the ISO calendar system, it is equal to the second in the SI system + of units, except around a leap-second." + java.time.temporal.ChronoUnit/SECONDS) + +(def months + "Unit that represents the concept of a month. + For the ISO calendar system, the length of the month varies by month-of-year. + The estimated duration of a month is one twelfth of {@code 365.2425 Days}. + + When used with other calendar systems it must correspond to an integral number of days." + java.time.temporal.ChronoUnit/MONTHS) + +(def nanos + "Unit that represents the concept of a nanosecond, the smallest supported unit of time. + For the ISO calendar system, it is equal to the 1,000,000,000th part of the second unit." + java.time.temporal.ChronoUnit/NANOS) + +(def forever + "Artificial unit that represents the concept of forever. + This is primarily used with {@link TemporalField} to represent unbounded fields + such as the year or era. + The estimated duration of the era is artificially defined as the largest duration + supported by {@code Duration}." + java.time.temporal.ChronoUnit/FOREVER) + +(defn values + {:arglists (quote ([]))} + (^"java.lang.Class" [] (java.time.temporal.ChronoUnit/values))) + +(defn value-of + {:arglists (quote (["java.lang.String"] + ["java.lang.Class" "java.lang.String"]))} + (^java.time.temporal.ChronoUnit [^java.lang.String name] + (java.time.temporal.ChronoUnit/valueOf name)) + (^java.lang.Enum [^java.lang.Class enum-type ^java.lang.String name] + (java.time.temporal.ChronoUnit/valueOf enum-type name))) + +(defn ordinal + "Returns the ordinal of this enumeration constant (its position + in its enum declaration, where the initial constant is assigned + an ordinal of zero). + + Most programmers will have no use for this method. It is + designed for use by sophisticated enum-based data structures, such + as {@link java.util.EnumSet} and {@link java.util.EnumMap}. + + @return the ordinal of this enumeration constant" + {:arglists (quote (["java.time.temporal.ChronoUnit"]))} + (^java.lang.Integer [^java.time.temporal.ChronoUnit this] (.ordinal this))) + +(defn is-duration-estimated + "Checks if the duration of the unit is an estimate. + + All time units in this class are considered to be accurate, while all date + units in this class are considered to be estimated. + + This definition ignores leap seconds, but considers that Days vary due to + daylight saving time and months have different lengths. + + @return true if the duration is estimated, false if accurate" + {:arglists (quote (["java.time.temporal.ChronoUnit"]))} + (^java.lang.Boolean [^java.time.temporal.ChronoUnit this] + (.isDurationEstimated this))) + +(defn to-string + {:arglists (quote (["java.time.temporal.ChronoUnit"]))} + (^java.lang.String [^java.time.temporal.ChronoUnit this] (.toString this))) + +(defn is-date-based + "Checks if this unit is a date unit. + + All units from days to eras inclusive are date-based. + Time-based units and {@code FOREVER} return false. + + @return true if a date unit, false if a time unit" + {:arglists (quote (["java.time.temporal.ChronoUnit"]))} + (^java.lang.Boolean [^java.time.temporal.ChronoUnit this] + (.isDateBased this))) + +(defn add-to + {:arglists (quote (["java.time.temporal.ChronoUnit" + "java.time.temporal.Temporal" "long"]))} + (^java.time.temporal.Temporal + [^java.time.temporal.ChronoUnit this ^java.time.temporal.Temporal temporal + ^long amount] + (.addTo this temporal amount))) + +(defn name + "Returns the name of this enum constant, exactly as declared in its + enum declaration. + + Most programmers should use the {@link #toString} method in + preference to this one, as the toString method may return + a more user-friendly name. This method is designed primarily for + use in specialized situations where correctness depends on getting the + exact name, which will not vary from release to release. + + @return the name of this enum constant" + {:arglists (quote (["java.time.temporal.ChronoUnit"]))} + (^java.lang.String [^java.time.temporal.ChronoUnit this] (.name this))) + +(defn is-supported-by + {:arglists (quote (["java.time.temporal.ChronoUnit" + "java.time.temporal.Temporal"]))} + (^java.lang.Boolean + [^java.time.temporal.ChronoUnit this ^java.time.temporal.Temporal temporal] + (.isSupportedBy this temporal))) + +(defn get-declaring-class + "Returns the Class object corresponding to this enum constant's + enum type. Two enum constants e1 and e2 are of the + same enum type if and only if + e1.getDeclaringClass() == e2.getDeclaringClass(). + (The value returned by this method may differ from the one returned + by the {@link Object#getClass} method for enum constants with + constant-specific class bodies.) + + @return the Class object corresponding to this enum constant's + enum type" + {:arglists (quote (["java.time.temporal.ChronoUnit"]))} + (^java.lang.Class [^java.time.temporal.ChronoUnit this] + (.getDeclaringClass this))) + +(defn between + {:arglists (quote (["java.time.temporal.ChronoUnit" + "java.time.temporal.Temporal" + "java.time.temporal.Temporal"]))} + (^long + [^java.time.temporal.ChronoUnit this + ^java.time.temporal.Temporal temporal1-inclusive + ^java.time.temporal.Temporal temporal2-exclusive] + (.between this temporal1-inclusive temporal2-exclusive))) + +(defn hash-code + "Returns a hash code for this enum constant. + + @return a hash code for this enum constant." + {:arglists (quote (["java.time.temporal.ChronoUnit"]))} + (^java.lang.Integer [^java.time.temporal.ChronoUnit this] (.hashCode this))) + +(defn compare-to + "Compares this enum with the specified object for order. Returns a + negative integer, zero, or a positive integer as this object is less + than, equal to, or greater than the specified object. + + Enum constants are only comparable to other enum constants of the + same enum type. The natural order implemented by this + method is the order in which the constants are declared." + {:arglists (quote (["java.time.temporal.ChronoUnit" "java.lang.Enum"]))} + (^java.lang.Integer [^java.time.temporal.ChronoUnit this ^java.lang.Enum o] + (.compareTo this o))) + +(defn get-duration + "Gets the estimated duration of this unit in the ISO calendar system. + + All of the units in this class have an estimated duration. + Days vary due to daylight saving time, while months have different lengths. + + @return the estimated duration of this unit, not null" + {:arglists (quote (["java.time.temporal.ChronoUnit"]))} + (^java.time.Duration [^java.time.temporal.ChronoUnit this] + (.getDuration this))) + +(defn equals + "Returns true if the specified object is equal to this + enum constant. + + @param other the object to be compared for equality with this object. + @return true if the specified object is equal to this + enum constant." + {:arglists (quote (["java.time.temporal.ChronoUnit" "java.lang.Object"]))} + (^java.lang.Boolean + [^java.time.temporal.ChronoUnit this ^java.lang.Object other] + (.equals this other))) + +(defn is-time-based + "Checks if this unit is a time unit. + + All units from nanos to half-days inclusive are time-based. + Date-based units and {@code FOREVER} return false. + + @return true if a time unit, false if a date unit" + {:arglists (quote (["java.time.temporal.ChronoUnit"]))} + (^java.lang.Boolean [^java.time.temporal.ChronoUnit this] + (.isTimeBased this))) diff --git a/src/cljc/java_time/temporal/chrono_unit.cljs b/src/cljc/java_time/temporal/chrono_unit.cljs index 88f8052..0d7b512 100644 --- a/src/cljc/java_time/temporal/chrono_unit.cljs +++ b/src/cljc/java_time/temporal/chrono_unit.cljs @@ -1,33 +1,269 @@ -(ns cljc.java-time.temporal.chrono-unit (:refer-clojure :exclude [abs get range format min max next name resolve short]) (:require [cljc.java-time.extn.calendar-awareness] [goog.object] [java.time.temporal :refer [ChronoUnit]])) -(def millis (goog.object/get java.time.temporal.ChronoUnit "MILLIS")) -(def minutes (goog.object/get java.time.temporal.ChronoUnit "MINUTES")) -(def micros (goog.object/get java.time.temporal.ChronoUnit "MICROS")) -(def half-days (goog.object/get java.time.temporal.ChronoUnit "HALF_DAYS")) -(def millennia (goog.object/get java.time.temporal.ChronoUnit "MILLENNIA")) -(def years (goog.object/get java.time.temporal.ChronoUnit "YEARS")) -(def decades (goog.object/get java.time.temporal.ChronoUnit "DECADES")) -(def days (goog.object/get java.time.temporal.ChronoUnit "DAYS")) -(def centuries (goog.object/get java.time.temporal.ChronoUnit "CENTURIES")) -(def weeks (goog.object/get java.time.temporal.ChronoUnit "WEEKS")) -(def hours (goog.object/get java.time.temporal.ChronoUnit "HOURS")) -(def eras (goog.object/get java.time.temporal.ChronoUnit "ERAS")) -(def seconds (goog.object/get java.time.temporal.ChronoUnit "SECONDS")) -(def months (goog.object/get java.time.temporal.ChronoUnit "MONTHS")) -(def nanos (goog.object/get java.time.temporal.ChronoUnit "NANOS")) -(def forever (goog.object/get java.time.temporal.ChronoUnit "FOREVER")) -(clojure.core/defn values {:arglists (quote ([]))} (^"java.lang.Class" [] (js-invoke java.time.temporal.ChronoUnit "values"))) -(clojure.core/defn value-of {:arglists (quote (["java.lang.String"] ["java.lang.Class" "java.lang.String"]))} (^js/JSJoda.ChronoUnit [^java.lang.String java-lang-String15596] (js-invoke java.time.temporal.ChronoUnit "valueOf" java-lang-String15596)) (^java.lang.Enum [^java.lang.Class java-lang-Class15597 ^java.lang.String java-lang-String15598] (js-invoke java.time.temporal.ChronoUnit "valueOf" java-lang-Class15597 java-lang-String15598))) -(clojure.core/defn ordinal {:arglists (quote (["java.time.temporal.ChronoUnit"]))} (^int [^js/JSJoda.ChronoUnit this15599] (.ordinal this15599))) -(clojure.core/defn is-duration-estimated {:arglists (quote (["java.time.temporal.ChronoUnit"]))} (^boolean [^js/JSJoda.ChronoUnit this15600] (.isDurationEstimated this15600))) -(clojure.core/defn to-string {:arglists (quote (["java.time.temporal.ChronoUnit"]))} (^java.lang.String [^js/JSJoda.ChronoUnit this15601] (.toString this15601))) -(clojure.core/defn is-date-based {:arglists (quote (["java.time.temporal.ChronoUnit"]))} (^boolean [^js/JSJoda.ChronoUnit this15602] (.isDateBased this15602))) -(clojure.core/defn add-to {:arglists (quote (["java.time.temporal.ChronoUnit" "java.time.temporal.Temporal" "long"]))} (^js/JSJoda.Temporal [^js/JSJoda.ChronoUnit this15603 ^js/JSJoda.Temporal java-time-temporal-Temporal15604 ^long long15605] (.addTo this15603 java-time-temporal-Temporal15604 long15605))) -(clojure.core/defn name {:arglists (quote (["java.time.temporal.ChronoUnit"]))} (^java.lang.String [^js/JSJoda.ChronoUnit this15606] (.name this15606))) -(clojure.core/defn is-supported-by {:arglists (quote (["java.time.temporal.ChronoUnit" "java.time.temporal.Temporal"]))} (^boolean [^js/JSJoda.ChronoUnit this15607 ^js/JSJoda.Temporal java-time-temporal-Temporal15608] (.isSupportedBy this15607 java-time-temporal-Temporal15608))) -(clojure.core/defn get-declaring-class {:arglists (quote (["java.time.temporal.ChronoUnit"]))} (^java.lang.Class [^js/JSJoda.ChronoUnit this15609] (.declaringClass this15609))) -(clojure.core/defn between {:arglists (quote (["java.time.temporal.ChronoUnit" "java.time.temporal.Temporal" "java.time.temporal.Temporal"]))} (^long [^js/JSJoda.ChronoUnit this15610 ^js/JSJoda.Temporal java-time-temporal-Temporal15611 ^js/JSJoda.Temporal java-time-temporal-Temporal15612] (.between this15610 java-time-temporal-Temporal15611 java-time-temporal-Temporal15612))) -(clojure.core/defn hash-code {:arglists (quote (["java.time.temporal.ChronoUnit"]))} (^int [^js/JSJoda.ChronoUnit this15613] (.hashCode this15613))) -(clojure.core/defn compare-to {:arglists (quote (["java.time.temporal.ChronoUnit" "java.lang.Enum"]))} (^int [^js/JSJoda.ChronoUnit this15614 ^java.lang.Enum java-lang-Enum15615] (.compareTo this15614 java-lang-Enum15615))) -(clojure.core/defn get-duration {:arglists (quote (["java.time.temporal.ChronoUnit"]))} (^js/JSJoda.Duration [^js/JSJoda.ChronoUnit this15616] (.duration this15616))) -(clojure.core/defn equals {:arglists (quote (["java.time.temporal.ChronoUnit" "java.lang.Object"]))} (^boolean [^js/JSJoda.ChronoUnit this15617 ^java.lang.Object java-lang-Object15618] (.equals this15617 java-lang-Object15618))) -(clojure.core/defn is-time-based {:arglists (quote (["java.time.temporal.ChronoUnit"]))} (^boolean [^js/JSJoda.ChronoUnit this15619] (.isTimeBased this15619))) +(ns cljc.java-time.temporal.chrono-unit + (:refer-clojure :exclude + [abs get range format min max next name resolve short]) + (:require [cljc.java-time.extn.calendar-awareness] + [goog.object] + [java.time.temporal :refer [ChronoUnit]])) + +(def millis + "Unit that represents the concept of a millisecond. + For the ISO calendar system, it is equal to the 1000th part of the second unit." + (goog.object/get java.time.temporal.ChronoUnit "MILLIS")) + +(def minutes + "Unit that represents the concept of a minute. + For the ISO calendar system, it is equal to 60 seconds." + (goog.object/get java.time.temporal.ChronoUnit "MINUTES")) + +(def micros + "Unit that represents the concept of a microsecond. + For the ISO calendar system, it is equal to the 1,000,000th part of the second unit." + (goog.object/get java.time.temporal.ChronoUnit "MICROS")) + +(def half-days + "Unit that represents the concept of half a day, as used in AM/PM. + For the ISO calendar system, it is equal to 12 hours." + (goog.object/get java.time.temporal.ChronoUnit "HALF_DAYS")) + +(def millennia + "Unit that represents the concept of a millennium. + For the ISO calendar system, it is equal to 1000 years. + + When used with other calendar systems it must correspond to an integral number of days + and is normally an integral number of years." + (goog.object/get java.time.temporal.ChronoUnit "MILLENNIA")) + +(def years + "Unit that represents the concept of a year. + For the ISO calendar system, it is equal to 12 months. + The estimated duration of a year is {@code 365.2425 Days}. + + When used with other calendar systems it must correspond to an integral number of days + or months roughly equal to a year defined by the passage of the Earth around the Sun." + (goog.object/get java.time.temporal.ChronoUnit "YEARS")) + +(def decades + "Unit that represents the concept of a decade. + For the ISO calendar system, it is equal to 10 years. + + When used with other calendar systems it must correspond to an integral number of days + and is normally an integral number of years." + (goog.object/get java.time.temporal.ChronoUnit "DECADES")) + +(def days + "Unit that represents the concept of a day. + For the ISO calendar system, it is the standard day from midnight to midnight. + The estimated duration of a day is {@code 24 Hours}. + + When used with other calendar systems it must correspond to the day defined by + the rising and setting of the Sun on Earth. It is not required that days begin + at midnight - when converting between calendar systems, the date should be + equivalent at midday." + (goog.object/get java.time.temporal.ChronoUnit "DAYS")) + +(def centuries + "Unit that represents the concept of a century. + For the ISO calendar system, it is equal to 100 years. + + When used with other calendar systems it must correspond to an integral number of days + and is normally an integral number of years." + (goog.object/get java.time.temporal.ChronoUnit "CENTURIES")) + +(def weeks + "Unit that represents the concept of a week. + For the ISO calendar system, it is equal to 7 days. + + When used with other calendar systems it must correspond to an integral number of days." + (goog.object/get java.time.temporal.ChronoUnit "WEEKS")) + +(def hours + "Unit that represents the concept of an hour. + For the ISO calendar system, it is equal to 60 minutes." + (goog.object/get java.time.temporal.ChronoUnit "HOURS")) + +(def eras + "Unit that represents the concept of an era. + The ISO calendar system doesn't have eras thus it is impossible to add + an era to a date or date-time. + The estimated duration of the era is artificially defined as {@code 1,000,000,000 Years}. + + When used with other calendar systems there are no restrictions on the unit." + (goog.object/get java.time.temporal.ChronoUnit "ERAS")) + +(def seconds + "Unit that represents the concept of a second. + For the ISO calendar system, it is equal to the second in the SI system + of units, except around a leap-second." + (goog.object/get java.time.temporal.ChronoUnit "SECONDS")) + +(def months + "Unit that represents the concept of a month. + For the ISO calendar system, the length of the month varies by month-of-year. + The estimated duration of a month is one twelfth of {@code 365.2425 Days}. + + When used with other calendar systems it must correspond to an integral number of days." + (goog.object/get java.time.temporal.ChronoUnit "MONTHS")) + +(def nanos + "Unit that represents the concept of a nanosecond, the smallest supported unit of time. + For the ISO calendar system, it is equal to the 1,000,000,000th part of the second unit." + (goog.object/get java.time.temporal.ChronoUnit "NANOS")) + +(def forever + "Artificial unit that represents the concept of forever. + This is primarily used with {@link TemporalField} to represent unbounded fields + such as the year or era. + The estimated duration of the era is artificially defined as the largest duration + supported by {@code Duration}." + (goog.object/get java.time.temporal.ChronoUnit "FOREVER")) + +(defn values + {:arglists (quote ([]))} + (^"java.lang.Class" [] (js-invoke java.time.temporal.ChronoUnit "values"))) + +(defn value-of + {:arglists (quote (["java.lang.String"] + ["java.lang.Class" "java.lang.String"]))} + (^js/JSJoda.ChronoUnit [^java.lang.String name] + (js-invoke java.time.temporal.ChronoUnit "valueOf" name)) + (^java.lang.Enum [^java.lang.Class enum-type ^java.lang.String name] + (js-invoke java.time.temporal.ChronoUnit "valueOf" enum-type name))) + +(defn ordinal + "Returns the ordinal of this enumeration constant (its position + in its enum declaration, where the initial constant is assigned + an ordinal of zero). + + Most programmers will have no use for this method. It is + designed for use by sophisticated enum-based data structures, such + as {@link java.util.EnumSet} and {@link java.util.EnumMap}. + + @return the ordinal of this enumeration constant" + {:arglists (quote (["java.time.temporal.ChronoUnit"]))} + (^int [^js/JSJoda.ChronoUnit this] (.ordinal this))) + +(defn is-duration-estimated + "Checks if the duration of the unit is an estimate. + + All time units in this class are considered to be accurate, while all date + units in this class are considered to be estimated. + + This definition ignores leap seconds, but considers that Days vary due to + daylight saving time and months have different lengths. + + @return true if the duration is estimated, false if accurate" + {:arglists (quote (["java.time.temporal.ChronoUnit"]))} + (^boolean [^js/JSJoda.ChronoUnit this] (.isDurationEstimated this))) + +(defn to-string + {:arglists (quote (["java.time.temporal.ChronoUnit"]))} + (^java.lang.String [^js/JSJoda.ChronoUnit this] (.toString this))) + +(defn is-date-based + "Checks if this unit is a date unit. + + All units from days to eras inclusive are date-based. + Time-based units and {@code FOREVER} return false. + + @return true if a date unit, false if a time unit" + {:arglists (quote (["java.time.temporal.ChronoUnit"]))} + (^boolean [^js/JSJoda.ChronoUnit this] (.isDateBased this))) + +(defn add-to + {:arglists (quote (["java.time.temporal.ChronoUnit" + "java.time.temporal.Temporal" "long"]))} + (^js/JSJoda.Temporal + [^js/JSJoda.ChronoUnit this ^js/JSJoda.Temporal temporal ^long amount] + (.addTo this temporal amount))) + +(defn name + "Returns the name of this enum constant, exactly as declared in its + enum declaration. + + Most programmers should use the {@link #toString} method in + preference to this one, as the toString method may return + a more user-friendly name. This method is designed primarily for + use in specialized situations where correctness depends on getting the + exact name, which will not vary from release to release. + + @return the name of this enum constant" + {:arglists (quote (["java.time.temporal.ChronoUnit"]))} + (^java.lang.String [^js/JSJoda.ChronoUnit this] (.name this))) + +(defn is-supported-by + {:arglists (quote (["java.time.temporal.ChronoUnit" + "java.time.temporal.Temporal"]))} + (^boolean [^js/JSJoda.ChronoUnit this ^js/JSJoda.Temporal temporal] + (.isSupportedBy this temporal))) + +(defn get-declaring-class + "Returns the Class object corresponding to this enum constant's + enum type. Two enum constants e1 and e2 are of the + same enum type if and only if + e1.getDeclaringClass() == e2.getDeclaringClass(). + (The value returned by this method may differ from the one returned + by the {@link Object#getClass} method for enum constants with + constant-specific class bodies.) + + @return the Class object corresponding to this enum constant's + enum type" + {:arglists (quote (["java.time.temporal.ChronoUnit"]))} + (^java.lang.Class [^js/JSJoda.ChronoUnit this] (.declaringClass this))) + +(defn between + {:arglists (quote (["java.time.temporal.ChronoUnit" + "java.time.temporal.Temporal" + "java.time.temporal.Temporal"]))} + (^long + [^js/JSJoda.ChronoUnit this ^js/JSJoda.Temporal temporal1-inclusive + ^js/JSJoda.Temporal temporal2-exclusive] + (.between this temporal1-inclusive temporal2-exclusive))) + +(defn hash-code + "Returns a hash code for this enum constant. + + @return a hash code for this enum constant." + {:arglists (quote (["java.time.temporal.ChronoUnit"]))} + (^int [^js/JSJoda.ChronoUnit this] (.hashCode this))) + +(defn compare-to + "Compares this enum with the specified object for order. Returns a + negative integer, zero, or a positive integer as this object is less + than, equal to, or greater than the specified object. + + Enum constants are only comparable to other enum constants of the + same enum type. The natural order implemented by this + method is the order in which the constants are declared." + {:arglists (quote (["java.time.temporal.ChronoUnit" "java.lang.Enum"]))} + (^int [^js/JSJoda.ChronoUnit this ^java.lang.Enum o] (.compareTo this o))) + +(defn get-duration + "Gets the estimated duration of this unit in the ISO calendar system. + + All of the units in this class have an estimated duration. + Days vary due to daylight saving time, while months have different lengths. + + @return the estimated duration of this unit, not null" + {:arglists (quote (["java.time.temporal.ChronoUnit"]))} + (^js/JSJoda.Duration [^js/JSJoda.ChronoUnit this] (.duration this))) + +(defn equals + "Returns true if the specified object is equal to this + enum constant. + + @param other the object to be compared for equality with this object. + @return true if the specified object is equal to this + enum constant." + {:arglists (quote (["java.time.temporal.ChronoUnit" "java.lang.Object"]))} + (^boolean [^js/JSJoda.ChronoUnit this ^java.lang.Object other] + (.equals this other))) + +(defn is-time-based + "Checks if this unit is a time unit. + + All units from nanos to half-days inclusive are time-based. + Date-based units and {@code FOREVER} return false. + + @return true if a time unit, false if a date unit" + {:arglists (quote (["java.time.temporal.ChronoUnit"]))} + (^boolean [^js/JSJoda.ChronoUnit this] (.isTimeBased this))) diff --git a/src/cljc/java_time/temporal/iso_fields.clj b/src/cljc/java_time/temporal/iso_fields.clj index 93ce036..86c5050 100644 --- a/src/cljc/java_time/temporal/iso_fields.clj +++ b/src/cljc/java_time/temporal/iso_fields.clj @@ -1,7 +1,22 @@ -(ns cljc.java-time.temporal.iso-fields (:refer-clojure :exclude [abs get range format min max next name resolve short]) (:require [cljc.java-time.extn.calendar-awareness]) (:import [java.time.temporal IsoFields])) +(ns cljc.java-time.temporal.iso-fields + (:refer-clojure :exclude + [abs get range format min max next name resolve short]) + (:require [cljc.java-time.extn.calendar-awareness]) + (:import [java.time.temporal IsoFields])) + (def week-based-year java.time.temporal.IsoFields/WEEK_BASED_YEAR) -(def week-of-week-based-year java.time.temporal.IsoFields/WEEK_OF_WEEK_BASED_YEAR) -(def quarter-years java.time.temporal.IsoFields/QUARTER_YEARS) -(def week-based-years java.time.temporal.IsoFields/WEEK_BASED_YEARS) + +(def week-of-week-based-year + java.time.temporal.IsoFields/WEEK_OF_WEEK_BASED_YEAR) + +(def quarter-years + "Unit that represents the concept of a quarter-year." + java.time.temporal.IsoFields/QUARTER_YEARS) + +(def week-based-years + "Unit that represents the concept of a week-based-year." + java.time.temporal.IsoFields/WEEK_BASED_YEARS) + (def day-of-quarter java.time.temporal.IsoFields/DAY_OF_QUARTER) + (def quarter-of-year java.time.temporal.IsoFields/QUARTER_OF_YEAR) diff --git a/src/cljc/java_time/temporal/iso_fields.cljs b/src/cljc/java_time/temporal/iso_fields.cljs index 9708d7d..9c83ee1 100644 --- a/src/cljc/java_time/temporal/iso_fields.cljs +++ b/src/cljc/java_time/temporal/iso_fields.cljs @@ -1,7 +1,26 @@ -(ns cljc.java-time.temporal.iso-fields (:refer-clojure :exclude [abs get range format min max next name resolve short]) (:require [cljc.java-time.extn.calendar-awareness] [goog.object] [java.time.temporal :refer [IsoFields]])) -(def week-based-year (goog.object/get java.time.temporal.IsoFields "WEEK_BASED_YEAR")) -(def week-of-week-based-year (goog.object/get java.time.temporal.IsoFields "WEEK_OF_WEEK_BASED_YEAR")) -(def quarter-years (goog.object/get java.time.temporal.IsoFields "QUARTER_YEARS")) -(def week-based-years (goog.object/get java.time.temporal.IsoFields "WEEK_BASED_YEARS")) -(def day-of-quarter (goog.object/get java.time.temporal.IsoFields "DAY_OF_QUARTER")) -(def quarter-of-year (goog.object/get java.time.temporal.IsoFields "QUARTER_OF_YEAR")) +(ns cljc.java-time.temporal.iso-fields + (:refer-clojure :exclude + [abs get range format min max next name resolve short]) + (:require [cljc.java-time.extn.calendar-awareness] + [goog.object] + [java.time.temporal :refer [IsoFields]])) + +(def week-based-year + (goog.object/get java.time.temporal.IsoFields "WEEK_BASED_YEAR")) + +(def week-of-week-based-year + (goog.object/get java.time.temporal.IsoFields "WEEK_OF_WEEK_BASED_YEAR")) + +(def quarter-years + "Unit that represents the concept of a quarter-year." + (goog.object/get java.time.temporal.IsoFields "QUARTER_YEARS")) + +(def week-based-years + "Unit that represents the concept of a week-based-year." + (goog.object/get java.time.temporal.IsoFields "WEEK_BASED_YEARS")) + +(def day-of-quarter + (goog.object/get java.time.temporal.IsoFields "DAY_OF_QUARTER")) + +(def quarter-of-year + (goog.object/get java.time.temporal.IsoFields "QUARTER_OF_YEAR")) diff --git a/src/cljc/java_time/temporal/temporal.clj b/src/cljc/java_time/temporal/temporal.clj index 4d01c93..718adc4 100644 --- a/src/cljc/java_time/temporal/temporal.clj +++ b/src/cljc/java_time/temporal/temporal.clj @@ -1,10 +1,315 @@ -(ns cljc.java-time.temporal.temporal (:refer-clojure :exclude [abs get range format min max next name resolve short]) (:require [cljc.java-time.extn.calendar-awareness]) (:import [java.time.temporal Temporal])) -(clojure.core/defn range {:arglists (quote (["java.time.temporal.Temporal" "java.time.temporal.TemporalField"]))} (^java.time.temporal.ValueRange [^java.time.temporal.Temporal this15502 ^java.time.temporal.TemporalField java-time-temporal-TemporalField15503] (.range this15502 java-time-temporal-TemporalField15503))) -(clojure.core/defn plus {:arglists (quote (["java.time.temporal.Temporal" "long" "java.time.temporal.TemporalUnit"] ["java.time.temporal.Temporal" "java.time.temporal.TemporalAmount"]))} (^java.time.temporal.Temporal [^java.time.temporal.Temporal this15504 ^long long15505 ^java.time.temporal.ChronoUnit java-time-temporal-TemporalUnit15506] (.plus this15504 long15505 java-time-temporal-TemporalUnit15506)) (^java.time.temporal.Temporal [^java.time.temporal.Temporal this15507 ^java.time.temporal.TemporalAmount java-time-temporal-TemporalAmount15508] (.plus this15507 java-time-temporal-TemporalAmount15508))) -(clojure.core/defn query {:arglists (quote (["java.time.temporal.Temporal" "java.time.temporal.TemporalQuery"]))} (^java.lang.Object [^java.time.temporal.Temporal this15509 ^java.time.temporal.TemporalQuery java-time-temporal-TemporalQuery15510] (.query this15509 java-time-temporal-TemporalQuery15510))) -(clojure.core/defn minus {:arglists (quote (["java.time.temporal.Temporal" "long" "java.time.temporal.TemporalUnit"] ["java.time.temporal.Temporal" "java.time.temporal.TemporalAmount"]))} (^java.time.temporal.Temporal [^java.time.temporal.Temporal this15511 ^long long15512 ^java.time.temporal.ChronoUnit java-time-temporal-TemporalUnit15513] (.minus this15511 long15512 java-time-temporal-TemporalUnit15513)) (^java.time.temporal.Temporal [^java.time.temporal.Temporal this15514 ^java.time.temporal.TemporalAmount java-time-temporal-TemporalAmount15515] (.minus this15514 java-time-temporal-TemporalAmount15515))) -(clojure.core/defn get-long {:arglists (quote (["java.time.temporal.Temporal" "java.time.temporal.TemporalField"]))} (^long [^java.time.temporal.Temporal this15516 ^java.time.temporal.TemporalField java-time-temporal-TemporalField15517] (.getLong this15516 java-time-temporal-TemporalField15517))) -(clojure.core/defn until {:arglists (quote (["java.time.temporal.Temporal" "java.time.temporal.Temporal" "java.time.temporal.TemporalUnit"]))} (^long [^java.time.temporal.Temporal this15518 ^java.time.temporal.Temporal java-time-temporal-Temporal15519 ^java.time.temporal.ChronoUnit java-time-temporal-TemporalUnit15520] (.until this15518 java-time-temporal-Temporal15519 java-time-temporal-TemporalUnit15520))) -(clojure.core/defn is-supported {:arglists (quote (["java.time.temporal.Temporal" "java.time.temporal.TemporalUnit"] ["java.time.temporal.Temporal" "java.time.temporal.TemporalField"]))} (^java.lang.Boolean [this15521 G__15522] (clojure.core/cond (clojure.core/and (clojure.core/instance? java.time.temporal.ChronoUnit G__15522)) (clojure.core/let [G__15522 ^"java.time.temporal.ChronoUnit" G__15522] (.isSupported ^java.time.temporal.Temporal this15521 G__15522)) (clojure.core/and (clojure.core/instance? java.time.temporal.TemporalField G__15522)) (clojure.core/let [G__15522 ^"java.time.temporal.TemporalField" G__15522] (.isSupported ^java.time.temporal.Temporal this15521 G__15522)) :else (throw (java.lang.IllegalArgumentException. "no corresponding java.time method with these args"))))) -(clojure.core/defn with {:arglists (quote (["java.time.temporal.Temporal" "java.time.temporal.TemporalField" "long"] ["java.time.temporal.Temporal" "java.time.temporal.TemporalAdjuster"]))} (^java.time.temporal.Temporal [^java.time.temporal.Temporal this15523 ^java.time.temporal.TemporalField java-time-temporal-TemporalField15524 ^long long15525] (.with this15523 java-time-temporal-TemporalField15524 long15525)) (^java.time.temporal.Temporal [^java.time.temporal.Temporal this15526 ^java.time.temporal.TemporalAdjuster java-time-temporal-TemporalAdjuster15527] (.with this15526 java-time-temporal-TemporalAdjuster15527))) -(clojure.core/defn get {:arglists (quote (["java.time.temporal.Temporal" "java.time.temporal.TemporalField"]))} (^java.lang.Integer [^java.time.temporal.Temporal this15528 ^java.time.temporal.TemporalField java-time-temporal-TemporalField15529] (.get this15528 java-time-temporal-TemporalField15529))) +(ns cljc.java-time.temporal.temporal + (:refer-clojure :exclude + [abs get range format min max next name resolve short]) + (:require [cljc.java-time.extn.calendar-awareness]) + (:import [java.time.temporal Temporal])) + +(defn range + "Gets the range of valid values for the specified field. + + All fields can be expressed as a {@code long} integer. + This method returns an object that describes the valid range for that value. + The value of this temporal object is used to enhance the accuracy of the returned range. + If the date-time cannot return the range, because the field is unsupported or for + some other reason, an exception will be thrown. + + Note that the result only describes the minimum and maximum valid values + and it is important not to read too much into them. For example, there + could be values within the range that are invalid for the field. + + @implSpec + Implementations must check and handle all fields defined in {@link ChronoField}. + If the field is supported, then the range of the field must be returned. + If unsupported, then an {@code UnsupportedTemporalTypeException} must be thrown. + + If the field is not a {@code ChronoField}, then the result of this method + is obtained by invoking {@code TemporalField.rangeRefinedBy(TemporalAccessorl)} + passing {@code this} as the argument. + + Implementations must ensure that no observable state is altered when this + read-only method is invoked. + + The default implementation must behave equivalent to this code: +
+  if (field instanceof ChronoField) {
+    if (isSupported(field)) {
+      return field.range();
+    }
+    throw new UnsupportedTemporalTypeException(\"Unsupported field: \" + field);
+  }
+  return field.rangeRefinedBy(this);
+ 
+ + @param field the field to query the range for, not null + @return the range of valid values for the field, not null + @throws DateTimeException if the range for the field cannot be obtained + @throws UnsupportedTemporalTypeException if the field is not supported" + {:arglists (quote (["java.time.temporal.Temporal" + "java.time.temporal.TemporalField"]))} + (^java.time.temporal.ValueRange + [^java.time.temporal.Temporal this ^java.time.temporal.TemporalField field] + (.range this field))) + +(defn plus + {:arglists (quote (["java.time.temporal.Temporal" + "java.time.temporal.TemporalAmount"] + ["java.time.temporal.Temporal" "long" + "java.time.temporal.TemporalUnit"]))} + (^java.time.temporal.Temporal + [^java.time.temporal.Temporal this ^java.time.temporal.TemporalAmount amount] + (.plus this amount)) + (^java.time.temporal.Temporal + [^java.time.temporal.Temporal this ^long amount-to-add + ^java.time.temporal.ChronoUnit unit] + (.plus this amount-to-add unit))) + +(defn query + "Queries this date-time. + + This queries this date-time using the specified query strategy object. + + Queries are a key tool for extracting information from date-times. + They exists to externalize the process of querying, permitting different + approaches, as per the strategy design pattern. + Examples might be a query that checks if the date is the day before February 29th + in a leap year, or calculates the number of days to your next birthday. + + The most common query implementations are method references, such as + {@code LocalDate::from} and {@code ZoneId::from}. + Additional implementations are provided as static methods on {@link TemporalQuery}. + + @implSpec + The default implementation must behave equivalent to this code: +
+  if (query == TemporalQueries.zoneId() ||
+        query == TemporalQueries.chronology() || query == TemporalQueries.precision()) {
+    return null;
+  }
+  return query.queryFrom(this);
+ 
+ Future versions are permitted to add further queries to the if statement. + + All classes implementing this interface and overriding this method must call + {@code TemporalAccessor.super.query(query)}. JDK classes may avoid calling + super if they provide behavior equivalent to the default behaviour, however + non-JDK classes may not utilize this optimization and must call {@code super}. + + If the implementation can supply a value for one of the queries listed in the + if statement of the default implementation, then it must do so. + For example, an application-defined {@code HourMin} class storing the hour + and minute must override this method as follows: +
+  if (query == TemporalQueries.precision()) {
+    return MINUTES;
+  }
+  return TemporalAccessor.super.query(query);
+ 
+ + Implementations must ensure that no observable state is altered when this + read-only method is invoked. + + @param the type of the result + @param query the query to invoke, not null + @return the query result, null may be returned (defined by the query) + @throws DateTimeException if unable to query + @throws ArithmeticException if numeric overflow occurs" + {:arglists (quote (["java.time.temporal.Temporal" + "java.time.temporal.TemporalQuery"]))} + (^java.lang.Object + [^java.time.temporal.Temporal this ^java.time.temporal.TemporalQuery query] + (.query this query))) + +(defn minus + {:arglists (quote (["java.time.temporal.Temporal" + "java.time.temporal.TemporalAmount"] + ["java.time.temporal.Temporal" "long" + "java.time.temporal.TemporalUnit"]))} + (^java.time.temporal.Temporal + [^java.time.temporal.Temporal this ^java.time.temporal.TemporalAmount amount] + (.minus this amount)) + (^java.time.temporal.Temporal + [^java.time.temporal.Temporal this ^long amount-to-subtract + ^java.time.temporal.ChronoUnit unit] + (.minus this amount-to-subtract unit))) + +(defn get-long + "Gets the value of the specified field as a {@code long}. + + This queries the date-time for the value of the specified field. + The returned value may be outside the valid range of values for the field. + If the date-time cannot return the value, because the field is unsupported or for + some other reason, an exception will be thrown. + + @implSpec + Implementations must check and handle all fields defined in {@link ChronoField}. + If the field is supported, then the value of the field must be returned. + If unsupported, then an {@code UnsupportedTemporalTypeException} must be thrown. + + If the field is not a {@code ChronoField}, then the result of this method + is obtained by invoking {@code TemporalField.getFrom(TemporalAccessor)} + passing {@code this} as the argument. + + Implementations must ensure that no observable state is altered when this + read-only method is invoked. + + @param field the field to get, not null + @return the value for the field + @throws DateTimeException if a value for the field cannot be obtained + @throws UnsupportedTemporalTypeException if the field is not supported + @throws ArithmeticException if numeric overflow occurs" + {:arglists (quote (["java.time.temporal.Temporal" + "java.time.temporal.TemporalField"]))} + (^long + [^java.time.temporal.Temporal this ^java.time.temporal.TemporalField field] + (.getLong this field))) + +(defn until + "Calculates the amount of time until another temporal in terms of the specified unit. + + This calculates the amount of time between two temporal objects + in terms of a single {@code TemporalUnit}. + The start and end points are {@code this} and the specified temporal. + The end point is converted to be of the same type as the start point if different. + The result will be negative if the end is before the start. + For example, the amount in hours between two temporal objects can be + calculated using {@code startTime.until(endTime, HOURS)}. + + The calculation returns a whole number, representing the number of + complete units between the two temporals. + For example, the amount in hours between the times 11:30 and 13:29 + will only be one hour as it is one minute short of two hours. + + There are two equivalent ways of using this method. + The first is to invoke this method directly. + The second is to use {@link TemporalUnit#between(Temporal, Temporal)}: +
+   // these two lines are equivalent
+   temporal = start.until(end, unit);
+   temporal = unit.between(start, end);
+ 
+ The choice should be made based on which makes the code more readable. + + For example, this method allows the number of days between two dates to + be calculated: +
+  long daysBetween = start.until(end, DAYS);
+  // or alternatively
+  long daysBetween = DAYS.between(start, end);
+ 
+ + @implSpec + Implementations must begin by checking to ensure that the input temporal + object is of the same observable type as the implementation. + They must then perform the calculation for all instances of {@link ChronoUnit}. + An {@code UnsupportedTemporalTypeException} must be thrown for {@code ChronoUnit} + instances that are unsupported. + + If the unit is not a {@code ChronoUnit}, then the result of this method + is obtained by invoking {@code TemporalUnit.between(Temporal, Temporal)} + passing {@code this} as the first argument and the converted input temporal as + the second argument. + + In summary, implementations must behave in a manner equivalent to this pseudo-code: +
+  // convert the end temporal to the same type as this class
+  if (unit instanceof ChronoUnit) {
+    // if unit is supported, then calculate and return result
+    // else throw UnsupportedTemporalTypeException for unsupported units
+  }
+  return unit.between(this, convertedEndTemporal);
+ 
+ + Note that the unit's {@code between} method must only be invoked if the + two temporal objects have exactly the same type evaluated by {@code getClass()}. + + Implementations must ensure that no observable state is altered when this + read-only method is invoked. + + @param endExclusive the end temporal, exclusive, converted to be of the + same type as this object, not null + @param unit the unit to measure the amount in, not null + @return the amount of time between this temporal object and the specified one + in terms of the unit; positive if the specified object is later than this one, + negative if it is earlier than this one + @throws DateTimeException if the amount cannot be calculated, or the end + temporal cannot be converted to the same type as this temporal + @throws UnsupportedTemporalTypeException if the unit is not supported + @throws ArithmeticException if numeric overflow occurs" + {:arglists (quote (["java.time.temporal.Temporal" + "java.time.temporal.Temporal" + "java.time.temporal.TemporalUnit"]))} + (^long + [^java.time.temporal.Temporal this ^java.time.temporal.Temporal end-exclusive + ^java.time.temporal.ChronoUnit unit] + (.until this end-exclusive unit))) + +(defn is-supported + {:arglists (quote (["java.time.temporal.Temporal" + "java.time.temporal.TemporalUnit"] + ["java.time.temporal.Temporal" + "java.time.temporal.TemporalField"]))} + (^java.lang.Boolean [^java.time.temporal.Temporal this arg0] + (cond (instance? java.time.temporal.ChronoUnit arg0) + (let [^java.time.temporal.TemporalUnit unit arg0] + (.isSupported this unit)) + (instance? java.time.temporal.TemporalField arg0) + (let [^java.time.temporal.TemporalField field arg0] + (.isSupported this field)) + :else (throw (java.lang.IllegalArgumentException. + "no corresponding java.time method with these args"))))) + +(defn with + {:arglists (quote (["java.time.temporal.Temporal" + "java.time.temporal.TemporalAdjuster"] + ["java.time.temporal.Temporal" + "java.time.temporal.TemporalField" "long"]))} + (^java.time.temporal.Temporal + [^java.time.temporal.Temporal this + ^java.time.temporal.TemporalAdjuster adjuster] + (.with this adjuster)) + (^java.time.temporal.Temporal + [^java.time.temporal.Temporal this ^java.time.temporal.TemporalField field + ^long new-value] + (.with this field new-value))) + +(defn get + "Gets the value of the specified field as an {@code int}. + + This queries the date-time for the value of the specified field. + The returned value will always be within the valid range of values for the field. + If the date-time cannot return the value, because the field is unsupported or for + some other reason, an exception will be thrown. + + @implSpec + Implementations must check and handle all fields defined in {@link ChronoField}. + If the field is supported and has an {@code int} range, then the value of + the field must be returned. + If unsupported, then an {@code UnsupportedTemporalTypeException} must be thrown. + + If the field is not a {@code ChronoField}, then the result of this method + is obtained by invoking {@code TemporalField.getFrom(TemporalAccessor)} + passing {@code this} as the argument. + + Implementations must ensure that no observable state is altered when this + read-only method is invoked. + + The default implementation must behave equivalent to this code: +
+  if (range(field).isIntValue()) {
+    return range(field).checkValidIntValue(getLong(field), field);
+  }
+  throw new UnsupportedTemporalTypeException(\"Invalid field \" + field + \" + for get() method, use getLong() instead\");
+ 
+ + @param field the field to get, not null + @return the value for the field, within the valid range of values + @throws DateTimeException if a value for the field cannot be obtained or + the value is outside the range of valid values for the field + @throws UnsupportedTemporalTypeException if the field is not supported or + the range of values exceeds an {@code int} + @throws ArithmeticException if numeric overflow occurs" + {:arglists (quote (["java.time.temporal.Temporal" + "java.time.temporal.TemporalField"]))} + (^java.lang.Integer + [^java.time.temporal.Temporal this ^java.time.temporal.TemporalField field] + (.get this field))) diff --git a/src/cljc/java_time/temporal/temporal.cljs b/src/cljc/java_time/temporal/temporal.cljs index 2e6a6eb..0a45710 100644 --- a/src/cljc/java_time/temporal/temporal.cljs +++ b/src/cljc/java_time/temporal/temporal.cljs @@ -1,10 +1,303 @@ -(ns cljc.java-time.temporal.temporal (:refer-clojure :exclude [abs get range format min max next name resolve short]) (:require [cljc.java-time.extn.calendar-awareness] [goog.object] [java.time.temporal :refer [Temporal]])) -(clojure.core/defn range {:arglists (quote (["java.time.temporal.Temporal" "java.time.temporal.TemporalField"]))} (^js/JSJoda.ValueRange [^js/JSJoda.Temporal this15530 ^js/JSJoda.TemporalField java-time-temporal-TemporalField15531] (.range this15530 java-time-temporal-TemporalField15531))) -(clojure.core/defn plus {:arglists (quote (["java.time.temporal.Temporal" "long" "java.time.temporal.TemporalUnit"] ["java.time.temporal.Temporal" "java.time.temporal.TemporalAmount"]))} (^js/JSJoda.Temporal [^js/JSJoda.Temporal this15532 ^long long15533 ^js/JSJoda.TemporalUnit java-time-temporal-TemporalUnit15534] (.plus this15532 long15533 java-time-temporal-TemporalUnit15534)) (^js/JSJoda.Temporal [^js/JSJoda.Temporal this15535 ^js/JSJoda.TemporalAmount java-time-temporal-TemporalAmount15536] (.plus this15535 java-time-temporal-TemporalAmount15536))) -(clojure.core/defn query {:arglists (quote (["java.time.temporal.Temporal" "java.time.temporal.TemporalQuery"]))} (^java.lang.Object [^js/JSJoda.Temporal this15537 ^js/JSJoda.TemporalQuery java-time-temporal-TemporalQuery15538] (.query this15537 java-time-temporal-TemporalQuery15538))) -(clojure.core/defn minus {:arglists (quote (["java.time.temporal.Temporal" "long" "java.time.temporal.TemporalUnit"] ["java.time.temporal.Temporal" "java.time.temporal.TemporalAmount"]))} (^js/JSJoda.Temporal [^js/JSJoda.Temporal this15539 ^long long15540 ^js/JSJoda.TemporalUnit java-time-temporal-TemporalUnit15541] (.minus this15539 long15540 java-time-temporal-TemporalUnit15541)) (^js/JSJoda.Temporal [^js/JSJoda.Temporal this15542 ^js/JSJoda.TemporalAmount java-time-temporal-TemporalAmount15543] (.minus this15542 java-time-temporal-TemporalAmount15543))) -(clojure.core/defn get-long {:arglists (quote (["java.time.temporal.Temporal" "java.time.temporal.TemporalField"]))} (^long [^js/JSJoda.Temporal this15544 ^js/JSJoda.TemporalField java-time-temporal-TemporalField15545] (.getLong this15544 java-time-temporal-TemporalField15545))) -(clojure.core/defn until {:arglists (quote (["java.time.temporal.Temporal" "java.time.temporal.Temporal" "java.time.temporal.TemporalUnit"]))} (^long [^js/JSJoda.Temporal this15546 ^js/JSJoda.Temporal java-time-temporal-Temporal15547 ^js/JSJoda.TemporalUnit java-time-temporal-TemporalUnit15548] (.until this15546 java-time-temporal-Temporal15547 java-time-temporal-TemporalUnit15548))) -(clojure.core/defn is-supported {:arglists (quote (["java.time.temporal.Temporal" "java.time.temporal.TemporalUnit"] ["java.time.temporal.Temporal" "java.time.temporal.TemporalField"]))} (^boolean [this15549 G__15550] (.isSupported ^js/JSJoda.Temporal this15549 G__15550))) -(clojure.core/defn with {:arglists (quote (["java.time.temporal.Temporal" "java.time.temporal.TemporalField" "long"] ["java.time.temporal.Temporal" "java.time.temporal.TemporalAdjuster"]))} (^js/JSJoda.Temporal [^js/JSJoda.Temporal this15551 ^js/JSJoda.TemporalField java-time-temporal-TemporalField15552 ^long long15553] (.with this15551 java-time-temporal-TemporalField15552 long15553)) (^js/JSJoda.Temporal [^js/JSJoda.Temporal this15554 ^js/JSJoda.TemporalAdjuster java-time-temporal-TemporalAdjuster15555] (.with this15554 java-time-temporal-TemporalAdjuster15555))) -(clojure.core/defn get {:arglists (quote (["java.time.temporal.Temporal" "java.time.temporal.TemporalField"]))} (^int [^js/JSJoda.Temporal this15556 ^js/JSJoda.TemporalField java-time-temporal-TemporalField15557] (.get this15556 java-time-temporal-TemporalField15557))) +(ns cljc.java-time.temporal.temporal + (:refer-clojure :exclude + [abs get range format min max next name resolve short]) + (:require [cljc.java-time.extn.calendar-awareness] + [goog.object] + [java.time.temporal :refer [Temporal]])) + +(defn range + "Gets the range of valid values for the specified field. + + All fields can be expressed as a {@code long} integer. + This method returns an object that describes the valid range for that value. + The value of this temporal object is used to enhance the accuracy of the returned range. + If the date-time cannot return the range, because the field is unsupported or for + some other reason, an exception will be thrown. + + Note that the result only describes the minimum and maximum valid values + and it is important not to read too much into them. For example, there + could be values within the range that are invalid for the field. + + @implSpec + Implementations must check and handle all fields defined in {@link ChronoField}. + If the field is supported, then the range of the field must be returned. + If unsupported, then an {@code UnsupportedTemporalTypeException} must be thrown. + + If the field is not a {@code ChronoField}, then the result of this method + is obtained by invoking {@code TemporalField.rangeRefinedBy(TemporalAccessorl)} + passing {@code this} as the argument. + + Implementations must ensure that no observable state is altered when this + read-only method is invoked. + + The default implementation must behave equivalent to this code: +
+  if (field instanceof ChronoField) {
+    if (isSupported(field)) {
+      return field.range();
+    }
+    throw new UnsupportedTemporalTypeException(\"Unsupported field: \" + field);
+  }
+  return field.rangeRefinedBy(this);
+ 
+ + @param field the field to query the range for, not null + @return the range of valid values for the field, not null + @throws DateTimeException if the range for the field cannot be obtained + @throws UnsupportedTemporalTypeException if the field is not supported" + {:arglists (quote (["java.time.temporal.Temporal" + "java.time.temporal.TemporalField"]))} + (^js/JSJoda.ValueRange + [^js/JSJoda.Temporal this ^js/JSJoda.TemporalField field] + (.range this field))) + +(defn plus + {:arglists (quote (["java.time.temporal.Temporal" + "java.time.temporal.TemporalAmount"] + ["java.time.temporal.Temporal" "long" + "java.time.temporal.TemporalUnit"]))} + (^js/JSJoda.Temporal + [^js/JSJoda.Temporal this ^js/JSJoda.TemporalAmount amount] + (.plus this amount)) + (^js/JSJoda.Temporal + [^js/JSJoda.Temporal this ^long amount-to-add ^js/JSJoda.TemporalUnit unit] + (.plus this amount-to-add unit))) + +(defn query + "Queries this date-time. + + This queries this date-time using the specified query strategy object. + + Queries are a key tool for extracting information from date-times. + They exists to externalize the process of querying, permitting different + approaches, as per the strategy design pattern. + Examples might be a query that checks if the date is the day before February 29th + in a leap year, or calculates the number of days to your next birthday. + + The most common query implementations are method references, such as + {@code LocalDate::from} and {@code ZoneId::from}. + Additional implementations are provided as static methods on {@link TemporalQuery}. + + @implSpec + The default implementation must behave equivalent to this code: +
+  if (query == TemporalQueries.zoneId() ||
+        query == TemporalQueries.chronology() || query == TemporalQueries.precision()) {
+    return null;
+  }
+  return query.queryFrom(this);
+ 
+ Future versions are permitted to add further queries to the if statement. + + All classes implementing this interface and overriding this method must call + {@code TemporalAccessor.super.query(query)}. JDK classes may avoid calling + super if they provide behavior equivalent to the default behaviour, however + non-JDK classes may not utilize this optimization and must call {@code super}. + + If the implementation can supply a value for one of the queries listed in the + if statement of the default implementation, then it must do so. + For example, an application-defined {@code HourMin} class storing the hour + and minute must override this method as follows: +
+  if (query == TemporalQueries.precision()) {
+    return MINUTES;
+  }
+  return TemporalAccessor.super.query(query);
+ 
+ + Implementations must ensure that no observable state is altered when this + read-only method is invoked. + + @param the type of the result + @param query the query to invoke, not null + @return the query result, null may be returned (defined by the query) + @throws DateTimeException if unable to query + @throws ArithmeticException if numeric overflow occurs" + {:arglists (quote (["java.time.temporal.Temporal" + "java.time.temporal.TemporalQuery"]))} + (^java.lang.Object [^js/JSJoda.Temporal this ^js/JSJoda.TemporalQuery query] + (.query this query))) + +(defn minus + {:arglists (quote (["java.time.temporal.Temporal" + "java.time.temporal.TemporalAmount"] + ["java.time.temporal.Temporal" "long" + "java.time.temporal.TemporalUnit"]))} + (^js/JSJoda.Temporal + [^js/JSJoda.Temporal this ^js/JSJoda.TemporalAmount amount] + (.minus this amount)) + (^js/JSJoda.Temporal + [^js/JSJoda.Temporal this ^long amount-to-subtract + ^js/JSJoda.TemporalUnit unit] + (.minus this amount-to-subtract unit))) + +(defn get-long + "Gets the value of the specified field as a {@code long}. + + This queries the date-time for the value of the specified field. + The returned value may be outside the valid range of values for the field. + If the date-time cannot return the value, because the field is unsupported or for + some other reason, an exception will be thrown. + + @implSpec + Implementations must check and handle all fields defined in {@link ChronoField}. + If the field is supported, then the value of the field must be returned. + If unsupported, then an {@code UnsupportedTemporalTypeException} must be thrown. + + If the field is not a {@code ChronoField}, then the result of this method + is obtained by invoking {@code TemporalField.getFrom(TemporalAccessor)} + passing {@code this} as the argument. + + Implementations must ensure that no observable state is altered when this + read-only method is invoked. + + @param field the field to get, not null + @return the value for the field + @throws DateTimeException if a value for the field cannot be obtained + @throws UnsupportedTemporalTypeException if the field is not supported + @throws ArithmeticException if numeric overflow occurs" + {:arglists (quote (["java.time.temporal.Temporal" + "java.time.temporal.TemporalField"]))} + (^long [^js/JSJoda.Temporal this ^js/JSJoda.TemporalField field] + (.getLong this field))) + +(defn until + "Calculates the amount of time until another temporal in terms of the specified unit. + + This calculates the amount of time between two temporal objects + in terms of a single {@code TemporalUnit}. + The start and end points are {@code this} and the specified temporal. + The end point is converted to be of the same type as the start point if different. + The result will be negative if the end is before the start. + For example, the amount in hours between two temporal objects can be + calculated using {@code startTime.until(endTime, HOURS)}. + + The calculation returns a whole number, representing the number of + complete units between the two temporals. + For example, the amount in hours between the times 11:30 and 13:29 + will only be one hour as it is one minute short of two hours. + + There are two equivalent ways of using this method. + The first is to invoke this method directly. + The second is to use {@link TemporalUnit#between(Temporal, Temporal)}: +
+   // these two lines are equivalent
+   temporal = start.until(end, unit);
+   temporal = unit.between(start, end);
+ 
+ The choice should be made based on which makes the code more readable. + + For example, this method allows the number of days between two dates to + be calculated: +
+  long daysBetween = start.until(end, DAYS);
+  // or alternatively
+  long daysBetween = DAYS.between(start, end);
+ 
+ + @implSpec + Implementations must begin by checking to ensure that the input temporal + object is of the same observable type as the implementation. + They must then perform the calculation for all instances of {@link ChronoUnit}. + An {@code UnsupportedTemporalTypeException} must be thrown for {@code ChronoUnit} + instances that are unsupported. + + If the unit is not a {@code ChronoUnit}, then the result of this method + is obtained by invoking {@code TemporalUnit.between(Temporal, Temporal)} + passing {@code this} as the first argument and the converted input temporal as + the second argument. + + In summary, implementations must behave in a manner equivalent to this pseudo-code: +
+  // convert the end temporal to the same type as this class
+  if (unit instanceof ChronoUnit) {
+    // if unit is supported, then calculate and return result
+    // else throw UnsupportedTemporalTypeException for unsupported units
+  }
+  return unit.between(this, convertedEndTemporal);
+ 
+ + Note that the unit's {@code between} method must only be invoked if the + two temporal objects have exactly the same type evaluated by {@code getClass()}. + + Implementations must ensure that no observable state is altered when this + read-only method is invoked. + + @param endExclusive the end temporal, exclusive, converted to be of the + same type as this object, not null + @param unit the unit to measure the amount in, not null + @return the amount of time between this temporal object and the specified one + in terms of the unit; positive if the specified object is later than this one, + negative if it is earlier than this one + @throws DateTimeException if the amount cannot be calculated, or the end + temporal cannot be converted to the same type as this temporal + @throws UnsupportedTemporalTypeException if the unit is not supported + @throws ArithmeticException if numeric overflow occurs" + {:arglists (quote (["java.time.temporal.Temporal" + "java.time.temporal.Temporal" + "java.time.temporal.TemporalUnit"]))} + (^long + [^js/JSJoda.Temporal this ^js/JSJoda.Temporal end-exclusive + ^js/JSJoda.TemporalUnit unit] + (.until this end-exclusive unit))) + +(defn is-supported + {:arglists (quote (["java.time.temporal.Temporal" + "java.time.temporal.TemporalUnit"] + ["java.time.temporal.Temporal" + "java.time.temporal.TemporalField"]))} + (^boolean [^js/JSJoda.Temporal this arg0] + (.isSupported ^js/JSJoda.Temporal this arg0))) + +(defn with + {:arglists (quote (["java.time.temporal.Temporal" + "java.time.temporal.TemporalAdjuster"] + ["java.time.temporal.Temporal" + "java.time.temporal.TemporalField" "long"]))} + (^js/JSJoda.Temporal + [^js/JSJoda.Temporal this ^js/JSJoda.TemporalAdjuster adjuster] + (.with this adjuster)) + (^js/JSJoda.Temporal + [^js/JSJoda.Temporal this ^js/JSJoda.TemporalField field ^long new-value] + (.with this field new-value))) + +(defn get + "Gets the value of the specified field as an {@code int}. + + This queries the date-time for the value of the specified field. + The returned value will always be within the valid range of values for the field. + If the date-time cannot return the value, because the field is unsupported or for + some other reason, an exception will be thrown. + + @implSpec + Implementations must check and handle all fields defined in {@link ChronoField}. + If the field is supported and has an {@code int} range, then the value of + the field must be returned. + If unsupported, then an {@code UnsupportedTemporalTypeException} must be thrown. + + If the field is not a {@code ChronoField}, then the result of this method + is obtained by invoking {@code TemporalField.getFrom(TemporalAccessor)} + passing {@code this} as the argument. + + Implementations must ensure that no observable state is altered when this + read-only method is invoked. + + The default implementation must behave equivalent to this code: +
+  if (range(field).isIntValue()) {
+    return range(field).checkValidIntValue(getLong(field), field);
+  }
+  throw new UnsupportedTemporalTypeException(\"Invalid field \" + field + \" + for get() method, use getLong() instead\");
+ 
+ + @param field the field to get, not null + @return the value for the field, within the valid range of values + @throws DateTimeException if a value for the field cannot be obtained or + the value is outside the range of valid values for the field + @throws UnsupportedTemporalTypeException if the field is not supported or + the range of values exceeds an {@code int} + @throws ArithmeticException if numeric overflow occurs" + {:arglists (quote (["java.time.temporal.Temporal" + "java.time.temporal.TemporalField"]))} + (^int [^js/JSJoda.Temporal this ^js/JSJoda.TemporalField field] + (.get this field))) diff --git a/src/cljc/java_time/temporal/temporal_accessor.clj b/src/cljc/java_time/temporal/temporal_accessor.clj index e1571bc..53709db 100644 --- a/src/cljc/java_time/temporal/temporal_accessor.clj +++ b/src/cljc/java_time/temporal/temporal_accessor.clj @@ -1,6 +1,211 @@ -(ns cljc.java-time.temporal.temporal-accessor (:refer-clojure :exclude [abs get range format min max next name resolve short]) (:require [cljc.java-time.extn.calendar-awareness]) (:import [java.time.temporal TemporalAccessor])) -(clojure.core/defn get {:arglists (quote (["java.time.temporal.TemporalAccessor" "java.time.temporal.TemporalField"]))} (^java.lang.Integer [^java.time.temporal.TemporalAccessor this15720 ^java.time.temporal.TemporalField java-time-temporal-TemporalField15721] (.get this15720 java-time-temporal-TemporalField15721))) -(clojure.core/defn get-long {:arglists (quote (["java.time.temporal.TemporalAccessor" "java.time.temporal.TemporalField"]))} (^long [^java.time.temporal.TemporalAccessor this15722 ^java.time.temporal.TemporalField java-time-temporal-TemporalField15723] (.getLong this15722 java-time-temporal-TemporalField15723))) -(clojure.core/defn query {:arglists (quote (["java.time.temporal.TemporalAccessor" "java.time.temporal.TemporalQuery"]))} (^java.lang.Object [^java.time.temporal.TemporalAccessor this15724 ^java.time.temporal.TemporalQuery java-time-temporal-TemporalQuery15725] (.query this15724 java-time-temporal-TemporalQuery15725))) -(clojure.core/defn is-supported {:arglists (quote (["java.time.temporal.TemporalAccessor" "java.time.temporal.TemporalField"]))} (^java.lang.Boolean [^java.time.temporal.TemporalAccessor this15726 ^java.time.temporal.TemporalField java-time-temporal-TemporalField15727] (.isSupported this15726 java-time-temporal-TemporalField15727))) -(clojure.core/defn range {:arglists (quote (["java.time.temporal.TemporalAccessor" "java.time.temporal.TemporalField"]))} (^java.time.temporal.ValueRange [^java.time.temporal.TemporalAccessor this15728 ^java.time.temporal.TemporalField java-time-temporal-TemporalField15729] (.range this15728 java-time-temporal-TemporalField15729))) +(ns cljc.java-time.temporal.temporal-accessor + (:refer-clojure :exclude + [abs get range format min max next name resolve short]) + (:require [cljc.java-time.extn.calendar-awareness]) + (:import [java.time.temporal TemporalAccessor])) + +(defn get + "Gets the value of the specified field as an {@code int}. + + This queries the date-time for the value of the specified field. + The returned value will always be within the valid range of values for the field. + If the date-time cannot return the value, because the field is unsupported or for + some other reason, an exception will be thrown. + + @implSpec + Implementations must check and handle all fields defined in {@link ChronoField}. + If the field is supported and has an {@code int} range, then the value of + the field must be returned. + If unsupported, then an {@code UnsupportedTemporalTypeException} must be thrown. + + If the field is not a {@code ChronoField}, then the result of this method + is obtained by invoking {@code TemporalField.getFrom(TemporalAccessor)} + passing {@code this} as the argument. + + Implementations must ensure that no observable state is altered when this + read-only method is invoked. + + The default implementation must behave equivalent to this code: +
+  if (range(field).isIntValue()) {
+    return range(field).checkValidIntValue(getLong(field), field);
+  }
+  throw new UnsupportedTemporalTypeException(\"Invalid field \" + field + \" + for get() method, use getLong() instead\");
+ 
+ + @param field the field to get, not null + @return the value for the field, within the valid range of values + @throws DateTimeException if a value for the field cannot be obtained or + the value is outside the range of valid values for the field + @throws UnsupportedTemporalTypeException if the field is not supported or + the range of values exceeds an {@code int} + @throws ArithmeticException if numeric overflow occurs" + {:arglists (quote (["java.time.temporal.TemporalAccessor" + "java.time.temporal.TemporalField"]))} + (^java.lang.Integer + [^java.time.temporal.TemporalAccessor this + ^java.time.temporal.TemporalField field] + (.get this field))) + +(defn get-long + "Gets the value of the specified field as a {@code long}. + + This queries the date-time for the value of the specified field. + The returned value may be outside the valid range of values for the field. + If the date-time cannot return the value, because the field is unsupported or for + some other reason, an exception will be thrown. + + @implSpec + Implementations must check and handle all fields defined in {@link ChronoField}. + If the field is supported, then the value of the field must be returned. + If unsupported, then an {@code UnsupportedTemporalTypeException} must be thrown. + + If the field is not a {@code ChronoField}, then the result of this method + is obtained by invoking {@code TemporalField.getFrom(TemporalAccessor)} + passing {@code this} as the argument. + + Implementations must ensure that no observable state is altered when this + read-only method is invoked. + + @param field the field to get, not null + @return the value for the field + @throws DateTimeException if a value for the field cannot be obtained + @throws UnsupportedTemporalTypeException if the field is not supported + @throws ArithmeticException if numeric overflow occurs" + {:arglists (quote (["java.time.temporal.TemporalAccessor" + "java.time.temporal.TemporalField"]))} + (^long + [^java.time.temporal.TemporalAccessor this + ^java.time.temporal.TemporalField field] + (.getLong this field))) + +(defn is-supported + "Checks if the specified field is supported. + + This checks if the date-time can be queried for the specified field. + If false, then calling the {@link #range(TemporalField) range} and {@link #get(TemporalField) get} + methods will throw an exception. + + @implSpec + Implementations must check and handle all fields defined in {@link ChronoField}. + If the field is supported, then true must be returned, otherwise false must be returned. + + If the field is not a {@code ChronoField}, then the result of this method + is obtained by invoking {@code TemporalField.isSupportedBy(TemporalAccessor)} + passing {@code this} as the argument. + + Implementations must ensure that no observable state is altered when this + read-only method is invoked. + + @param field the field to check, null returns false + @return true if this date-time can be queried for the field, false if not" + {:arglists (quote (["java.time.temporal.TemporalAccessor" + "java.time.temporal.TemporalField"]))} + (^java.lang.Boolean + [^java.time.temporal.TemporalAccessor this + ^java.time.temporal.TemporalField field] + (.isSupported this field))) + +(defn query + "Queries this date-time. + + This queries this date-time using the specified query strategy object. + + Queries are a key tool for extracting information from date-times. + They exists to externalize the process of querying, permitting different + approaches, as per the strategy design pattern. + Examples might be a query that checks if the date is the day before February 29th + in a leap year, or calculates the number of days to your next birthday. + + The most common query implementations are method references, such as + {@code LocalDate::from} and {@code ZoneId::from}. + Additional implementations are provided as static methods on {@link TemporalQuery}. + + @implSpec + The default implementation must behave equivalent to this code: +
+  if (query == TemporalQueries.zoneId() ||
+        query == TemporalQueries.chronology() || query == TemporalQueries.precision()) {
+    return null;
+  }
+  return query.queryFrom(this);
+ 
+ Future versions are permitted to add further queries to the if statement. + + All classes implementing this interface and overriding this method must call + {@code TemporalAccessor.super.query(query)}. JDK classes may avoid calling + super if they provide behavior equivalent to the default behaviour, however + non-JDK classes may not utilize this optimization and must call {@code super}. + + If the implementation can supply a value for one of the queries listed in the + if statement of the default implementation, then it must do so. + For example, an application-defined {@code HourMin} class storing the hour + and minute must override this method as follows: +
+  if (query == TemporalQueries.precision()) {
+    return MINUTES;
+  }
+  return TemporalAccessor.super.query(query);
+ 
+ + Implementations must ensure that no observable state is altered when this + read-only method is invoked. + + @param the type of the result + @param query the query to invoke, not null + @return the query result, null may be returned (defined by the query) + @throws DateTimeException if unable to query + @throws ArithmeticException if numeric overflow occurs" + {:arglists (quote (["java.time.temporal.TemporalAccessor" + "java.time.temporal.TemporalQuery"]))} + (^java.lang.Object + [^java.time.temporal.TemporalAccessor this + ^java.time.temporal.TemporalQuery query] + (.query this query))) + +(defn range + "Gets the range of valid values for the specified field. + + All fields can be expressed as a {@code long} integer. + This method returns an object that describes the valid range for that value. + The value of this temporal object is used to enhance the accuracy of the returned range. + If the date-time cannot return the range, because the field is unsupported or for + some other reason, an exception will be thrown. + + Note that the result only describes the minimum and maximum valid values + and it is important not to read too much into them. For example, there + could be values within the range that are invalid for the field. + + @implSpec + Implementations must check and handle all fields defined in {@link ChronoField}. + If the field is supported, then the range of the field must be returned. + If unsupported, then an {@code UnsupportedTemporalTypeException} must be thrown. + + If the field is not a {@code ChronoField}, then the result of this method + is obtained by invoking {@code TemporalField.rangeRefinedBy(TemporalAccessorl)} + passing {@code this} as the argument. + + Implementations must ensure that no observable state is altered when this + read-only method is invoked. + + The default implementation must behave equivalent to this code: +
+  if (field instanceof ChronoField) {
+    if (isSupported(field)) {
+      return field.range();
+    }
+    throw new UnsupportedTemporalTypeException(\"Unsupported field: \" + field);
+  }
+  return field.rangeRefinedBy(this);
+ 
+ + @param field the field to query the range for, not null + @return the range of valid values for the field, not null + @throws DateTimeException if the range for the field cannot be obtained + @throws UnsupportedTemporalTypeException if the field is not supported" + {:arglists (quote (["java.time.temporal.TemporalAccessor" + "java.time.temporal.TemporalField"]))} + (^java.time.temporal.ValueRange + [^java.time.temporal.TemporalAccessor this + ^java.time.temporal.TemporalField field] + (.range this field))) diff --git a/src/cljc/java_time/temporal/temporal_accessor.cljs b/src/cljc/java_time/temporal/temporal_accessor.cljs index afd59fd..0fcd395 100644 --- a/src/cljc/java_time/temporal/temporal_accessor.cljs +++ b/src/cljc/java_time/temporal/temporal_accessor.cljs @@ -1,6 +1,204 @@ -(ns cljc.java-time.temporal.temporal-accessor (:refer-clojure :exclude [abs get range format min max next name resolve short]) (:require [cljc.java-time.extn.calendar-awareness] [goog.object] [java.time.temporal :refer [TemporalAccessor]])) -(clojure.core/defn get {:arglists (quote (["java.time.temporal.TemporalAccessor" "java.time.temporal.TemporalField"]))} (^int [^js/JSJoda.TemporalAccessor this15730 ^js/JSJoda.TemporalField java-time-temporal-TemporalField15731] (.get this15730 java-time-temporal-TemporalField15731))) -(clojure.core/defn get-long {:arglists (quote (["java.time.temporal.TemporalAccessor" "java.time.temporal.TemporalField"]))} (^long [^js/JSJoda.TemporalAccessor this15732 ^js/JSJoda.TemporalField java-time-temporal-TemporalField15733] (.getLong this15732 java-time-temporal-TemporalField15733))) -(clojure.core/defn query {:arglists (quote (["java.time.temporal.TemporalAccessor" "java.time.temporal.TemporalQuery"]))} (^java.lang.Object [^js/JSJoda.TemporalAccessor this15734 ^js/JSJoda.TemporalQuery java-time-temporal-TemporalQuery15735] (.query this15734 java-time-temporal-TemporalQuery15735))) -(clojure.core/defn is-supported {:arglists (quote (["java.time.temporal.TemporalAccessor" "java.time.temporal.TemporalField"]))} (^boolean [^js/JSJoda.TemporalAccessor this15736 ^js/JSJoda.TemporalField java-time-temporal-TemporalField15737] (.isSupported this15736 java-time-temporal-TemporalField15737))) -(clojure.core/defn range {:arglists (quote (["java.time.temporal.TemporalAccessor" "java.time.temporal.TemporalField"]))} (^js/JSJoda.ValueRange [^js/JSJoda.TemporalAccessor this15738 ^js/JSJoda.TemporalField java-time-temporal-TemporalField15739] (.range this15738 java-time-temporal-TemporalField15739))) +(ns cljc.java-time.temporal.temporal-accessor + (:refer-clojure :exclude + [abs get range format min max next name resolve short]) + (:require [cljc.java-time.extn.calendar-awareness] + [goog.object] + [java.time.temporal :refer [TemporalAccessor]])) + +(defn get + "Gets the value of the specified field as an {@code int}. + + This queries the date-time for the value of the specified field. + The returned value will always be within the valid range of values for the field. + If the date-time cannot return the value, because the field is unsupported or for + some other reason, an exception will be thrown. + + @implSpec + Implementations must check and handle all fields defined in {@link ChronoField}. + If the field is supported and has an {@code int} range, then the value of + the field must be returned. + If unsupported, then an {@code UnsupportedTemporalTypeException} must be thrown. + + If the field is not a {@code ChronoField}, then the result of this method + is obtained by invoking {@code TemporalField.getFrom(TemporalAccessor)} + passing {@code this} as the argument. + + Implementations must ensure that no observable state is altered when this + read-only method is invoked. + + The default implementation must behave equivalent to this code: +
+  if (range(field).isIntValue()) {
+    return range(field).checkValidIntValue(getLong(field), field);
+  }
+  throw new UnsupportedTemporalTypeException(\"Invalid field \" + field + \" + for get() method, use getLong() instead\");
+ 
+ + @param field the field to get, not null + @return the value for the field, within the valid range of values + @throws DateTimeException if a value for the field cannot be obtained or + the value is outside the range of valid values for the field + @throws UnsupportedTemporalTypeException if the field is not supported or + the range of values exceeds an {@code int} + @throws ArithmeticException if numeric overflow occurs" + {:arglists (quote (["java.time.temporal.TemporalAccessor" + "java.time.temporal.TemporalField"]))} + (^int [^js/JSJoda.TemporalAccessor this ^js/JSJoda.TemporalField field] + (.get this field))) + +(defn get-long + "Gets the value of the specified field as a {@code long}. + + This queries the date-time for the value of the specified field. + The returned value may be outside the valid range of values for the field. + If the date-time cannot return the value, because the field is unsupported or for + some other reason, an exception will be thrown. + + @implSpec + Implementations must check and handle all fields defined in {@link ChronoField}. + If the field is supported, then the value of the field must be returned. + If unsupported, then an {@code UnsupportedTemporalTypeException} must be thrown. + + If the field is not a {@code ChronoField}, then the result of this method + is obtained by invoking {@code TemporalField.getFrom(TemporalAccessor)} + passing {@code this} as the argument. + + Implementations must ensure that no observable state is altered when this + read-only method is invoked. + + @param field the field to get, not null + @return the value for the field + @throws DateTimeException if a value for the field cannot be obtained + @throws UnsupportedTemporalTypeException if the field is not supported + @throws ArithmeticException if numeric overflow occurs" + {:arglists (quote (["java.time.temporal.TemporalAccessor" + "java.time.temporal.TemporalField"]))} + (^long [^js/JSJoda.TemporalAccessor this ^js/JSJoda.TemporalField field] + (.getLong this field))) + +(defn is-supported + "Checks if the specified field is supported. + + This checks if the date-time can be queried for the specified field. + If false, then calling the {@link #range(TemporalField) range} and {@link #get(TemporalField) get} + methods will throw an exception. + + @implSpec + Implementations must check and handle all fields defined in {@link ChronoField}. + If the field is supported, then true must be returned, otherwise false must be returned. + + If the field is not a {@code ChronoField}, then the result of this method + is obtained by invoking {@code TemporalField.isSupportedBy(TemporalAccessor)} + passing {@code this} as the argument. + + Implementations must ensure that no observable state is altered when this + read-only method is invoked. + + @param field the field to check, null returns false + @return true if this date-time can be queried for the field, false if not" + {:arglists (quote (["java.time.temporal.TemporalAccessor" + "java.time.temporal.TemporalField"]))} + (^boolean [^js/JSJoda.TemporalAccessor this ^js/JSJoda.TemporalField field] + (.isSupported this field))) + +(defn query + "Queries this date-time. + + This queries this date-time using the specified query strategy object. + + Queries are a key tool for extracting information from date-times. + They exists to externalize the process of querying, permitting different + approaches, as per the strategy design pattern. + Examples might be a query that checks if the date is the day before February 29th + in a leap year, or calculates the number of days to your next birthday. + + The most common query implementations are method references, such as + {@code LocalDate::from} and {@code ZoneId::from}. + Additional implementations are provided as static methods on {@link TemporalQuery}. + + @implSpec + The default implementation must behave equivalent to this code: +
+  if (query == TemporalQueries.zoneId() ||
+        query == TemporalQueries.chronology() || query == TemporalQueries.precision()) {
+    return null;
+  }
+  return query.queryFrom(this);
+ 
+ Future versions are permitted to add further queries to the if statement. + + All classes implementing this interface and overriding this method must call + {@code TemporalAccessor.super.query(query)}. JDK classes may avoid calling + super if they provide behavior equivalent to the default behaviour, however + non-JDK classes may not utilize this optimization and must call {@code super}. + + If the implementation can supply a value for one of the queries listed in the + if statement of the default implementation, then it must do so. + For example, an application-defined {@code HourMin} class storing the hour + and minute must override this method as follows: +
+  if (query == TemporalQueries.precision()) {
+    return MINUTES;
+  }
+  return TemporalAccessor.super.query(query);
+ 
+ + Implementations must ensure that no observable state is altered when this + read-only method is invoked. + + @param the type of the result + @param query the query to invoke, not null + @return the query result, null may be returned (defined by the query) + @throws DateTimeException if unable to query + @throws ArithmeticException if numeric overflow occurs" + {:arglists (quote (["java.time.temporal.TemporalAccessor" + "java.time.temporal.TemporalQuery"]))} + (^java.lang.Object + [^js/JSJoda.TemporalAccessor this ^js/JSJoda.TemporalQuery query] + (.query this query))) + +(defn range + "Gets the range of valid values for the specified field. + + All fields can be expressed as a {@code long} integer. + This method returns an object that describes the valid range for that value. + The value of this temporal object is used to enhance the accuracy of the returned range. + If the date-time cannot return the range, because the field is unsupported or for + some other reason, an exception will be thrown. + + Note that the result only describes the minimum and maximum valid values + and it is important not to read too much into them. For example, there + could be values within the range that are invalid for the field. + + @implSpec + Implementations must check and handle all fields defined in {@link ChronoField}. + If the field is supported, then the range of the field must be returned. + If unsupported, then an {@code UnsupportedTemporalTypeException} must be thrown. + + If the field is not a {@code ChronoField}, then the result of this method + is obtained by invoking {@code TemporalField.rangeRefinedBy(TemporalAccessorl)} + passing {@code this} as the argument. + + Implementations must ensure that no observable state is altered when this + read-only method is invoked. + + The default implementation must behave equivalent to this code: +
+  if (field instanceof ChronoField) {
+    if (isSupported(field)) {
+      return field.range();
+    }
+    throw new UnsupportedTemporalTypeException(\"Unsupported field: \" + field);
+  }
+  return field.rangeRefinedBy(this);
+ 
+ + @param field the field to query the range for, not null + @return the range of valid values for the field, not null + @throws DateTimeException if the range for the field cannot be obtained + @throws UnsupportedTemporalTypeException if the field is not supported" + {:arglists (quote (["java.time.temporal.TemporalAccessor" + "java.time.temporal.TemporalField"]))} + (^js/JSJoda.ValueRange + [^js/JSJoda.TemporalAccessor this ^js/JSJoda.TemporalField field] + (.range this field))) diff --git a/src/cljc/java_time/temporal/temporal_adjuster.clj b/src/cljc/java_time/temporal/temporal_adjuster.clj index d1c3b35..24b111b 100644 --- a/src/cljc/java_time/temporal/temporal_adjuster.clj +++ b/src/cljc/java_time/temporal/temporal_adjuster.clj @@ -1,2 +1,53 @@ -(ns cljc.java-time.temporal.temporal-adjuster (:refer-clojure :exclude [abs get range format min max next name resolve short]) (:require [cljc.java-time.extn.calendar-awareness]) (:import [java.time.temporal TemporalAdjuster])) -(clojure.core/defn adjust-into {:arglists (quote (["java.time.temporal.TemporalAdjuster" "java.time.temporal.Temporal"]))} (^java.time.temporal.Temporal [^java.time.temporal.TemporalAdjuster this15740 ^java.time.temporal.Temporal java-time-temporal-Temporal15741] (.adjustInto this15740 java-time-temporal-Temporal15741))) +(ns cljc.java-time.temporal.temporal-adjuster + (:refer-clojure :exclude + [abs get range format min max next name resolve short]) + (:require [cljc.java-time.extn.calendar-awareness]) + (:import [java.time.temporal TemporalAdjuster])) + +(defn adjust-into + "Adjusts the specified temporal object. + + This adjusts the specified temporal object using the logic + encapsulated in the implementing class. + Examples might be an adjuster that sets the date avoiding weekends, or one that + sets the date to the last day of the month. + + There are two equivalent ways of using this method. + The first is to invoke this method directly. + The second is to use {@link Temporal#with(TemporalAdjuster)}: +
+   // these two lines are equivalent, but the second approach is recommended
+   temporal = thisAdjuster.adjustInto(temporal);
+   temporal = temporal.with(thisAdjuster);
+ 
+ It is recommended to use the second approach, {@code with(TemporalAdjuster)}, + as it is a lot clearer to read in code. + + @implSpec + The implementation must take the input object and adjust it. + The implementation defines the logic of the adjustment and is responsible for + documenting that logic. It may use any method on {@code Temporal} to + query the temporal object and perform the adjustment. + The returned object must have the same observable type as the input object + + The input object must not be altered. + Instead, an adjusted copy of the original must be returned. + This provides equivalent, safe behavior for immutable and mutable temporal objects. + + The input temporal object may be in a calendar system other than ISO. + Implementations may choose to document compatibility with other calendar systems, + or reject non-ISO temporal objects by {@link TemporalQueries#chronology() querying the chronology}. + + This method may be called from multiple threads in parallel. + It must be thread-safe when invoked. + + @param temporal the temporal object to adjust, not null + @return an object of the same observable type with the adjustment made, not null + @throws DateTimeException if unable to make the adjustment + @throws ArithmeticException if numeric overflow occurs" + {:arglists (quote (["java.time.temporal.TemporalAdjuster" + "java.time.temporal.Temporal"]))} + (^java.time.temporal.Temporal + [^java.time.temporal.TemporalAdjuster this + ^java.time.temporal.Temporal temporal] + (.adjustInto this temporal))) diff --git a/src/cljc/java_time/temporal/temporal_adjuster.cljs b/src/cljc/java_time/temporal/temporal_adjuster.cljs index ef3034a..b31c71c 100644 --- a/src/cljc/java_time/temporal/temporal_adjuster.cljs +++ b/src/cljc/java_time/temporal/temporal_adjuster.cljs @@ -1,2 +1,53 @@ -(ns cljc.java-time.temporal.temporal-adjuster (:refer-clojure :exclude [abs get range format min max next name resolve short]) (:require [cljc.java-time.extn.calendar-awareness] [goog.object] [java.time.temporal :refer [TemporalAdjuster]])) -(clojure.core/defn adjust-into {:arglists (quote (["java.time.temporal.TemporalAdjuster" "java.time.temporal.Temporal"]))} (^js/JSJoda.Temporal [^js/JSJoda.TemporalAdjuster this15742 ^js/JSJoda.Temporal java-time-temporal-Temporal15743] (.adjustInto this15742 java-time-temporal-Temporal15743))) +(ns cljc.java-time.temporal.temporal-adjuster + (:refer-clojure :exclude + [abs get range format min max next name resolve short]) + (:require [cljc.java-time.extn.calendar-awareness] + [goog.object] + [java.time.temporal :refer [TemporalAdjuster]])) + +(defn adjust-into + "Adjusts the specified temporal object. + + This adjusts the specified temporal object using the logic + encapsulated in the implementing class. + Examples might be an adjuster that sets the date avoiding weekends, or one that + sets the date to the last day of the month. + + There are two equivalent ways of using this method. + The first is to invoke this method directly. + The second is to use {@link Temporal#with(TemporalAdjuster)}: +
+   // these two lines are equivalent, but the second approach is recommended
+   temporal = thisAdjuster.adjustInto(temporal);
+   temporal = temporal.with(thisAdjuster);
+ 
+ It is recommended to use the second approach, {@code with(TemporalAdjuster)}, + as it is a lot clearer to read in code. + + @implSpec + The implementation must take the input object and adjust it. + The implementation defines the logic of the adjustment and is responsible for + documenting that logic. It may use any method on {@code Temporal} to + query the temporal object and perform the adjustment. + The returned object must have the same observable type as the input object + + The input object must not be altered. + Instead, an adjusted copy of the original must be returned. + This provides equivalent, safe behavior for immutable and mutable temporal objects. + + The input temporal object may be in a calendar system other than ISO. + Implementations may choose to document compatibility with other calendar systems, + or reject non-ISO temporal objects by {@link TemporalQueries#chronology() querying the chronology}. + + This method may be called from multiple threads in parallel. + It must be thread-safe when invoked. + + @param temporal the temporal object to adjust, not null + @return an object of the same observable type with the adjustment made, not null + @throws DateTimeException if unable to make the adjustment + @throws ArithmeticException if numeric overflow occurs" + {:arglists (quote (["java.time.temporal.TemporalAdjuster" + "java.time.temporal.Temporal"]))} + (^js/JSJoda.Temporal + [^js/JSJoda.TemporalAdjuster this ^js/JSJoda.Temporal temporal] + (.adjustInto this temporal))) diff --git a/src/cljc/java_time/temporal/temporal_adjusters.clj b/src/cljc/java_time/temporal/temporal_adjusters.clj index 21d9927..4eecc0d 100644 --- a/src/cljc/java_time/temporal/temporal_adjusters.clj +++ b/src/cljc/java_time/temporal/temporal_adjusters.clj @@ -1,15 +1,295 @@ -(ns cljc.java-time.temporal.temporal-adjusters (:refer-clojure :exclude [abs get range format min max next name resolve short]) (:require [cljc.java-time.extn.calendar-awareness]) (:import [java.time.temporal TemporalAdjusters])) -(clojure.core/defn next {:arglists (quote (["java.time.DayOfWeek"]))} (^java.time.temporal.TemporalAdjuster [^java.time.DayOfWeek java-time-DayOfWeek15484] (java.time.temporal.TemporalAdjusters/next java-time-DayOfWeek15484))) -(clojure.core/defn next-or-same {:arglists (quote (["java.time.DayOfWeek"]))} (^java.time.temporal.TemporalAdjuster [^java.time.DayOfWeek java-time-DayOfWeek15485] (java.time.temporal.TemporalAdjusters/nextOrSame java-time-DayOfWeek15485))) -(clojure.core/defn first-day-of-next-month {:arglists (quote ([]))} (^java.time.temporal.TemporalAdjuster [] (java.time.temporal.TemporalAdjusters/firstDayOfNextMonth))) -(clojure.core/defn first-day-of-month {:arglists (quote ([]))} (^java.time.temporal.TemporalAdjuster [] (java.time.temporal.TemporalAdjusters/firstDayOfMonth))) -(clojure.core/defn first-day-of-year {:arglists (quote ([]))} (^java.time.temporal.TemporalAdjuster [] (java.time.temporal.TemporalAdjusters/firstDayOfYear))) -(clojure.core/defn of-date-adjuster {:arglists (quote (["java.util.function.UnaryOperator"]))} (^java.time.temporal.TemporalAdjuster [^java.util.function.UnaryOperator java-util-function-UnaryOperator15486] (java.time.temporal.TemporalAdjusters/ofDateAdjuster java-util-function-UnaryOperator15486))) -(clojure.core/defn last-day-of-year {:arglists (quote ([]))} (^java.time.temporal.TemporalAdjuster [] (java.time.temporal.TemporalAdjusters/lastDayOfYear))) -(clojure.core/defn first-in-month {:arglists (quote (["java.time.DayOfWeek"]))} (^java.time.temporal.TemporalAdjuster [^java.time.DayOfWeek java-time-DayOfWeek15487] (java.time.temporal.TemporalAdjusters/firstInMonth java-time-DayOfWeek15487))) -(clojure.core/defn previous-or-same {:arglists (quote (["java.time.DayOfWeek"]))} (^java.time.temporal.TemporalAdjuster [^java.time.DayOfWeek java-time-DayOfWeek15488] (java.time.temporal.TemporalAdjusters/previousOrSame java-time-DayOfWeek15488))) -(clojure.core/defn previous {:arglists (quote (["java.time.DayOfWeek"]))} (^java.time.temporal.TemporalAdjuster [^java.time.DayOfWeek java-time-DayOfWeek15489] (java.time.temporal.TemporalAdjusters/previous java-time-DayOfWeek15489))) -(clojure.core/defn last-day-of-month {:arglists (quote ([]))} (^java.time.temporal.TemporalAdjuster [] (java.time.temporal.TemporalAdjusters/lastDayOfMonth))) -(clojure.core/defn last-in-month {:arglists (quote (["java.time.DayOfWeek"]))} (^java.time.temporal.TemporalAdjuster [^java.time.DayOfWeek java-time-DayOfWeek15490] (java.time.temporal.TemporalAdjusters/lastInMonth java-time-DayOfWeek15490))) -(clojure.core/defn first-day-of-next-year {:arglists (quote ([]))} (^java.time.temporal.TemporalAdjuster [] (java.time.temporal.TemporalAdjusters/firstDayOfNextYear))) -(clojure.core/defn day-of-week-in-month {:arglists (quote (["int" "java.time.DayOfWeek"]))} (^java.time.temporal.TemporalAdjuster [^java.lang.Integer int15491 ^java.time.DayOfWeek java-time-DayOfWeek15492] (java.time.temporal.TemporalAdjusters/dayOfWeekInMonth int15491 java-time-DayOfWeek15492))) +(ns cljc.java-time.temporal.temporal-adjusters + (:refer-clojure :exclude + [abs get range format min max next name resolve short]) + (:require [cljc.java-time.extn.calendar-awareness]) + (:import [java.time.temporal TemporalAdjusters])) + +(defn next + "Returns the next day-of-week adjuster, which adjusts the date to the + first occurrence of the specified day-of-week after the date being adjusted. + + The ISO calendar system behaves as follows:
+ The input 2011-01-15 (a Saturday) for parameter (MONDAY) will return 2011-01-17 (two days later).
+ The input 2011-01-15 (a Saturday) for parameter (WEDNESDAY) will return 2011-01-19 (four days later).
+ The input 2011-01-15 (a Saturday) for parameter (SATURDAY) will return 2011-01-22 (seven days later). + + The behavior is suitable for use with most calendar systems. + It uses the {@code DAY_OF_WEEK} field and the {@code DAYS} unit, + and assumes a seven day week. + + @param dayOfWeek the day-of-week to move the date to, not null + @return the next day-of-week adjuster, not null" + {:arglists (quote (["java.time.DayOfWeek"]))} + (^java.time.temporal.TemporalAdjuster [^java.time.DayOfWeek day-of-week] + (java.time.temporal.TemporalAdjusters/next day-of-week))) + +(defn next-or-same + "Returns the next-or-same day-of-week adjuster, which adjusts the date to the + first occurrence of the specified day-of-week after the date being adjusted + unless it is already on that day in which case the same object is returned. + + The ISO calendar system behaves as follows:
+ The input 2011-01-15 (a Saturday) for parameter (MONDAY) will return 2011-01-17 (two days later).
+ The input 2011-01-15 (a Saturday) for parameter (WEDNESDAY) will return 2011-01-19 (four days later).
+ The input 2011-01-15 (a Saturday) for parameter (SATURDAY) will return 2011-01-15 (same as input). + + The behavior is suitable for use with most calendar systems. + It uses the {@code DAY_OF_WEEK} field and the {@code DAYS} unit, + and assumes a seven day week. + + @param dayOfWeek the day-of-week to check for or move the date to, not null + @return the next-or-same day-of-week adjuster, not null" + {:arglists (quote (["java.time.DayOfWeek"]))} + (^java.time.temporal.TemporalAdjuster [^java.time.DayOfWeek day-of-week] + (java.time.temporal.TemporalAdjusters/nextOrSame day-of-week))) + +(defn first-day-of-next-month + "Returns the \"first day of next month\" adjuster, which returns a new date set to + the first day of the next month. + + The ISO calendar system behaves as follows:
+ The input 2011-01-15 will return 2011-02-01.
+ The input 2011-02-15 will return 2011-03-01. + + The behavior is suitable for use with most calendar systems. + It is equivalent to: +
+  temporal.with(DAY_OF_MONTH, 1).plus(1, MONTHS);
+ 
+ + @return the first day of next month adjuster, not null" + {:arglists (quote ([]))} + (^java.time.temporal.TemporalAdjuster [] + (java.time.temporal.TemporalAdjusters/firstDayOfNextMonth))) + +(defn first-day-of-month + "Returns the \"first day of month\" adjuster, which returns a new date set to + the first day of the current month. + + The ISO calendar system behaves as follows:
+ The input 2011-01-15 will return 2011-01-01.
+ The input 2011-02-15 will return 2011-02-01. + + The behavior is suitable for use with most calendar systems. + It is equivalent to: +
+  temporal.with(DAY_OF_MONTH, 1);
+ 
+ + @return the first day-of-month adjuster, not null" + {:arglists (quote ([]))} + (^java.time.temporal.TemporalAdjuster [] + (java.time.temporal.TemporalAdjusters/firstDayOfMonth))) + +(defn first-day-of-year + "Returns the \"first day of year\" adjuster, which returns a new date set to + the first day of the current year. + + The ISO calendar system behaves as follows:
+ The input 2011-01-15 will return 2011-01-01.
+ The input 2011-02-15 will return 2011-01-01.
+ + The behavior is suitable for use with most calendar systems. + It is equivalent to: +
+  temporal.with(DAY_OF_YEAR, 1);
+ 
+ + @return the first day-of-year adjuster, not null" + {:arglists (quote ([]))} + (^java.time.temporal.TemporalAdjuster [] + (java.time.temporal.TemporalAdjusters/firstDayOfYear))) + +(defn of-date-adjuster + "Obtains a {@code TemporalAdjuster} that wraps a date adjuster. + + The {@code TemporalAdjuster} is based on the low level {@code Temporal} interface. + This method allows an adjustment from {@code LocalDate} to {@code LocalDate} + to be wrapped to match the temporal-based interface. + This is provided for convenience to make user-written adjusters simpler. + + In general, user-written adjusters should be static constants: +
{@code
+  static TemporalAdjuster TWO_DAYS_LATER =
+       TemporalAdjusters.ofDateAdjuster(date -> date.plusDays(2));
+ }
+ + @param dateBasedAdjuster the date-based adjuster, not null + @return the temporal adjuster wrapping on the date adjuster, not null" + {:arglists (quote (["java.util.function.UnaryOperator"]))} + (^java.time.temporal.TemporalAdjuster + [^java.util.function.UnaryOperator date-based-adjuster] + (java.time.temporal.TemporalAdjusters/ofDateAdjuster date-based-adjuster))) + +(defn last-day-of-year + "Returns the \"last day of year\" adjuster, which returns a new date set to + the last day of the current year. + + The ISO calendar system behaves as follows:
+ The input 2011-01-15 will return 2011-12-31.
+ The input 2011-02-15 will return 2011-12-31.
+ + The behavior is suitable for use with most calendar systems. + It is equivalent to: +
+  long lastDay = temporal.range(DAY_OF_YEAR).getMaximum();
+  temporal.with(DAY_OF_YEAR, lastDay);
+ 
+ + @return the last day-of-year adjuster, not null" + {:arglists (quote ([]))} + (^java.time.temporal.TemporalAdjuster [] + (java.time.temporal.TemporalAdjusters/lastDayOfYear))) + +(defn first-in-month + "Returns the first in month adjuster, which returns a new date + in the same month with the first matching day-of-week. + This is used for expressions like 'first Tuesday in March'. + + The ISO calendar system behaves as follows:
+ The input 2011-12-15 for (MONDAY) will return 2011-12-05.
+ The input 2011-12-15 for (FRIDAY) will return 2011-12-02.
+ + The behavior is suitable for use with most calendar systems. + It uses the {@code DAY_OF_WEEK} and {@code DAY_OF_MONTH} fields + and the {@code DAYS} unit, and assumes a seven day week. + + @param dayOfWeek the day-of-week, not null + @return the first in month adjuster, not null" + {:arglists (quote (["java.time.DayOfWeek"]))} + (^java.time.temporal.TemporalAdjuster [^java.time.DayOfWeek day-of-week] + (java.time.temporal.TemporalAdjusters/firstInMonth day-of-week))) + +(defn previous-or-same + "Returns the previous-or-same day-of-week adjuster, which adjusts the date to the + first occurrence of the specified day-of-week before the date being adjusted + unless it is already on that day in which case the same object is returned. + + The ISO calendar system behaves as follows:
+ The input 2011-01-15 (a Saturday) for parameter (MONDAY) will return 2011-01-10 (five days earlier).
+ The input 2011-01-15 (a Saturday) for parameter (WEDNESDAY) will return 2011-01-12 (three days earlier).
+ The input 2011-01-15 (a Saturday) for parameter (SATURDAY) will return 2011-01-15 (same as input). + + The behavior is suitable for use with most calendar systems. + It uses the {@code DAY_OF_WEEK} field and the {@code DAYS} unit, + and assumes a seven day week. + + @param dayOfWeek the day-of-week to check for or move the date to, not null + @return the previous-or-same day-of-week adjuster, not null" + {:arglists (quote (["java.time.DayOfWeek"]))} + (^java.time.temporal.TemporalAdjuster [^java.time.DayOfWeek day-of-week] + (java.time.temporal.TemporalAdjusters/previousOrSame day-of-week))) + +(defn previous + "Returns the previous day-of-week adjuster, which adjusts the date to the + first occurrence of the specified day-of-week before the date being adjusted. + + The ISO calendar system behaves as follows:
+ The input 2011-01-15 (a Saturday) for parameter (MONDAY) will return 2011-01-10 (five days earlier).
+ The input 2011-01-15 (a Saturday) for parameter (WEDNESDAY) will return 2011-01-12 (three days earlier).
+ The input 2011-01-15 (a Saturday) for parameter (SATURDAY) will return 2011-01-08 (seven days earlier). + + The behavior is suitable for use with most calendar systems. + It uses the {@code DAY_OF_WEEK} field and the {@code DAYS} unit, + and assumes a seven day week. + + @param dayOfWeek the day-of-week to move the date to, not null + @return the previous day-of-week adjuster, not null" + {:arglists (quote (["java.time.DayOfWeek"]))} + (^java.time.temporal.TemporalAdjuster [^java.time.DayOfWeek day-of-week] + (java.time.temporal.TemporalAdjusters/previous day-of-week))) + +(defn last-day-of-month + "Returns the \"last day of month\" adjuster, which returns a new date set to + the last day of the current month. + + The ISO calendar system behaves as follows:
+ The input 2011-01-15 will return 2011-01-31.
+ The input 2011-02-15 will return 2011-02-28.
+ The input 2012-02-15 will return 2012-02-29 (leap year).
+ The input 2011-04-15 will return 2011-04-30. + + The behavior is suitable for use with most calendar systems. + It is equivalent to: +
+  long lastDay = temporal.range(DAY_OF_MONTH).getMaximum();
+  temporal.with(DAY_OF_MONTH, lastDay);
+ 
+ + @return the last day-of-month adjuster, not null" + {:arglists (quote ([]))} + (^java.time.temporal.TemporalAdjuster [] + (java.time.temporal.TemporalAdjusters/lastDayOfMonth))) + +(defn last-in-month + "Returns the last in month adjuster, which returns a new date + in the same month with the last matching day-of-week. + This is used for expressions like 'last Tuesday in March'. + + The ISO calendar system behaves as follows:
+ The input 2011-12-15 for (MONDAY) will return 2011-12-26.
+ The input 2011-12-15 for (FRIDAY) will return 2011-12-30.
+ + The behavior is suitable for use with most calendar systems. + It uses the {@code DAY_OF_WEEK} and {@code DAY_OF_MONTH} fields + and the {@code DAYS} unit, and assumes a seven day week. + + @param dayOfWeek the day-of-week, not null + @return the first in month adjuster, not null" + {:arglists (quote (["java.time.DayOfWeek"]))} + (^java.time.temporal.TemporalAdjuster [^java.time.DayOfWeek day-of-week] + (java.time.temporal.TemporalAdjusters/lastInMonth day-of-week))) + +(defn first-day-of-next-year + "Returns the \"first day of next year\" adjuster, which returns a new date set to + the first day of the next year. + + The ISO calendar system behaves as follows:
+ The input 2011-01-15 will return 2012-01-01. + + The behavior is suitable for use with most calendar systems. + It is equivalent to: +
+  temporal.with(DAY_OF_YEAR, 1).plus(1, YEARS);
+ 
+ + @return the first day of next month adjuster, not null" + {:arglists (quote ([]))} + (^java.time.temporal.TemporalAdjuster [] + (java.time.temporal.TemporalAdjusters/firstDayOfNextYear))) + +(defn day-of-week-in-month + "Returns the day-of-week in month adjuster, which returns a new date + in the same month with the ordinal day-of-week. + This is used for expressions like the 'second Tuesday in March'. + + The ISO calendar system behaves as follows:
+ The input 2011-12-15 for (1,TUESDAY) will return 2011-12-06.
+ The input 2011-12-15 for (2,TUESDAY) will return 2011-12-13.
+ The input 2011-12-15 for (3,TUESDAY) will return 2011-12-20.
+ The input 2011-12-15 for (4,TUESDAY) will return 2011-12-27.
+ The input 2011-12-15 for (5,TUESDAY) will return 2012-01-03.
+ The input 2011-12-15 for (-1,TUESDAY) will return 2011-12-27 (last in month).
+ The input 2011-12-15 for (-4,TUESDAY) will return 2011-12-06 (3 weeks before last in month).
+ The input 2011-12-15 for (-5,TUESDAY) will return 2011-11-29 (4 weeks before last in month).
+ The input 2011-12-15 for (0,TUESDAY) will return 2011-11-29 (last in previous month).
+ + For a positive or zero ordinal, the algorithm is equivalent to finding the first + day-of-week that matches within the month and then adding a number of weeks to it. + For a negative ordinal, the algorithm is equivalent to finding the last + day-of-week that matches within the month and then subtracting a number of weeks to it. + The ordinal number of weeks is not validated and is interpreted leniently + according to this algorithm. This definition means that an ordinal of zero finds + the last matching day-of-week in the previous month. + + The behavior is suitable for use with most calendar systems. + It uses the {@code DAY_OF_WEEK} and {@code DAY_OF_MONTH} fields + and the {@code DAYS} unit, and assumes a seven day week. + + @param ordinal the week within the month, unbounded but typically from -5 to 5 + @param dayOfWeek the day-of-week, not null + @return the day-of-week in month adjuster, not null" + {:arglists (quote (["int" "java.time.DayOfWeek"]))} + (^java.time.temporal.TemporalAdjuster + [^java.lang.Integer ordinal ^java.time.DayOfWeek day-of-week] + (java.time.temporal.TemporalAdjusters/dayOfWeekInMonth ordinal day-of-week))) diff --git a/src/cljc/java_time/temporal/temporal_adjusters.cljs b/src/cljc/java_time/temporal/temporal_adjusters.cljs index f9a5a0d..3fec653 100644 --- a/src/cljc/java_time/temporal/temporal_adjusters.cljs +++ b/src/cljc/java_time/temporal/temporal_adjusters.cljs @@ -1,15 +1,302 @@ -(ns cljc.java-time.temporal.temporal-adjusters (:refer-clojure :exclude [abs get range format min max next name resolve short]) (:require [cljc.java-time.extn.calendar-awareness] [goog.object] [java.time.temporal :refer [TemporalAdjusters]])) -(clojure.core/defn next {:arglists (quote (["java.time.DayOfWeek"]))} (^js/JSJoda.TemporalAdjuster [^js/JSJoda.DayOfWeek java-time-DayOfWeek15493] (js-invoke java.time.temporal.TemporalAdjusters "next" java-time-DayOfWeek15493))) -(clojure.core/defn next-or-same {:arglists (quote (["java.time.DayOfWeek"]))} (^js/JSJoda.TemporalAdjuster [^js/JSJoda.DayOfWeek java-time-DayOfWeek15494] (js-invoke java.time.temporal.TemporalAdjusters "nextOrSame" java-time-DayOfWeek15494))) -(clojure.core/defn first-day-of-next-month {:arglists (quote ([]))} (^js/JSJoda.TemporalAdjuster [] (js-invoke java.time.temporal.TemporalAdjusters "firstDayOfNextMonth"))) -(clojure.core/defn first-day-of-month {:arglists (quote ([]))} (^js/JSJoda.TemporalAdjuster [] (js-invoke java.time.temporal.TemporalAdjusters "firstDayOfMonth"))) -(clojure.core/defn first-day-of-year {:arglists (quote ([]))} (^js/JSJoda.TemporalAdjuster [] (js-invoke java.time.temporal.TemporalAdjusters "firstDayOfYear"))) -(clojure.core/defn of-date-adjuster {:arglists (quote (["java.util.function.UnaryOperator"]))} (^js/JSJoda.TemporalAdjuster [^java.util.function.UnaryOperator java-util-function-UnaryOperator15495] (js-invoke java.time.temporal.TemporalAdjusters "ofDateAdjuster" java-util-function-UnaryOperator15495))) -(clojure.core/defn last-day-of-year {:arglists (quote ([]))} (^js/JSJoda.TemporalAdjuster [] (js-invoke java.time.temporal.TemporalAdjusters "lastDayOfYear"))) -(clojure.core/defn first-in-month {:arglists (quote (["java.time.DayOfWeek"]))} (^js/JSJoda.TemporalAdjuster [^js/JSJoda.DayOfWeek java-time-DayOfWeek15496] (js-invoke java.time.temporal.TemporalAdjusters "firstInMonth" java-time-DayOfWeek15496))) -(clojure.core/defn previous-or-same {:arglists (quote (["java.time.DayOfWeek"]))} (^js/JSJoda.TemporalAdjuster [^js/JSJoda.DayOfWeek java-time-DayOfWeek15497] (js-invoke java.time.temporal.TemporalAdjusters "previousOrSame" java-time-DayOfWeek15497))) -(clojure.core/defn previous {:arglists (quote (["java.time.DayOfWeek"]))} (^js/JSJoda.TemporalAdjuster [^js/JSJoda.DayOfWeek java-time-DayOfWeek15498] (js-invoke java.time.temporal.TemporalAdjusters "previous" java-time-DayOfWeek15498))) -(clojure.core/defn last-day-of-month {:arglists (quote ([]))} (^js/JSJoda.TemporalAdjuster [] (js-invoke java.time.temporal.TemporalAdjusters "lastDayOfMonth"))) -(clojure.core/defn last-in-month {:arglists (quote (["java.time.DayOfWeek"]))} (^js/JSJoda.TemporalAdjuster [^js/JSJoda.DayOfWeek java-time-DayOfWeek15499] (js-invoke java.time.temporal.TemporalAdjusters "lastInMonth" java-time-DayOfWeek15499))) -(clojure.core/defn first-day-of-next-year {:arglists (quote ([]))} (^js/JSJoda.TemporalAdjuster [] (js-invoke java.time.temporal.TemporalAdjusters "firstDayOfNextYear"))) -(clojure.core/defn day-of-week-in-month {:arglists (quote (["int" "java.time.DayOfWeek"]))} (^js/JSJoda.TemporalAdjuster [^int int15500 ^js/JSJoda.DayOfWeek java-time-DayOfWeek15501] (js-invoke java.time.temporal.TemporalAdjusters "dayOfWeekInMonth" int15500 java-time-DayOfWeek15501))) +(ns cljc.java-time.temporal.temporal-adjusters + (:refer-clojure :exclude + [abs get range format min max next name resolve short]) + (:require [cljc.java-time.extn.calendar-awareness] + [goog.object] + [java.time.temporal :refer [TemporalAdjusters]])) + +(defn next + "Returns the next day-of-week adjuster, which adjusts the date to the + first occurrence of the specified day-of-week after the date being adjusted. + + The ISO calendar system behaves as follows:
+ The input 2011-01-15 (a Saturday) for parameter (MONDAY) will return 2011-01-17 (two days later).
+ The input 2011-01-15 (a Saturday) for parameter (WEDNESDAY) will return 2011-01-19 (four days later).
+ The input 2011-01-15 (a Saturday) for parameter (SATURDAY) will return 2011-01-22 (seven days later). + + The behavior is suitable for use with most calendar systems. + It uses the {@code DAY_OF_WEEK} field and the {@code DAYS} unit, + and assumes a seven day week. + + @param dayOfWeek the day-of-week to move the date to, not null + @return the next day-of-week adjuster, not null" + {:arglists (quote (["java.time.DayOfWeek"]))} + (^js/JSJoda.TemporalAdjuster [^js/JSJoda.DayOfWeek day-of-week] + (js-invoke java.time.temporal.TemporalAdjusters "next" day-of-week))) + +(defn next-or-same + "Returns the next-or-same day-of-week adjuster, which adjusts the date to the + first occurrence of the specified day-of-week after the date being adjusted + unless it is already on that day in which case the same object is returned. + + The ISO calendar system behaves as follows:
+ The input 2011-01-15 (a Saturday) for parameter (MONDAY) will return 2011-01-17 (two days later).
+ The input 2011-01-15 (a Saturday) for parameter (WEDNESDAY) will return 2011-01-19 (four days later).
+ The input 2011-01-15 (a Saturday) for parameter (SATURDAY) will return 2011-01-15 (same as input). + + The behavior is suitable for use with most calendar systems. + It uses the {@code DAY_OF_WEEK} field and the {@code DAYS} unit, + and assumes a seven day week. + + @param dayOfWeek the day-of-week to check for or move the date to, not null + @return the next-or-same day-of-week adjuster, not null" + {:arglists (quote (["java.time.DayOfWeek"]))} + (^js/JSJoda.TemporalAdjuster [^js/JSJoda.DayOfWeek day-of-week] + (js-invoke java.time.temporal.TemporalAdjusters "nextOrSame" day-of-week))) + +(defn first-day-of-next-month + "Returns the \"first day of next month\" adjuster, which returns a new date set to + the first day of the next month. + + The ISO calendar system behaves as follows:
+ The input 2011-01-15 will return 2011-02-01.
+ The input 2011-02-15 will return 2011-03-01. + + The behavior is suitable for use with most calendar systems. + It is equivalent to: +
+  temporal.with(DAY_OF_MONTH, 1).plus(1, MONTHS);
+ 
+ + @return the first day of next month adjuster, not null" + {:arglists (quote ([]))} + (^js/JSJoda.TemporalAdjuster [] + (js-invoke java.time.temporal.TemporalAdjusters "firstDayOfNextMonth"))) + +(defn first-day-of-month + "Returns the \"first day of month\" adjuster, which returns a new date set to + the first day of the current month. + + The ISO calendar system behaves as follows:
+ The input 2011-01-15 will return 2011-01-01.
+ The input 2011-02-15 will return 2011-02-01. + + The behavior is suitable for use with most calendar systems. + It is equivalent to: +
+  temporal.with(DAY_OF_MONTH, 1);
+ 
+ + @return the first day-of-month adjuster, not null" + {:arglists (quote ([]))} + (^js/JSJoda.TemporalAdjuster [] + (js-invoke java.time.temporal.TemporalAdjusters "firstDayOfMonth"))) + +(defn first-day-of-year + "Returns the \"first day of year\" adjuster, which returns a new date set to + the first day of the current year. + + The ISO calendar system behaves as follows:
+ The input 2011-01-15 will return 2011-01-01.
+ The input 2011-02-15 will return 2011-01-01.
+ + The behavior is suitable for use with most calendar systems. + It is equivalent to: +
+  temporal.with(DAY_OF_YEAR, 1);
+ 
+ + @return the first day-of-year adjuster, not null" + {:arglists (quote ([]))} + (^js/JSJoda.TemporalAdjuster [] + (js-invoke java.time.temporal.TemporalAdjusters "firstDayOfYear"))) + +(defn of-date-adjuster + "Obtains a {@code TemporalAdjuster} that wraps a date adjuster. + + The {@code TemporalAdjuster} is based on the low level {@code Temporal} interface. + This method allows an adjustment from {@code LocalDate} to {@code LocalDate} + to be wrapped to match the temporal-based interface. + This is provided for convenience to make user-written adjusters simpler. + + In general, user-written adjusters should be static constants: +
{@code
+  static TemporalAdjuster TWO_DAYS_LATER =
+       TemporalAdjusters.ofDateAdjuster(date -> date.plusDays(2));
+ }
+ + @param dateBasedAdjuster the date-based adjuster, not null + @return the temporal adjuster wrapping on the date adjuster, not null" + {:arglists (quote (["java.util.function.UnaryOperator"]))} + (^js/JSJoda.TemporalAdjuster + [^java.util.function.UnaryOperator date-based-adjuster] + (js-invoke java.time.temporal.TemporalAdjusters + "ofDateAdjuster" + date-based-adjuster))) + +(defn last-day-of-year + "Returns the \"last day of year\" adjuster, which returns a new date set to + the last day of the current year. + + The ISO calendar system behaves as follows:
+ The input 2011-01-15 will return 2011-12-31.
+ The input 2011-02-15 will return 2011-12-31.
+ + The behavior is suitable for use with most calendar systems. + It is equivalent to: +
+  long lastDay = temporal.range(DAY_OF_YEAR).getMaximum();
+  temporal.with(DAY_OF_YEAR, lastDay);
+ 
+ + @return the last day-of-year adjuster, not null" + {:arglists (quote ([]))} + (^js/JSJoda.TemporalAdjuster [] + (js-invoke java.time.temporal.TemporalAdjusters "lastDayOfYear"))) + +(defn first-in-month + "Returns the first in month adjuster, which returns a new date + in the same month with the first matching day-of-week. + This is used for expressions like 'first Tuesday in March'. + + The ISO calendar system behaves as follows:
+ The input 2011-12-15 for (MONDAY) will return 2011-12-05.
+ The input 2011-12-15 for (FRIDAY) will return 2011-12-02.
+ + The behavior is suitable for use with most calendar systems. + It uses the {@code DAY_OF_WEEK} and {@code DAY_OF_MONTH} fields + and the {@code DAYS} unit, and assumes a seven day week. + + @param dayOfWeek the day-of-week, not null + @return the first in month adjuster, not null" + {:arglists (quote (["java.time.DayOfWeek"]))} + (^js/JSJoda.TemporalAdjuster [^js/JSJoda.DayOfWeek day-of-week] + (js-invoke java.time.temporal.TemporalAdjusters "firstInMonth" day-of-week))) + +(defn previous-or-same + "Returns the previous-or-same day-of-week adjuster, which adjusts the date to the + first occurrence of the specified day-of-week before the date being adjusted + unless it is already on that day in which case the same object is returned. + + The ISO calendar system behaves as follows:
+ The input 2011-01-15 (a Saturday) for parameter (MONDAY) will return 2011-01-10 (five days earlier).
+ The input 2011-01-15 (a Saturday) for parameter (WEDNESDAY) will return 2011-01-12 (three days earlier).
+ The input 2011-01-15 (a Saturday) for parameter (SATURDAY) will return 2011-01-15 (same as input). + + The behavior is suitable for use with most calendar systems. + It uses the {@code DAY_OF_WEEK} field and the {@code DAYS} unit, + and assumes a seven day week. + + @param dayOfWeek the day-of-week to check for or move the date to, not null + @return the previous-or-same day-of-week adjuster, not null" + {:arglists (quote (["java.time.DayOfWeek"]))} + (^js/JSJoda.TemporalAdjuster [^js/JSJoda.DayOfWeek day-of-week] + (js-invoke java.time.temporal.TemporalAdjusters + "previousOrSame" + day-of-week))) + +(defn previous + "Returns the previous day-of-week adjuster, which adjusts the date to the + first occurrence of the specified day-of-week before the date being adjusted. + + The ISO calendar system behaves as follows:
+ The input 2011-01-15 (a Saturday) for parameter (MONDAY) will return 2011-01-10 (five days earlier).
+ The input 2011-01-15 (a Saturday) for parameter (WEDNESDAY) will return 2011-01-12 (three days earlier).
+ The input 2011-01-15 (a Saturday) for parameter (SATURDAY) will return 2011-01-08 (seven days earlier). + + The behavior is suitable for use with most calendar systems. + It uses the {@code DAY_OF_WEEK} field and the {@code DAYS} unit, + and assumes a seven day week. + + @param dayOfWeek the day-of-week to move the date to, not null + @return the previous day-of-week adjuster, not null" + {:arglists (quote (["java.time.DayOfWeek"]))} + (^js/JSJoda.TemporalAdjuster [^js/JSJoda.DayOfWeek day-of-week] + (js-invoke java.time.temporal.TemporalAdjusters "previous" day-of-week))) + +(defn last-day-of-month + "Returns the \"last day of month\" adjuster, which returns a new date set to + the last day of the current month. + + The ISO calendar system behaves as follows:
+ The input 2011-01-15 will return 2011-01-31.
+ The input 2011-02-15 will return 2011-02-28.
+ The input 2012-02-15 will return 2012-02-29 (leap year).
+ The input 2011-04-15 will return 2011-04-30. + + The behavior is suitable for use with most calendar systems. + It is equivalent to: +
+  long lastDay = temporal.range(DAY_OF_MONTH).getMaximum();
+  temporal.with(DAY_OF_MONTH, lastDay);
+ 
+ + @return the last day-of-month adjuster, not null" + {:arglists (quote ([]))} + (^js/JSJoda.TemporalAdjuster [] + (js-invoke java.time.temporal.TemporalAdjusters "lastDayOfMonth"))) + +(defn last-in-month + "Returns the last in month adjuster, which returns a new date + in the same month with the last matching day-of-week. + This is used for expressions like 'last Tuesday in March'. + + The ISO calendar system behaves as follows:
+ The input 2011-12-15 for (MONDAY) will return 2011-12-26.
+ The input 2011-12-15 for (FRIDAY) will return 2011-12-30.
+ + The behavior is suitable for use with most calendar systems. + It uses the {@code DAY_OF_WEEK} and {@code DAY_OF_MONTH} fields + and the {@code DAYS} unit, and assumes a seven day week. + + @param dayOfWeek the day-of-week, not null + @return the first in month adjuster, not null" + {:arglists (quote (["java.time.DayOfWeek"]))} + (^js/JSJoda.TemporalAdjuster [^js/JSJoda.DayOfWeek day-of-week] + (js-invoke java.time.temporal.TemporalAdjusters "lastInMonth" day-of-week))) + +(defn first-day-of-next-year + "Returns the \"first day of next year\" adjuster, which returns a new date set to + the first day of the next year. + + The ISO calendar system behaves as follows:
+ The input 2011-01-15 will return 2012-01-01. + + The behavior is suitable for use with most calendar systems. + It is equivalent to: +
+  temporal.with(DAY_OF_YEAR, 1).plus(1, YEARS);
+ 
+ + @return the first day of next month adjuster, not null" + {:arglists (quote ([]))} + (^js/JSJoda.TemporalAdjuster [] + (js-invoke java.time.temporal.TemporalAdjusters "firstDayOfNextYear"))) + +(defn day-of-week-in-month + "Returns the day-of-week in month adjuster, which returns a new date + in the same month with the ordinal day-of-week. + This is used for expressions like the 'second Tuesday in March'. + + The ISO calendar system behaves as follows:
+ The input 2011-12-15 for (1,TUESDAY) will return 2011-12-06.
+ The input 2011-12-15 for (2,TUESDAY) will return 2011-12-13.
+ The input 2011-12-15 for (3,TUESDAY) will return 2011-12-20.
+ The input 2011-12-15 for (4,TUESDAY) will return 2011-12-27.
+ The input 2011-12-15 for (5,TUESDAY) will return 2012-01-03.
+ The input 2011-12-15 for (-1,TUESDAY) will return 2011-12-27 (last in month).
+ The input 2011-12-15 for (-4,TUESDAY) will return 2011-12-06 (3 weeks before last in month).
+ The input 2011-12-15 for (-5,TUESDAY) will return 2011-11-29 (4 weeks before last in month).
+ The input 2011-12-15 for (0,TUESDAY) will return 2011-11-29 (last in previous month).
+ + For a positive or zero ordinal, the algorithm is equivalent to finding the first + day-of-week that matches within the month and then adding a number of weeks to it. + For a negative ordinal, the algorithm is equivalent to finding the last + day-of-week that matches within the month and then subtracting a number of weeks to it. + The ordinal number of weeks is not validated and is interpreted leniently + according to this algorithm. This definition means that an ordinal of zero finds + the last matching day-of-week in the previous month. + + The behavior is suitable for use with most calendar systems. + It uses the {@code DAY_OF_WEEK} and {@code DAY_OF_MONTH} fields + and the {@code DAYS} unit, and assumes a seven day week. + + @param ordinal the week within the month, unbounded but typically from -5 to 5 + @param dayOfWeek the day-of-week, not null + @return the day-of-week in month adjuster, not null" + {:arglists (quote (["int" "java.time.DayOfWeek"]))} + (^js/JSJoda.TemporalAdjuster [^int ordinal ^js/JSJoda.DayOfWeek day-of-week] + (js-invoke java.time.temporal.TemporalAdjusters + "dayOfWeekInMonth" + ordinal + day-of-week))) diff --git a/src/cljc/java_time/temporal/temporal_amount.clj b/src/cljc/java_time/temporal/temporal_amount.clj index 3e1afc1..6e418c3 100644 --- a/src/cljc/java_time/temporal/temporal_amount.clj +++ b/src/cljc/java_time/temporal/temporal_amount.clj @@ -1,5 +1,135 @@ -(ns cljc.java-time.temporal.temporal-amount (:refer-clojure :exclude [abs get range format min max next name resolve short]) (:require [cljc.java-time.extn.calendar-awareness]) (:import [java.time.temporal TemporalAmount])) -(clojure.core/defn add-to {:arglists (quote (["java.time.temporal.TemporalAmount" "java.time.temporal.Temporal"]))} (^java.time.temporal.Temporal [^java.time.temporal.TemporalAmount this15558 ^java.time.temporal.Temporal java-time-temporal-Temporal15559] (.addTo this15558 java-time-temporal-Temporal15559))) -(clojure.core/defn subtract-from {:arglists (quote (["java.time.temporal.TemporalAmount" "java.time.temporal.Temporal"]))} (^java.time.temporal.Temporal [^java.time.temporal.TemporalAmount this15560 ^java.time.temporal.Temporal java-time-temporal-Temporal15561] (.subtractFrom this15560 java-time-temporal-Temporal15561))) -(clojure.core/defn get {:arglists (quote (["java.time.temporal.TemporalAmount" "java.time.temporal.TemporalUnit"]))} (^long [^java.time.temporal.TemporalAmount this15562 ^java.time.temporal.ChronoUnit java-time-temporal-TemporalUnit15563] (.get this15562 java-time-temporal-TemporalUnit15563))) -(clojure.core/defn get-units {:arglists (quote (["java.time.temporal.TemporalAmount"]))} (^java.util.List [^java.time.temporal.TemporalAmount this15564] (.getUnits this15564))) +(ns cljc.java-time.temporal.temporal-amount + (:refer-clojure :exclude + [abs get range format min max next name resolve short]) + (:require [cljc.java-time.extn.calendar-awareness]) + (:import [java.time.temporal TemporalAmount])) + +(defn add-to + "Adds to the specified temporal object. + + Adds the amount to the specified temporal object using the logic + encapsulated in the implementing class. + + There are two equivalent ways of using this method. + The first is to invoke this method directly. + The second is to use {@link Temporal#plus(TemporalAmount)}: +
+   // These two lines are equivalent, but the second approach is recommended
+   dateTime = amount.addTo(dateTime);
+   dateTime = dateTime.plus(adder);
+ 
+ It is recommended to use the second approach, {@code plus(TemporalAmount)}, + as it is a lot clearer to read in code. + + @implSpec + The implementation must take the input object and add to it. + The implementation defines the logic of the addition and is responsible for + documenting that logic. It may use any method on {@code Temporal} to + query the temporal object and perform the addition. + The returned object must have the same observable type as the input object + + The input object must not be altered. + Instead, an adjusted copy of the original must be returned. + This provides equivalent, safe behavior for immutable and mutable temporal objects. + + The input temporal object may be in a calendar system other than ISO. + Implementations may choose to document compatibility with other calendar systems, + or reject non-ISO temporal objects by {@link TemporalQueries#chronology() querying the chronology}. + + This method may be called from multiple threads in parallel. + It must be thread-safe when invoked. + + @param temporal the temporal object to add the amount to, not null + @return an object of the same observable type with the addition made, not null + @throws DateTimeException if unable to add + @throws ArithmeticException if numeric overflow occurs" + {:arglists (quote (["java.time.temporal.TemporalAmount" + "java.time.temporal.Temporal"]))} + (^java.time.temporal.Temporal + [^java.time.temporal.TemporalAmount this + ^java.time.temporal.Temporal temporal] + (.addTo this temporal))) + +(defn get + "Returns the value of the requested unit. + The units returned from {@link #getUnits()} uniquely define the + value of the {@code TemporalAmount}. A value must be returned + for each unit listed in {@code getUnits}. + + @implSpec + Implementations may declare support for units not listed by {@link #getUnits()}. + Typically, the implementation would define additional units + as conversions for the convenience of developers. + + @param unit the {@code TemporalUnit} for which to return the value + @return the long value of the unit + @throws DateTimeException if a value for the unit cannot be obtained + @throws UnsupportedTemporalTypeException if the {@code unit} is not supported" + {:arglists (quote (["java.time.temporal.TemporalAmount" + "java.time.temporal.TemporalUnit"]))} + (^long + [^java.time.temporal.TemporalAmount this ^java.time.temporal.ChronoUnit unit] + (.get this unit))) + +(defn get-units + "Returns the list of units uniquely defining the value of this TemporalAmount. + The list of {@code TemporalUnits} is defined by the implementation class. + The list is a snapshot of the units at the time {@code getUnits} + is called and is not mutable. + The units are ordered from longest duration to the shortest duration + of the unit. + + @implSpec + The list of units completely and uniquely represents the + state of the object without omissions, overlaps or duplication. + The units are in order from longest duration to shortest. + + @return the List of {@code TemporalUnits}; not null" + {:arglists (quote (["java.time.temporal.TemporalAmount"]))} + (^java.util.List [^java.time.temporal.TemporalAmount this] (.getUnits this))) + +(defn subtract-from + "Subtracts this object from the specified temporal object. + + Subtracts the amount from the specified temporal object using the logic + encapsulated in the implementing class. + + There are two equivalent ways of using this method. + The first is to invoke this method directly. + The second is to use {@link Temporal#minus(TemporalAmount)}: +
+   // these two lines are equivalent, but the second approach is recommended
+   dateTime = amount.subtractFrom(dateTime);
+   dateTime = dateTime.minus(amount);
+ 
+ It is recommended to use the second approach, {@code minus(TemporalAmount)}, + as it is a lot clearer to read in code. + + @implSpec + The implementation must take the input object and subtract from it. + The implementation defines the logic of the subtraction and is responsible for + documenting that logic. It may use any method on {@code Temporal} to + query the temporal object and perform the subtraction. + The returned object must have the same observable type as the input object + + The input object must not be altered. + Instead, an adjusted copy of the original must be returned. + This provides equivalent, safe behavior for immutable and mutable temporal objects. + + The input temporal object may be in a calendar system other than ISO. + Implementations may choose to document compatibility with other calendar systems, + or reject non-ISO temporal objects by {@link TemporalQueries#chronology() querying the chronology}. + + This method may be called from multiple threads in parallel. + It must be thread-safe when invoked. + + @param temporal the temporal object to subtract the amount from, not null + @return an object of the same observable type with the subtraction made, not null + @throws DateTimeException if unable to subtract + @throws ArithmeticException if numeric overflow occurs" + {:arglists (quote (["java.time.temporal.TemporalAmount" + "java.time.temporal.Temporal"]))} + (^java.time.temporal.Temporal + [^java.time.temporal.TemporalAmount this + ^java.time.temporal.Temporal temporal] + (.subtractFrom this temporal))) diff --git a/src/cljc/java_time/temporal/temporal_amount.cljs b/src/cljc/java_time/temporal/temporal_amount.cljs index 214ee85..638c576 100644 --- a/src/cljc/java_time/temporal/temporal_amount.cljs +++ b/src/cljc/java_time/temporal/temporal_amount.cljs @@ -1,5 +1,133 @@ -(ns cljc.java-time.temporal.temporal-amount (:refer-clojure :exclude [abs get range format min max next name resolve short]) (:require [cljc.java-time.extn.calendar-awareness] [goog.object] [java.time.temporal :refer [TemporalAmount]])) -(clojure.core/defn add-to {:arglists (quote (["java.time.temporal.TemporalAmount" "java.time.temporal.Temporal"]))} (^js/JSJoda.Temporal [^js/JSJoda.TemporalAmount this15565 ^js/JSJoda.Temporal java-time-temporal-Temporal15566] (.addTo this15565 java-time-temporal-Temporal15566))) -(clojure.core/defn subtract-from {:arglists (quote (["java.time.temporal.TemporalAmount" "java.time.temporal.Temporal"]))} (^js/JSJoda.Temporal [^js/JSJoda.TemporalAmount this15567 ^js/JSJoda.Temporal java-time-temporal-Temporal15568] (.subtractFrom this15567 java-time-temporal-Temporal15568))) -(clojure.core/defn get {:arglists (quote (["java.time.temporal.TemporalAmount" "java.time.temporal.TemporalUnit"]))} (^long [^js/JSJoda.TemporalAmount this15569 ^js/JSJoda.TemporalUnit java-time-temporal-TemporalUnit15570] (.get this15569 java-time-temporal-TemporalUnit15570))) -(clojure.core/defn get-units {:arglists (quote (["java.time.temporal.TemporalAmount"]))} (^java.util.List [^js/JSJoda.TemporalAmount this15571] (.units this15571))) +(ns cljc.java-time.temporal.temporal-amount + (:refer-clojure :exclude + [abs get range format min max next name resolve short]) + (:require [cljc.java-time.extn.calendar-awareness] + [goog.object] + [java.time.temporal :refer [TemporalAmount]])) + +(defn add-to + "Adds to the specified temporal object. + + Adds the amount to the specified temporal object using the logic + encapsulated in the implementing class. + + There are two equivalent ways of using this method. + The first is to invoke this method directly. + The second is to use {@link Temporal#plus(TemporalAmount)}: +
+   // These two lines are equivalent, but the second approach is recommended
+   dateTime = amount.addTo(dateTime);
+   dateTime = dateTime.plus(adder);
+ 
+ It is recommended to use the second approach, {@code plus(TemporalAmount)}, + as it is a lot clearer to read in code. + + @implSpec + The implementation must take the input object and add to it. + The implementation defines the logic of the addition and is responsible for + documenting that logic. It may use any method on {@code Temporal} to + query the temporal object and perform the addition. + The returned object must have the same observable type as the input object + + The input object must not be altered. + Instead, an adjusted copy of the original must be returned. + This provides equivalent, safe behavior for immutable and mutable temporal objects. + + The input temporal object may be in a calendar system other than ISO. + Implementations may choose to document compatibility with other calendar systems, + or reject non-ISO temporal objects by {@link TemporalQueries#chronology() querying the chronology}. + + This method may be called from multiple threads in parallel. + It must be thread-safe when invoked. + + @param temporal the temporal object to add the amount to, not null + @return an object of the same observable type with the addition made, not null + @throws DateTimeException if unable to add + @throws ArithmeticException if numeric overflow occurs" + {:arglists (quote (["java.time.temporal.TemporalAmount" + "java.time.temporal.Temporal"]))} + (^js/JSJoda.Temporal + [^js/JSJoda.TemporalAmount this ^js/JSJoda.Temporal temporal] + (.addTo this temporal))) + +(defn get + "Returns the value of the requested unit. + The units returned from {@link #getUnits()} uniquely define the + value of the {@code TemporalAmount}. A value must be returned + for each unit listed in {@code getUnits}. + + @implSpec + Implementations may declare support for units not listed by {@link #getUnits()}. + Typically, the implementation would define additional units + as conversions for the convenience of developers. + + @param unit the {@code TemporalUnit} for which to return the value + @return the long value of the unit + @throws DateTimeException if a value for the unit cannot be obtained + @throws UnsupportedTemporalTypeException if the {@code unit} is not supported" + {:arglists (quote (["java.time.temporal.TemporalAmount" + "java.time.temporal.TemporalUnit"]))} + (^long [^js/JSJoda.TemporalAmount this ^js/JSJoda.TemporalUnit unit] + (.get this unit))) + +(defn get-units + "Returns the list of units uniquely defining the value of this TemporalAmount. + The list of {@code TemporalUnits} is defined by the implementation class. + The list is a snapshot of the units at the time {@code getUnits} + is called and is not mutable. + The units are ordered from longest duration to the shortest duration + of the unit. + + @implSpec + The list of units completely and uniquely represents the + state of the object without omissions, overlaps or duplication. + The units are in order from longest duration to shortest. + + @return the List of {@code TemporalUnits}; not null" + {:arglists (quote (["java.time.temporal.TemporalAmount"]))} + (^java.util.List [^js/JSJoda.TemporalAmount this] (.units this))) + +(defn subtract-from + "Subtracts this object from the specified temporal object. + + Subtracts the amount from the specified temporal object using the logic + encapsulated in the implementing class. + + There are two equivalent ways of using this method. + The first is to invoke this method directly. + The second is to use {@link Temporal#minus(TemporalAmount)}: +
+   // these two lines are equivalent, but the second approach is recommended
+   dateTime = amount.subtractFrom(dateTime);
+   dateTime = dateTime.minus(amount);
+ 
+ It is recommended to use the second approach, {@code minus(TemporalAmount)}, + as it is a lot clearer to read in code. + + @implSpec + The implementation must take the input object and subtract from it. + The implementation defines the logic of the subtraction and is responsible for + documenting that logic. It may use any method on {@code Temporal} to + query the temporal object and perform the subtraction. + The returned object must have the same observable type as the input object + + The input object must not be altered. + Instead, an adjusted copy of the original must be returned. + This provides equivalent, safe behavior for immutable and mutable temporal objects. + + The input temporal object may be in a calendar system other than ISO. + Implementations may choose to document compatibility with other calendar systems, + or reject non-ISO temporal objects by {@link TemporalQueries#chronology() querying the chronology}. + + This method may be called from multiple threads in parallel. + It must be thread-safe when invoked. + + @param temporal the temporal object to subtract the amount from, not null + @return an object of the same observable type with the subtraction made, not null + @throws DateTimeException if unable to subtract + @throws ArithmeticException if numeric overflow occurs" + {:arglists (quote (["java.time.temporal.TemporalAmount" + "java.time.temporal.Temporal"]))} + (^js/JSJoda.Temporal + [^js/JSJoda.TemporalAmount this ^js/JSJoda.Temporal temporal] + (.subtractFrom this temporal))) diff --git a/src/cljc/java_time/temporal/temporal_field.clj b/src/cljc/java_time/temporal/temporal_field.clj index 717f2ea..2219eb2 100644 --- a/src/cljc/java_time/temporal/temporal_field.clj +++ b/src/cljc/java_time/temporal/temporal_field.clj @@ -1,13 +1,320 @@ -(ns cljc.java-time.temporal.temporal-field (:refer-clojure :exclude [abs get range format min max next name resolve short]) (:require [cljc.java-time.extn.calendar-awareness]) (:import [java.time.temporal TemporalField])) -(clojure.core/defn get-range-unit {:arglists (quote (["java.time.temporal.TemporalField"]))} (^java.time.temporal.ChronoUnit [^java.time.temporal.TemporalField this15832] (.getRangeUnit this15832))) -(clojure.core/defn range {:arglists (quote (["java.time.temporal.TemporalField"]))} (^java.time.temporal.ValueRange [^java.time.temporal.TemporalField this15833] (.range this15833))) -(clojure.core/defn resolve {:arglists (quote (["java.time.temporal.TemporalField" "java.util.Map" "java.time.temporal.TemporalAccessor" "java.time.format.ResolverStyle"]))} (^java.time.temporal.TemporalAccessor [^java.time.temporal.TemporalField this15834 ^java.util.Map java-util-Map15835 ^java.time.temporal.TemporalAccessor java-time-temporal-TemporalAccessor15836 ^java.time.format.ResolverStyle java-time-format-ResolverStyle15837] (.resolve this15834 java-util-Map15835 java-time-temporal-TemporalAccessor15836 java-time-format-ResolverStyle15837))) -(clojure.core/defn get-base-unit {:arglists (quote (["java.time.temporal.TemporalField"]))} (^java.time.temporal.ChronoUnit [^java.time.temporal.TemporalField this15838] (.getBaseUnit this15838))) -(clojure.core/defn to-string {:arglists (quote (["java.time.temporal.TemporalField"]))} (^java.lang.String [^java.time.temporal.TemporalField this15839] (.toString this15839))) -(clojure.core/defn is-date-based {:arglists (quote (["java.time.temporal.TemporalField"]))} (^java.lang.Boolean [^java.time.temporal.TemporalField this15840] (.isDateBased this15840))) -(clojure.core/defn get-display-name {:arglists (quote (["java.time.temporal.TemporalField" "java.util.Locale"]))} (^java.lang.String [^java.time.temporal.TemporalField this15841 ^java.util.Locale java-util-Locale15842] (.getDisplayName this15841 java-util-Locale15842))) -(clojure.core/defn is-supported-by {:arglists (quote (["java.time.temporal.TemporalField" "java.time.temporal.TemporalAccessor"]))} (^java.lang.Boolean [^java.time.temporal.TemporalField this15843 ^java.time.temporal.TemporalAccessor java-time-temporal-TemporalAccessor15844] (.isSupportedBy this15843 java-time-temporal-TemporalAccessor15844))) -(clojure.core/defn range-refined-by {:arglists (quote (["java.time.temporal.TemporalField" "java.time.temporal.TemporalAccessor"]))} (^java.time.temporal.ValueRange [^java.time.temporal.TemporalField this15845 ^java.time.temporal.TemporalAccessor java-time-temporal-TemporalAccessor15846] (.rangeRefinedBy this15845 java-time-temporal-TemporalAccessor15846))) -(clojure.core/defn adjust-into {:arglists (quote (["java.time.temporal.TemporalField" "java.time.temporal.Temporal" "long"]))} (^java.time.temporal.Temporal [^java.time.temporal.TemporalField this15847 ^java.time.temporal.Temporal java-time-temporal-Temporal15848 ^long long15849] (.adjustInto this15847 java-time-temporal-Temporal15848 long15849))) -(clojure.core/defn get-from {:arglists (quote (["java.time.temporal.TemporalField" "java.time.temporal.TemporalAccessor"]))} (^long [^java.time.temporal.TemporalField this15850 ^java.time.temporal.TemporalAccessor java-time-temporal-TemporalAccessor15851] (.getFrom this15850 java-time-temporal-TemporalAccessor15851))) -(clojure.core/defn is-time-based {:arglists (quote (["java.time.temporal.TemporalField"]))} (^java.lang.Boolean [^java.time.temporal.TemporalField this15852] (.isTimeBased this15852))) +(ns cljc.java-time.temporal.temporal-field + (:refer-clojure :exclude + [abs get range format min max next name resolve short]) + (:require [cljc.java-time.extn.calendar-awareness]) + (:import [java.time.temporal TemporalField])) + +(defn get-range-unit + "Gets the range that the field is bound by. + + The range of the field is the period that the field varies within. + For example, in the field 'MonthOfYear', the range is 'Years'. + See also {@link #getBaseUnit()}. + + The range is never null. For example, the 'Year' field is shorthand for + 'YearOfForever'. It therefore has a unit of 'Years' and a range of 'Forever'. + + @return the unit defining the range of the field, not null" + {:arglists (quote (["java.time.temporal.TemporalField"]))} + (^java.time.temporal.ChronoUnit [^java.time.temporal.TemporalField this] + (.getRangeUnit this))) + +(defn range + "Gets the range of valid values for the field. + + All fields can be expressed as a {@code long} integer. + This method returns an object that describes the valid range for that value. + This method is generally only applicable to the ISO-8601 calendar system. + + Note that the result only describes the minimum and maximum valid values + and it is important not to read too much into them. For example, there + could be values within the range that are invalid for the field. + + @return the range of valid values for the field, not null" + {:arglists (quote (["java.time.temporal.TemporalField"]))} + (^java.time.temporal.ValueRange [^java.time.temporal.TemporalField this] + (.range this))) + +(defn resolve + "Resolves this field to provide a simpler alternative or a date. + + This method is invoked during the resolve phase of parsing. + It is designed to allow application defined fields to be simplified into + more standard fields, such as those on {@code ChronoField}, or into a date. + + Applications should not normally invoke this method directly. + + @implSpec + If an implementation represents a field that can be simplified, or + combined with others, then this method must be implemented. + + The specified map contains the current state of the parse. + The map is mutable and must be mutated to resolve the field and + any related fields. This method will only be invoked during parsing + if the map contains this field, and implementations should therefore + assume this field is present. + + Resolving a field will consist of looking at the value of this field, + and potentially other fields, and either updating the map with a + simpler value, such as a {@code ChronoField}, or returning a + complete {@code ChronoLocalDate}. If a resolve is successful, + the code must remove all the fields that were resolved from the map, + including this field. + + For example, the {@code IsoFields} class contains the quarter-of-year + and day-of-quarter fields. The implementation of this method in that class + resolves the two fields plus the {@link ChronoField#YEAR YEAR} into a + complete {@code LocalDate}. The resolve method will remove all three + fields from the map before returning the {@code LocalDate}. + + A partially complete temporal is used to allow the chronology and zone + to be queried. In general, only the chronology will be needed. + Querying items other than the zone or chronology is undefined and + must not be relied on. + The behavior of other methods such as {@code get}, {@code getLong}, + {@code range} and {@code isSupported} is unpredictable and the results undefined. + + If resolution should be possible, but the data is invalid, the resolver + style should be used to determine an appropriate level of leniency, which + may require throwing a {@code DateTimeException} or {@code ArithmeticException}. + If no resolution is possible, the resolve method must return null. + + When resolving time fields, the map will be altered and null returned. + When resolving date fields, the date is normally returned from the method, + with the map altered to remove the resolved fields. However, it would also + be acceptable for the date fields to be resolved into other {@code ChronoField} + instances that can produce a date, such as {@code EPOCH_DAY}. + + Not all {@code TemporalAccessor} implementations are accepted as return values. + Implementations that call this method must accept {@code ChronoLocalDate}, + {@code ChronoLocalDateTime}, {@code ChronoZonedDateTime} and {@code LocalTime}. + + The default implementation must return null. + + @param fieldValues the map of fields to values, which can be updated, not null + @param partialTemporal the partially complete temporal to query for zone and + chronology; querying for other things is undefined and not recommended, not null + @param resolverStyle the requested type of resolve, not null + @return the resolved temporal object; null if resolving only + changed the map, or no resolve occurred + @throws ArithmeticException if numeric overflow occurs + @throws DateTimeException if resolving results in an error. This must not be thrown + by querying a field on the temporal without first checking if it is supported" + {:arglists (quote (["java.time.temporal.TemporalField" "java.util.Map" + "java.time.temporal.TemporalAccessor" + "java.time.format.ResolverStyle"]))} + (^java.time.temporal.TemporalAccessor + [^java.time.temporal.TemporalField this ^java.util.Map field-values + ^java.time.temporal.TemporalAccessor partial-temporal + ^java.time.format.ResolverStyle resolver-style] + (.resolve this field-values partial-temporal resolver-style))) + +(defn get-base-unit + "Gets the unit that the field is measured in. + + The unit of the field is the period that varies within the range. + For example, in the field 'MonthOfYear', the unit is 'Months'. + See also {@link #getRangeUnit()}. + + @return the unit defining the base unit of the field, not null" + {:arglists (quote (["java.time.temporal.TemporalField"]))} + (^java.time.temporal.ChronoUnit [^java.time.temporal.TemporalField this] + (.getBaseUnit this))) + +(defn to-string + "Gets a descriptive name for the field. + + The should be of the format 'BaseOfRange', such as 'MonthOfYear', + unless the field has a range of {@code FOREVER}, when only + the base unit is mentioned, such as 'Year' or 'Era'. + + @return the name of the field, not null" + {:arglists (quote (["java.time.temporal.TemporalField"]))} + (^java.lang.String [^java.time.temporal.TemporalField this] (.toString this))) + +(defn is-date-based + "Checks if this field represents a component of a date. + + A field is date-based if it can be derived from + {@link ChronoField#EPOCH_DAY EPOCH_DAY}. + Note that it is valid for both {@code isDateBased()} and {@code isTimeBased()} + to return false, such as when representing a field like minute-of-week. + + @return true if this field is a component of a date" + {:arglists (quote (["java.time.temporal.TemporalField"]))} + (^java.lang.Boolean [^java.time.temporal.TemporalField this] + (.isDateBased this))) + +(defn get-display-name + "Gets the display name for the field in the requested locale. + + If there is no display name for the locale then a suitable default must be returned. + + The default implementation must check the locale is not null + and return {@code toString()}. + + @param locale the locale to use, not null + @return the display name for the locale or a suitable default, not null" + {:arglists (quote (["java.time.temporal.TemporalField" "java.util.Locale"]))} + (^java.lang.String + [^java.time.temporal.TemporalField this ^java.util.Locale locale] + (.getDisplayName this locale))) + +(defn is-supported-by + "Checks if this field is supported by the temporal object. + + This determines whether the temporal accessor supports this field. + If this returns false, then the temporal cannot be queried for this field. + + There are two equivalent ways of using this method. + The first is to invoke this method directly. + The second is to use {@link TemporalAccessor#isSupported(TemporalField)}: +
+   // these two lines are equivalent, but the second approach is recommended
+   temporal = thisField.isSupportedBy(temporal);
+   temporal = temporal.isSupported(thisField);
+ 
+ It is recommended to use the second approach, {@code isSupported(TemporalField)}, + as it is a lot clearer to read in code. + + Implementations should determine whether they are supported using the fields + available in {@link ChronoField}. + + @param temporal the temporal object to query, not null + @return true if the date-time can be queried for this field, false if not" + {:arglists (quote (["java.time.temporal.TemporalField" + "java.time.temporal.TemporalAccessor"]))} + (^java.lang.Boolean + [^java.time.temporal.TemporalField this + ^java.time.temporal.TemporalAccessor temporal] + (.isSupportedBy this temporal))) + +(defn range-refined-by + "Get the range of valid values for this field using the temporal object to + refine the result. + + This uses the temporal object to find the range of valid values for the field. + This is similar to {@link #range()}, however this method refines the result + using the temporal. For example, if the field is {@code DAY_OF_MONTH} the + {@code range} method is not accurate as there are four possible month lengths, + 28, 29, 30 and 31 days. Using this method with a date allows the range to be + accurate, returning just one of those four options. + + There are two equivalent ways of using this method. + The first is to invoke this method directly. + The second is to use {@link TemporalAccessor#range(TemporalField)}: +
+   // these two lines are equivalent, but the second approach is recommended
+   temporal = thisField.rangeRefinedBy(temporal);
+   temporal = temporal.range(thisField);
+ 
+ It is recommended to use the second approach, {@code range(TemporalField)}, + as it is a lot clearer to read in code. + + Implementations should perform any queries or calculations using the fields + available in {@link ChronoField}. + If the field is not supported an {@code UnsupportedTemporalTypeException} must be thrown. + + @param temporal the temporal object used to refine the result, not null + @return the range of valid values for this field, not null + @throws DateTimeException if the range for the field cannot be obtained + @throws UnsupportedTemporalTypeException if the field is not supported by the temporal" + {:arglists (quote (["java.time.temporal.TemporalField" + "java.time.temporal.TemporalAccessor"]))} + (^java.time.temporal.ValueRange + [^java.time.temporal.TemporalField this + ^java.time.temporal.TemporalAccessor temporal] + (.rangeRefinedBy this temporal))) + +(defn adjust-into + "Returns a copy of the specified temporal object with the value of this field set. + + This returns a new temporal object based on the specified one with the value for + this field changed. For example, on a {@code LocalDate}, this could be used to + set the year, month or day-of-month. + The returned object has the same observable type as the specified object. + + In some cases, changing a field is not fully defined. For example, if the target object is + a date representing the 31st January, then changing the month to February would be unclear. + In cases like this, the implementation is responsible for resolving the result. + Typically it will choose the previous valid date, which would be the last valid + day of February in this example. + + There are two equivalent ways of using this method. + The first is to invoke this method directly. + The second is to use {@link Temporal#with(TemporalField, long)}: +
+   // these two lines are equivalent, but the second approach is recommended
+   temporal = thisField.adjustInto(temporal);
+   temporal = temporal.with(thisField);
+ 
+ It is recommended to use the second approach, {@code with(TemporalField)}, + as it is a lot clearer to read in code. + + Implementations should perform any queries or calculations using the fields + available in {@link ChronoField}. + If the field is not supported an {@code UnsupportedTemporalTypeException} must be thrown. + + Implementations must not alter the specified temporal object. + Instead, an adjusted copy of the original must be returned. + This provides equivalent, safe behavior for immutable and mutable implementations. + + @param the type of the Temporal object + @param temporal the temporal object to adjust, not null + @param newValue the new value of the field + @return the adjusted temporal object, not null + @throws DateTimeException if the field cannot be set + @throws UnsupportedTemporalTypeException if the field is not supported by the temporal + @throws ArithmeticException if numeric overflow occurs" + {:arglists (quote (["java.time.temporal.TemporalField" + "java.time.temporal.Temporal" "long"]))} + (^java.time.temporal.Temporal + [^java.time.temporal.TemporalField this ^java.time.temporal.Temporal temporal + ^long new-value] + (.adjustInto this temporal new-value))) + +(defn get-from + "Gets the value of this field from the specified temporal object. + + This queries the temporal object for the value of this field. + + There are two equivalent ways of using this method. + The first is to invoke this method directly. + The second is to use {@link TemporalAccessor#getLong(TemporalField)} + (or {@link TemporalAccessor#get(TemporalField)}): +
+   // these two lines are equivalent, but the second approach is recommended
+   temporal = thisField.getFrom(temporal);
+   temporal = temporal.getLong(thisField);
+ 
+ It is recommended to use the second approach, {@code getLong(TemporalField)}, + as it is a lot clearer to read in code. + + Implementations should perform any queries or calculations using the fields + available in {@link ChronoField}. + If the field is not supported an {@code UnsupportedTemporalTypeException} must be thrown. + + @param temporal the temporal object to query, not null + @return the value of this field, not null + @throws DateTimeException if a value for the field cannot be obtained + @throws UnsupportedTemporalTypeException if the field is not supported by the temporal + @throws ArithmeticException if numeric overflow occurs" + {:arglists (quote (["java.time.temporal.TemporalField" + "java.time.temporal.TemporalAccessor"]))} + (^long + [^java.time.temporal.TemporalField this + ^java.time.temporal.TemporalAccessor temporal] + (.getFrom this temporal))) + +(defn is-time-based + "Checks if this field represents a component of a time. + + A field is time-based if it can be derived from + {@link ChronoField#NANO_OF_DAY NANO_OF_DAY}. + Note that it is valid for both {@code isDateBased()} and {@code isTimeBased()} + to return false, such as when representing a field like minute-of-week. + + @return true if this field is a component of a time" + {:arglists (quote (["java.time.temporal.TemporalField"]))} + (^java.lang.Boolean [^java.time.temporal.TemporalField this] + (.isTimeBased this))) diff --git a/src/cljc/java_time/temporal/temporal_field.cljs b/src/cljc/java_time/temporal/temporal_field.cljs index f11e798..71338b8 100644 --- a/src/cljc/java_time/temporal/temporal_field.cljs +++ b/src/cljc/java_time/temporal/temporal_field.cljs @@ -1,13 +1,309 @@ -(ns cljc.java-time.temporal.temporal-field (:refer-clojure :exclude [abs get range format min max next name resolve short]) (:require [cljc.java-time.extn.calendar-awareness] [goog.object] [java.time.temporal :refer [TemporalField]])) -(clojure.core/defn get-range-unit {:arglists (quote (["java.time.temporal.TemporalField"]))} (^js/JSJoda.TemporalUnit [^js/JSJoda.TemporalField this15853] (.rangeUnit this15853))) -(clojure.core/defn range {:arglists (quote (["java.time.temporal.TemporalField"]))} (^js/JSJoda.ValueRange [^js/JSJoda.TemporalField this15854] (.range this15854))) -(clojure.core/defn resolve {:arglists (quote (["java.time.temporal.TemporalField" "java.util.Map" "java.time.temporal.TemporalAccessor" "java.time.format.ResolverStyle"]))} (^js/JSJoda.TemporalAccessor [^js/JSJoda.TemporalField this15855 ^java.util.Map java-util-Map15856 ^js/JSJoda.TemporalAccessor java-time-temporal-TemporalAccessor15857 ^js/JSJoda.ResolverStyle java-time-format-ResolverStyle15858] (.resolve this15855 java-util-Map15856 java-time-temporal-TemporalAccessor15857 java-time-format-ResolverStyle15858))) -(clojure.core/defn get-base-unit {:arglists (quote (["java.time.temporal.TemporalField"]))} (^js/JSJoda.TemporalUnit [^js/JSJoda.TemporalField this15859] (.baseUnit this15859))) -(clojure.core/defn to-string {:arglists (quote (["java.time.temporal.TemporalField"]))} (^java.lang.String [^js/JSJoda.TemporalField this15860] (.toString this15860))) -(clojure.core/defn is-date-based {:arglists (quote (["java.time.temporal.TemporalField"]))} (^boolean [^js/JSJoda.TemporalField this15861] (.isDateBased this15861))) -(clojure.core/defn get-display-name {:arglists (quote (["java.time.temporal.TemporalField" "java.util.Locale"]))} (^java.lang.String [^js/JSJoda.TemporalField this15862 ^java.util.Locale java-util-Locale15863] (.displayName this15862 java-util-Locale15863))) -(clojure.core/defn is-supported-by {:arglists (quote (["java.time.temporal.TemporalField" "java.time.temporal.TemporalAccessor"]))} (^boolean [^js/JSJoda.TemporalField this15864 ^js/JSJoda.TemporalAccessor java-time-temporal-TemporalAccessor15865] (.isSupportedBy this15864 java-time-temporal-TemporalAccessor15865))) -(clojure.core/defn range-refined-by {:arglists (quote (["java.time.temporal.TemporalField" "java.time.temporal.TemporalAccessor"]))} (^js/JSJoda.ValueRange [^js/JSJoda.TemporalField this15866 ^js/JSJoda.TemporalAccessor java-time-temporal-TemporalAccessor15867] (.rangeRefinedBy this15866 java-time-temporal-TemporalAccessor15867))) -(clojure.core/defn adjust-into {:arglists (quote (["java.time.temporal.TemporalField" "java.time.temporal.Temporal" "long"]))} (^js/JSJoda.Temporal [^js/JSJoda.TemporalField this15868 ^js/JSJoda.Temporal java-time-temporal-Temporal15869 ^long long15870] (.adjustInto this15868 java-time-temporal-Temporal15869 long15870))) -(clojure.core/defn get-from {:arglists (quote (["java.time.temporal.TemporalField" "java.time.temporal.TemporalAccessor"]))} (^long [^js/JSJoda.TemporalField this15871 ^js/JSJoda.TemporalAccessor java-time-temporal-TemporalAccessor15872] (.from this15871 java-time-temporal-TemporalAccessor15872))) -(clojure.core/defn is-time-based {:arglists (quote (["java.time.temporal.TemporalField"]))} (^boolean [^js/JSJoda.TemporalField this15873] (.isTimeBased this15873))) +(ns cljc.java-time.temporal.temporal-field + (:refer-clojure :exclude + [abs get range format min max next name resolve short]) + (:require [cljc.java-time.extn.calendar-awareness] + [goog.object] + [java.time.temporal :refer [TemporalField]])) + +(defn get-range-unit + "Gets the range that the field is bound by. + + The range of the field is the period that the field varies within. + For example, in the field 'MonthOfYear', the range is 'Years'. + See also {@link #getBaseUnit()}. + + The range is never null. For example, the 'Year' field is shorthand for + 'YearOfForever'. It therefore has a unit of 'Years' and a range of 'Forever'. + + @return the unit defining the range of the field, not null" + {:arglists (quote (["java.time.temporal.TemporalField"]))} + (^js/JSJoda.TemporalUnit [^js/JSJoda.TemporalField this] (.rangeUnit this))) + +(defn range + "Gets the range of valid values for the field. + + All fields can be expressed as a {@code long} integer. + This method returns an object that describes the valid range for that value. + This method is generally only applicable to the ISO-8601 calendar system. + + Note that the result only describes the minimum and maximum valid values + and it is important not to read too much into them. For example, there + could be values within the range that are invalid for the field. + + @return the range of valid values for the field, not null" + {:arglists (quote (["java.time.temporal.TemporalField"]))} + (^js/JSJoda.ValueRange [^js/JSJoda.TemporalField this] (.range this))) + +(defn resolve + "Resolves this field to provide a simpler alternative or a date. + + This method is invoked during the resolve phase of parsing. + It is designed to allow application defined fields to be simplified into + more standard fields, such as those on {@code ChronoField}, or into a date. + + Applications should not normally invoke this method directly. + + @implSpec + If an implementation represents a field that can be simplified, or + combined with others, then this method must be implemented. + + The specified map contains the current state of the parse. + The map is mutable and must be mutated to resolve the field and + any related fields. This method will only be invoked during parsing + if the map contains this field, and implementations should therefore + assume this field is present. + + Resolving a field will consist of looking at the value of this field, + and potentially other fields, and either updating the map with a + simpler value, such as a {@code ChronoField}, or returning a + complete {@code ChronoLocalDate}. If a resolve is successful, + the code must remove all the fields that were resolved from the map, + including this field. + + For example, the {@code IsoFields} class contains the quarter-of-year + and day-of-quarter fields. The implementation of this method in that class + resolves the two fields plus the {@link ChronoField#YEAR YEAR} into a + complete {@code LocalDate}. The resolve method will remove all three + fields from the map before returning the {@code LocalDate}. + + A partially complete temporal is used to allow the chronology and zone + to be queried. In general, only the chronology will be needed. + Querying items other than the zone or chronology is undefined and + must not be relied on. + The behavior of other methods such as {@code get}, {@code getLong}, + {@code range} and {@code isSupported} is unpredictable and the results undefined. + + If resolution should be possible, but the data is invalid, the resolver + style should be used to determine an appropriate level of leniency, which + may require throwing a {@code DateTimeException} or {@code ArithmeticException}. + If no resolution is possible, the resolve method must return null. + + When resolving time fields, the map will be altered and null returned. + When resolving date fields, the date is normally returned from the method, + with the map altered to remove the resolved fields. However, it would also + be acceptable for the date fields to be resolved into other {@code ChronoField} + instances that can produce a date, such as {@code EPOCH_DAY}. + + Not all {@code TemporalAccessor} implementations are accepted as return values. + Implementations that call this method must accept {@code ChronoLocalDate}, + {@code ChronoLocalDateTime}, {@code ChronoZonedDateTime} and {@code LocalTime}. + + The default implementation must return null. + + @param fieldValues the map of fields to values, which can be updated, not null + @param partialTemporal the partially complete temporal to query for zone and + chronology; querying for other things is undefined and not recommended, not null + @param resolverStyle the requested type of resolve, not null + @return the resolved temporal object; null if resolving only + changed the map, or no resolve occurred + @throws ArithmeticException if numeric overflow occurs + @throws DateTimeException if resolving results in an error. This must not be thrown + by querying a field on the temporal without first checking if it is supported" + {:arglists (quote (["java.time.temporal.TemporalField" "java.util.Map" + "java.time.temporal.TemporalAccessor" + "java.time.format.ResolverStyle"]))} + (^js/JSJoda.TemporalAccessor + [^js/JSJoda.TemporalField this ^java.util.Map field-values + ^js/JSJoda.TemporalAccessor partial-temporal + ^js/JSJoda.ResolverStyle resolver-style] + (.resolve this field-values partial-temporal resolver-style))) + +(defn get-base-unit + "Gets the unit that the field is measured in. + + The unit of the field is the period that varies within the range. + For example, in the field 'MonthOfYear', the unit is 'Months'. + See also {@link #getRangeUnit()}. + + @return the unit defining the base unit of the field, not null" + {:arglists (quote (["java.time.temporal.TemporalField"]))} + (^js/JSJoda.TemporalUnit [^js/JSJoda.TemporalField this] (.baseUnit this))) + +(defn to-string + "Gets a descriptive name for the field. + + The should be of the format 'BaseOfRange', such as 'MonthOfYear', + unless the field has a range of {@code FOREVER}, when only + the base unit is mentioned, such as 'Year' or 'Era'. + + @return the name of the field, not null" + {:arglists (quote (["java.time.temporal.TemporalField"]))} + (^java.lang.String [^js/JSJoda.TemporalField this] (.toString this))) + +(defn is-date-based + "Checks if this field represents a component of a date. + + A field is date-based if it can be derived from + {@link ChronoField#EPOCH_DAY EPOCH_DAY}. + Note that it is valid for both {@code isDateBased()} and {@code isTimeBased()} + to return false, such as when representing a field like minute-of-week. + + @return true if this field is a component of a date" + {:arglists (quote (["java.time.temporal.TemporalField"]))} + (^boolean [^js/JSJoda.TemporalField this] (.isDateBased this))) + +(defn get-display-name + "Gets the display name for the field in the requested locale. + + If there is no display name for the locale then a suitable default must be returned. + + The default implementation must check the locale is not null + and return {@code toString()}. + + @param locale the locale to use, not null + @return the display name for the locale or a suitable default, not null" + {:arglists (quote (["java.time.temporal.TemporalField" "java.util.Locale"]))} + (^java.lang.String [^js/JSJoda.TemporalField this ^java.util.Locale locale] + (.displayName this locale))) + +(defn is-supported-by + "Checks if this field is supported by the temporal object. + + This determines whether the temporal accessor supports this field. + If this returns false, then the temporal cannot be queried for this field. + + There are two equivalent ways of using this method. + The first is to invoke this method directly. + The second is to use {@link TemporalAccessor#isSupported(TemporalField)}: +
+   // these two lines are equivalent, but the second approach is recommended
+   temporal = thisField.isSupportedBy(temporal);
+   temporal = temporal.isSupported(thisField);
+ 
+ It is recommended to use the second approach, {@code isSupported(TemporalField)}, + as it is a lot clearer to read in code. + + Implementations should determine whether they are supported using the fields + available in {@link ChronoField}. + + @param temporal the temporal object to query, not null + @return true if the date-time can be queried for this field, false if not" + {:arglists (quote (["java.time.temporal.TemporalField" + "java.time.temporal.TemporalAccessor"]))} + (^boolean [^js/JSJoda.TemporalField this ^js/JSJoda.TemporalAccessor temporal] + (.isSupportedBy this temporal))) + +(defn range-refined-by + "Get the range of valid values for this field using the temporal object to + refine the result. + + This uses the temporal object to find the range of valid values for the field. + This is similar to {@link #range()}, however this method refines the result + using the temporal. For example, if the field is {@code DAY_OF_MONTH} the + {@code range} method is not accurate as there are four possible month lengths, + 28, 29, 30 and 31 days. Using this method with a date allows the range to be + accurate, returning just one of those four options. + + There are two equivalent ways of using this method. + The first is to invoke this method directly. + The second is to use {@link TemporalAccessor#range(TemporalField)}: +
+   // these two lines are equivalent, but the second approach is recommended
+   temporal = thisField.rangeRefinedBy(temporal);
+   temporal = temporal.range(thisField);
+ 
+ It is recommended to use the second approach, {@code range(TemporalField)}, + as it is a lot clearer to read in code. + + Implementations should perform any queries or calculations using the fields + available in {@link ChronoField}. + If the field is not supported an {@code UnsupportedTemporalTypeException} must be thrown. + + @param temporal the temporal object used to refine the result, not null + @return the range of valid values for this field, not null + @throws DateTimeException if the range for the field cannot be obtained + @throws UnsupportedTemporalTypeException if the field is not supported by the temporal" + {:arglists (quote (["java.time.temporal.TemporalField" + "java.time.temporal.TemporalAccessor"]))} + (^js/JSJoda.ValueRange + [^js/JSJoda.TemporalField this ^js/JSJoda.TemporalAccessor temporal] + (.rangeRefinedBy this temporal))) + +(defn adjust-into + "Returns a copy of the specified temporal object with the value of this field set. + + This returns a new temporal object based on the specified one with the value for + this field changed. For example, on a {@code LocalDate}, this could be used to + set the year, month or day-of-month. + The returned object has the same observable type as the specified object. + + In some cases, changing a field is not fully defined. For example, if the target object is + a date representing the 31st January, then changing the month to February would be unclear. + In cases like this, the implementation is responsible for resolving the result. + Typically it will choose the previous valid date, which would be the last valid + day of February in this example. + + There are two equivalent ways of using this method. + The first is to invoke this method directly. + The second is to use {@link Temporal#with(TemporalField, long)}: +
+   // these two lines are equivalent, but the second approach is recommended
+   temporal = thisField.adjustInto(temporal);
+   temporal = temporal.with(thisField);
+ 
+ It is recommended to use the second approach, {@code with(TemporalField)}, + as it is a lot clearer to read in code. + + Implementations should perform any queries or calculations using the fields + available in {@link ChronoField}. + If the field is not supported an {@code UnsupportedTemporalTypeException} must be thrown. + + Implementations must not alter the specified temporal object. + Instead, an adjusted copy of the original must be returned. + This provides equivalent, safe behavior for immutable and mutable implementations. + + @param the type of the Temporal object + @param temporal the temporal object to adjust, not null + @param newValue the new value of the field + @return the adjusted temporal object, not null + @throws DateTimeException if the field cannot be set + @throws UnsupportedTemporalTypeException if the field is not supported by the temporal + @throws ArithmeticException if numeric overflow occurs" + {:arglists (quote (["java.time.temporal.TemporalField" + "java.time.temporal.Temporal" "long"]))} + (^js/JSJoda.Temporal + [^js/JSJoda.TemporalField this ^js/JSJoda.Temporal temporal ^long new-value] + (.adjustInto this temporal new-value))) + +(defn get-from + "Gets the value of this field from the specified temporal object. + + This queries the temporal object for the value of this field. + + There are two equivalent ways of using this method. + The first is to invoke this method directly. + The second is to use {@link TemporalAccessor#getLong(TemporalField)} + (or {@link TemporalAccessor#get(TemporalField)}): +
+   // these two lines are equivalent, but the second approach is recommended
+   temporal = thisField.getFrom(temporal);
+   temporal = temporal.getLong(thisField);
+ 
+ It is recommended to use the second approach, {@code getLong(TemporalField)}, + as it is a lot clearer to read in code. + + Implementations should perform any queries or calculations using the fields + available in {@link ChronoField}. + If the field is not supported an {@code UnsupportedTemporalTypeException} must be thrown. + + @param temporal the temporal object to query, not null + @return the value of this field, not null + @throws DateTimeException if a value for the field cannot be obtained + @throws UnsupportedTemporalTypeException if the field is not supported by the temporal + @throws ArithmeticException if numeric overflow occurs" + {:arglists (quote (["java.time.temporal.TemporalField" + "java.time.temporal.TemporalAccessor"]))} + (^long [^js/JSJoda.TemporalField this ^js/JSJoda.TemporalAccessor temporal] + (.from this temporal))) + +(defn is-time-based + "Checks if this field represents a component of a time. + + A field is time-based if it can be derived from + {@link ChronoField#NANO_OF_DAY NANO_OF_DAY}. + Note that it is valid for both {@code isDateBased()} and {@code isTimeBased()} + to return false, such as when representing a field like minute-of-week. + + @return true if this field is a component of a time" + {:arglists (quote (["java.time.temporal.TemporalField"]))} + (^boolean [^js/JSJoda.TemporalField this] (.isTimeBased this))) diff --git a/src/cljc/java_time/temporal/temporal_queries.clj b/src/cljc/java_time/temporal/temporal_queries.clj index 870c758..dfc64ce 100644 --- a/src/cljc/java_time/temporal/temporal_queries.clj +++ b/src/cljc/java_time/temporal/temporal_queries.clj @@ -1,8 +1,201 @@ -(ns cljc.java-time.temporal.temporal-queries (:refer-clojure :exclude [abs get range format min max next name resolve short]) (:require [cljc.java-time.extn.calendar-awareness]) (:import [java.time.temporal TemporalQueries])) -(clojure.core/defn precision {:arglists (quote ([]))} (^java.time.temporal.TemporalQuery [] (java.time.temporal.TemporalQueries/precision))) -(clojure.core/defn chronology {:arglists (quote ([]))} (^java.time.temporal.TemporalQuery [] (java.time.temporal.TemporalQueries/chronology))) -(clojure.core/defn zone-id {:arglists (quote ([]))} (^java.time.temporal.TemporalQuery [] (java.time.temporal.TemporalQueries/zoneId))) -(clojure.core/defn zone {:arglists (quote ([]))} (^java.time.temporal.TemporalQuery [] (java.time.temporal.TemporalQueries/zone))) -(clojure.core/defn local-date {:arglists (quote ([]))} (^java.time.temporal.TemporalQuery [] (java.time.temporal.TemporalQueries/localDate))) -(clojure.core/defn local-time {:arglists (quote ([]))} (^java.time.temporal.TemporalQuery [] (java.time.temporal.TemporalQueries/localTime))) -(clojure.core/defn offset {:arglists (quote ([]))} (^java.time.temporal.TemporalQuery [] (java.time.temporal.TemporalQueries/offset))) +(ns cljc.java-time.temporal.temporal-queries + (:refer-clojure :exclude + [abs get range format min max next name resolve short]) + (:require [cljc.java-time.extn.calendar-awareness]) + (:import [java.time.temporal TemporalQueries])) + +(defn chronology + "A query for the {@code Chronology}. + + This queries a {@code TemporalAccessor} for the chronology. + If the target {@code TemporalAccessor} represents a date, or part of a date, + then it should return the chronology that the date is expressed in. + As a result of this definition, objects only representing time, such as + {@code LocalTime}, will return null. + + The result from JDK classes implementing {@code TemporalAccessor} is as follows:
+ {@code LocalDate} returns {@code IsoChronology.INSTANCE}
+ {@code LocalTime} returns null (does not represent a date)
+ {@code LocalDateTime} returns {@code IsoChronology.INSTANCE}
+ {@code ZonedDateTime} returns {@code IsoChronology.INSTANCE}
+ {@code OffsetTime} returns null (does not represent a date)
+ {@code OffsetDateTime} returns {@code IsoChronology.INSTANCE}
+ {@code ChronoLocalDate} returns the associated chronology
+ {@code ChronoLocalDateTime} returns the associated chronology
+ {@code ChronoZonedDateTime} returns the associated chronology
+ {@code Era} returns the associated chronology
+ {@code DayOfWeek} returns null (shared across chronologies)
+ {@code Month} returns {@code IsoChronology.INSTANCE}
+ {@code Year} returns {@code IsoChronology.INSTANCE}
+ {@code YearMonth} returns {@code IsoChronology.INSTANCE}
+ {@code MonthDay} returns null {@code IsoChronology.INSTANCE}
+ {@code ZoneOffset} returns null (does not represent a date)
+ {@code Instant} returns null (does not represent a date)
+ + The method {@link java.time.chrono.Chronology#from(TemporalAccessor)} can be used as a + {@code TemporalQuery} via a method reference, {@code Chronology::from}. + That method is equivalent to this query, except that it throws an + exception if a chronology cannot be obtained. + + @return a query that can obtain the chronology of a temporal, not null" + {:arglists (quote ([]))} + (^java.time.temporal.TemporalQuery [] + (java.time.temporal.TemporalQueries/chronology))) + +(defn local-date + "A query for {@code LocalDate} returning null if not found. + + This returns a {@code TemporalQuery} that can be used to query a temporal + object for the local date. The query will return null if the temporal + object cannot supply a local date. + + The query implementation examines the {@link ChronoField#EPOCH_DAY EPOCH_DAY} + field and uses it to create a {@code LocalDate}. + + The method {@link ZoneOffset#from(TemporalAccessor)} can be used as a + {@code TemporalQuery} via a method reference, {@code LocalDate::from}. + This query and {@code LocalDate::from} will return the same result if the + temporal object contains a date. If the temporal object does not contain + a date, then the method reference will throw an exception, whereas this + query will return null. + + @return a query that can obtain the date of a temporal, not null" + {:arglists (quote ([]))} + (^java.time.temporal.TemporalQuery [] + (java.time.temporal.TemporalQueries/localDate))) + +(defn local-time + "A query for {@code LocalTime} returning null if not found. + + This returns a {@code TemporalQuery} that can be used to query a temporal + object for the local time. The query will return null if the temporal + object cannot supply a local time. + + The query implementation examines the {@link ChronoField#NANO_OF_DAY NANO_OF_DAY} + field and uses it to create a {@code LocalTime}. + + The method {@link ZoneOffset#from(TemporalAccessor)} can be used as a + {@code TemporalQuery} via a method reference, {@code LocalTime::from}. + This query and {@code LocalTime::from} will return the same result if the + temporal object contains a time. If the temporal object does not contain + a time, then the method reference will throw an exception, whereas this + query will return null. + + @return a query that can obtain the time of a temporal, not null" + {:arglists (quote ([]))} + (^java.time.temporal.TemporalQuery [] + (java.time.temporal.TemporalQueries/localTime))) + +(defn offset + "A query for {@code ZoneOffset} returning null if not found. + + This returns a {@code TemporalQuery} that can be used to query a temporal + object for the offset. The query will return null if the temporal + object cannot supply an offset. + + The query implementation examines the {@link ChronoField#OFFSET_SECONDS OFFSET_SECONDS} + field and uses it to create a {@code ZoneOffset}. + + The method {@link java.time.ZoneOffset#from(TemporalAccessor)} can be used as a + {@code TemporalQuery} via a method reference, {@code ZoneOffset::from}. + This query and {@code ZoneOffset::from} will return the same result if the + temporal object contains an offset. If the temporal object does not contain + an offset, then the method reference will throw an exception, whereas this + query will return null. + + @return a query that can obtain the offset of a temporal, not null" + {:arglists (quote ([]))} + (^java.time.temporal.TemporalQuery [] + (java.time.temporal.TemporalQueries/offset))) + +(defn precision + "A query for the smallest supported unit. + + This queries a {@code TemporalAccessor} for the time precision. + If the target {@code TemporalAccessor} represents a consistent or complete date-time, + date or time then this must return the smallest precision actually supported. + Note that fields such as {@code NANO_OF_DAY} and {@code NANO_OF_SECOND} + are defined to always return ignoring the precision, thus this is the only + way to find the actual smallest supported unit. + For example, were {@code GregorianCalendar} to implement {@code TemporalAccessor} + it would return a precision of {@code MILLIS}. + + The result from JDK classes implementing {@code TemporalAccessor} is as follows:
+ {@code LocalDate} returns {@code DAYS}
+ {@code LocalTime} returns {@code NANOS}
+ {@code LocalDateTime} returns {@code NANOS}
+ {@code ZonedDateTime} returns {@code NANOS}
+ {@code OffsetTime} returns {@code NANOS}
+ {@code OffsetDateTime} returns {@code NANOS}
+ {@code ChronoLocalDate} returns {@code DAYS}
+ {@code ChronoLocalDateTime} returns {@code NANOS}
+ {@code ChronoZonedDateTime} returns {@code NANOS}
+ {@code Era} returns {@code ERAS}
+ {@code DayOfWeek} returns {@code DAYS}
+ {@code Month} returns {@code MONTHS}
+ {@code Year} returns {@code YEARS}
+ {@code YearMonth} returns {@code MONTHS}
+ {@code MonthDay} returns null (does not represent a complete date or time)
+ {@code ZoneOffset} returns null (does not represent a date or time)
+ {@code Instant} returns {@code NANOS}
+ + @return a query that can obtain the precision of a temporal, not null" + {:arglists (quote ([]))} + (^java.time.temporal.TemporalQuery [] + (java.time.temporal.TemporalQueries/precision))) + +(defn zone + "A lenient query for the {@code ZoneId}, falling back to the {@code ZoneOffset}. + + This queries a {@code TemporalAccessor} for the zone. + It first tries to obtain the zone, using {@link #zoneId()}. + If that is not found it tries to obtain the {@link #offset()}. + Thus a {@link java.time.ZonedDateTime} will return the result of {@code getZone()}, + while an {@link java.time.OffsetDateTime} will return the result of {@code getOffset()}. + + In most cases, applications should use this query rather than {@code #zoneId()}. + + The method {@link ZoneId#from(TemporalAccessor)} can be used as a + {@code TemporalQuery} via a method reference, {@code ZoneId::from}. + That method is equivalent to this query, except that it throws an + exception if a zone cannot be obtained. + + @return a query that can obtain the zone ID or offset of a temporal, not null" + {:arglists (quote ([]))} + (^java.time.temporal.TemporalQuery [] + (java.time.temporal.TemporalQueries/zone))) + +(defn zone-id + "A strict query for the {@code ZoneId}. + + This queries a {@code TemporalAccessor} for the zone. + The zone is only returned if the date-time conceptually contains a {@code ZoneId}. + It will not be returned if the date-time only conceptually has an {@code ZoneOffset}. + Thus a {@link java.time.ZonedDateTime} will return the result of {@code getZone()}, + but an {@link java.time.OffsetDateTime} will return null. + + In most cases, applications should use {@link #zone()} as this query is too strict. + + The result from JDK classes implementing {@code TemporalAccessor} is as follows:
+ {@code LocalDate} returns null
+ {@code LocalTime} returns null
+ {@code LocalDateTime} returns null
+ {@code ZonedDateTime} returns the associated zone
+ {@code OffsetTime} returns null
+ {@code OffsetDateTime} returns null
+ {@code ChronoLocalDate} returns null
+ {@code ChronoLocalDateTime} returns null
+ {@code ChronoZonedDateTime} returns the associated zone
+ {@code Era} returns null
+ {@code DayOfWeek} returns null
+ {@code Month} returns null
+ {@code Year} returns null
+ {@code YearMonth} returns null
+ {@code MonthDay} returns null
+ {@code ZoneOffset} returns null
+ {@code Instant} returns null
+ + @return a query that can obtain the zone ID of a temporal, not null" + {:arglists (quote ([]))} + (^java.time.temporal.TemporalQuery [] + (java.time.temporal.TemporalQueries/zoneId))) diff --git a/src/cljc/java_time/temporal/temporal_queries.cljs b/src/cljc/java_time/temporal/temporal_queries.cljs index 9426760..5697137 100644 --- a/src/cljc/java_time/temporal/temporal_queries.cljs +++ b/src/cljc/java_time/temporal/temporal_queries.cljs @@ -1,8 +1,202 @@ -(ns cljc.java-time.temporal.temporal-queries (:refer-clojure :exclude [abs get range format min max next name resolve short]) (:require [cljc.java-time.extn.calendar-awareness] [goog.object] [java.time.temporal :refer [TemporalQueries]])) -(clojure.core/defn precision {:arglists (quote ([]))} (^js/JSJoda.TemporalQuery [] (js-invoke java.time.temporal.TemporalQueries "precision"))) -(clojure.core/defn chronology {:arglists (quote ([]))} (^js/JSJoda.TemporalQuery [] (js-invoke java.time.temporal.TemporalQueries "chronology"))) -(clojure.core/defn zone-id {:arglists (quote ([]))} (^js/JSJoda.TemporalQuery [] (js-invoke java.time.temporal.TemporalQueries "zoneId"))) -(clojure.core/defn zone {:arglists (quote ([]))} (^js/JSJoda.TemporalQuery [] (js-invoke java.time.temporal.TemporalQueries "zone"))) -(clojure.core/defn local-date {:arglists (quote ([]))} (^js/JSJoda.TemporalQuery [] (js-invoke java.time.temporal.TemporalQueries "localDate"))) -(clojure.core/defn local-time {:arglists (quote ([]))} (^js/JSJoda.TemporalQuery [] (js-invoke java.time.temporal.TemporalQueries "localTime"))) -(clojure.core/defn offset {:arglists (quote ([]))} (^js/JSJoda.TemporalQuery [] (js-invoke java.time.temporal.TemporalQueries "offset"))) +(ns cljc.java-time.temporal.temporal-queries + (:refer-clojure :exclude + [abs get range format min max next name resolve short]) + (:require [cljc.java-time.extn.calendar-awareness] + [goog.object] + [java.time.temporal :refer [TemporalQueries]])) + +(defn chronology + "A query for the {@code Chronology}. + + This queries a {@code TemporalAccessor} for the chronology. + If the target {@code TemporalAccessor} represents a date, or part of a date, + then it should return the chronology that the date is expressed in. + As a result of this definition, objects only representing time, such as + {@code LocalTime}, will return null. + + The result from JDK classes implementing {@code TemporalAccessor} is as follows:
+ {@code LocalDate} returns {@code IsoChronology.INSTANCE}
+ {@code LocalTime} returns null (does not represent a date)
+ {@code LocalDateTime} returns {@code IsoChronology.INSTANCE}
+ {@code ZonedDateTime} returns {@code IsoChronology.INSTANCE}
+ {@code OffsetTime} returns null (does not represent a date)
+ {@code OffsetDateTime} returns {@code IsoChronology.INSTANCE}
+ {@code ChronoLocalDate} returns the associated chronology
+ {@code ChronoLocalDateTime} returns the associated chronology
+ {@code ChronoZonedDateTime} returns the associated chronology
+ {@code Era} returns the associated chronology
+ {@code DayOfWeek} returns null (shared across chronologies)
+ {@code Month} returns {@code IsoChronology.INSTANCE}
+ {@code Year} returns {@code IsoChronology.INSTANCE}
+ {@code YearMonth} returns {@code IsoChronology.INSTANCE}
+ {@code MonthDay} returns null {@code IsoChronology.INSTANCE}
+ {@code ZoneOffset} returns null (does not represent a date)
+ {@code Instant} returns null (does not represent a date)
+ + The method {@link java.time.chrono.Chronology#from(TemporalAccessor)} can be used as a + {@code TemporalQuery} via a method reference, {@code Chronology::from}. + That method is equivalent to this query, except that it throws an + exception if a chronology cannot be obtained. + + @return a query that can obtain the chronology of a temporal, not null" + {:arglists (quote ([]))} + (^js/JSJoda.TemporalQuery [] + (js-invoke java.time.temporal.TemporalQueries "chronology"))) + +(defn local-date + "A query for {@code LocalDate} returning null if not found. + + This returns a {@code TemporalQuery} that can be used to query a temporal + object for the local date. The query will return null if the temporal + object cannot supply a local date. + + The query implementation examines the {@link ChronoField#EPOCH_DAY EPOCH_DAY} + field and uses it to create a {@code LocalDate}. + + The method {@link ZoneOffset#from(TemporalAccessor)} can be used as a + {@code TemporalQuery} via a method reference, {@code LocalDate::from}. + This query and {@code LocalDate::from} will return the same result if the + temporal object contains a date. If the temporal object does not contain + a date, then the method reference will throw an exception, whereas this + query will return null. + + @return a query that can obtain the date of a temporal, not null" + {:arglists (quote ([]))} + (^js/JSJoda.TemporalQuery [] + (js-invoke java.time.temporal.TemporalQueries "localDate"))) + +(defn local-time + "A query for {@code LocalTime} returning null if not found. + + This returns a {@code TemporalQuery} that can be used to query a temporal + object for the local time. The query will return null if the temporal + object cannot supply a local time. + + The query implementation examines the {@link ChronoField#NANO_OF_DAY NANO_OF_DAY} + field and uses it to create a {@code LocalTime}. + + The method {@link ZoneOffset#from(TemporalAccessor)} can be used as a + {@code TemporalQuery} via a method reference, {@code LocalTime::from}. + This query and {@code LocalTime::from} will return the same result if the + temporal object contains a time. If the temporal object does not contain + a time, then the method reference will throw an exception, whereas this + query will return null. + + @return a query that can obtain the time of a temporal, not null" + {:arglists (quote ([]))} + (^js/JSJoda.TemporalQuery [] + (js-invoke java.time.temporal.TemporalQueries "localTime"))) + +(defn offset + "A query for {@code ZoneOffset} returning null if not found. + + This returns a {@code TemporalQuery} that can be used to query a temporal + object for the offset. The query will return null if the temporal + object cannot supply an offset. + + The query implementation examines the {@link ChronoField#OFFSET_SECONDS OFFSET_SECONDS} + field and uses it to create a {@code ZoneOffset}. + + The method {@link java.time.ZoneOffset#from(TemporalAccessor)} can be used as a + {@code TemporalQuery} via a method reference, {@code ZoneOffset::from}. + This query and {@code ZoneOffset::from} will return the same result if the + temporal object contains an offset. If the temporal object does not contain + an offset, then the method reference will throw an exception, whereas this + query will return null. + + @return a query that can obtain the offset of a temporal, not null" + {:arglists (quote ([]))} + (^js/JSJoda.TemporalQuery [] + (js-invoke java.time.temporal.TemporalQueries "offset"))) + +(defn precision + "A query for the smallest supported unit. + + This queries a {@code TemporalAccessor} for the time precision. + If the target {@code TemporalAccessor} represents a consistent or complete date-time, + date or time then this must return the smallest precision actually supported. + Note that fields such as {@code NANO_OF_DAY} and {@code NANO_OF_SECOND} + are defined to always return ignoring the precision, thus this is the only + way to find the actual smallest supported unit. + For example, were {@code GregorianCalendar} to implement {@code TemporalAccessor} + it would return a precision of {@code MILLIS}. + + The result from JDK classes implementing {@code TemporalAccessor} is as follows:
+ {@code LocalDate} returns {@code DAYS}
+ {@code LocalTime} returns {@code NANOS}
+ {@code LocalDateTime} returns {@code NANOS}
+ {@code ZonedDateTime} returns {@code NANOS}
+ {@code OffsetTime} returns {@code NANOS}
+ {@code OffsetDateTime} returns {@code NANOS}
+ {@code ChronoLocalDate} returns {@code DAYS}
+ {@code ChronoLocalDateTime} returns {@code NANOS}
+ {@code ChronoZonedDateTime} returns {@code NANOS}
+ {@code Era} returns {@code ERAS}
+ {@code DayOfWeek} returns {@code DAYS}
+ {@code Month} returns {@code MONTHS}
+ {@code Year} returns {@code YEARS}
+ {@code YearMonth} returns {@code MONTHS}
+ {@code MonthDay} returns null (does not represent a complete date or time)
+ {@code ZoneOffset} returns null (does not represent a date or time)
+ {@code Instant} returns {@code NANOS}
+ + @return a query that can obtain the precision of a temporal, not null" + {:arglists (quote ([]))} + (^js/JSJoda.TemporalQuery [] + (js-invoke java.time.temporal.TemporalQueries "precision"))) + +(defn zone + "A lenient query for the {@code ZoneId}, falling back to the {@code ZoneOffset}. + + This queries a {@code TemporalAccessor} for the zone. + It first tries to obtain the zone, using {@link #zoneId()}. + If that is not found it tries to obtain the {@link #offset()}. + Thus a {@link java.time.ZonedDateTime} will return the result of {@code getZone()}, + while an {@link java.time.OffsetDateTime} will return the result of {@code getOffset()}. + + In most cases, applications should use this query rather than {@code #zoneId()}. + + The method {@link ZoneId#from(TemporalAccessor)} can be used as a + {@code TemporalQuery} via a method reference, {@code ZoneId::from}. + That method is equivalent to this query, except that it throws an + exception if a zone cannot be obtained. + + @return a query that can obtain the zone ID or offset of a temporal, not null" + {:arglists (quote ([]))} + (^js/JSJoda.TemporalQuery [] + (js-invoke java.time.temporal.TemporalQueries "zone"))) + +(defn zone-id + "A strict query for the {@code ZoneId}. + + This queries a {@code TemporalAccessor} for the zone. + The zone is only returned if the date-time conceptually contains a {@code ZoneId}. + It will not be returned if the date-time only conceptually has an {@code ZoneOffset}. + Thus a {@link java.time.ZonedDateTime} will return the result of {@code getZone()}, + but an {@link java.time.OffsetDateTime} will return null. + + In most cases, applications should use {@link #zone()} as this query is too strict. + + The result from JDK classes implementing {@code TemporalAccessor} is as follows:
+ {@code LocalDate} returns null
+ {@code LocalTime} returns null
+ {@code LocalDateTime} returns null
+ {@code ZonedDateTime} returns the associated zone
+ {@code OffsetTime} returns null
+ {@code OffsetDateTime} returns null
+ {@code ChronoLocalDate} returns null
+ {@code ChronoLocalDateTime} returns null
+ {@code ChronoZonedDateTime} returns the associated zone
+ {@code Era} returns null
+ {@code DayOfWeek} returns null
+ {@code Month} returns null
+ {@code Year} returns null
+ {@code YearMonth} returns null
+ {@code MonthDay} returns null
+ {@code ZoneOffset} returns null
+ {@code Instant} returns null
+ + @return a query that can obtain the zone ID of a temporal, not null" + {:arglists (quote ([]))} + (^js/JSJoda.TemporalQuery [] + (js-invoke java.time.temporal.TemporalQueries "zoneId"))) diff --git a/src/cljc/java_time/temporal/temporal_query.clj b/src/cljc/java_time/temporal/temporal_query.clj index 54bec24..d13b545 100644 --- a/src/cljc/java_time/temporal/temporal_query.clj +++ b/src/cljc/java_time/temporal/temporal_query.clj @@ -1,2 +1,49 @@ -(ns cljc.java-time.temporal.temporal-query (:refer-clojure :exclude [abs get range format min max next name resolve short]) (:require [cljc.java-time.extn.calendar-awareness]) (:import [java.time.temporal TemporalQuery])) -(clojure.core/defn query-from {:arglists (quote (["java.time.temporal.TemporalQuery" "java.time.temporal.TemporalAccessor"]))} (^java.lang.Object [^java.time.temporal.TemporalQuery this15744 ^java.time.temporal.TemporalAccessor java-time-temporal-TemporalAccessor15745] (.queryFrom this15744 java-time-temporal-TemporalAccessor15745))) +(ns cljc.java-time.temporal.temporal-query + (:refer-clojure :exclude + [abs get range format min max next name resolve short]) + (:require [cljc.java-time.extn.calendar-awareness]) + (:import [java.time.temporal TemporalQuery])) + +(defn query-from + "Queries the specified temporal object. + + This queries the specified temporal object to return an object using the logic + encapsulated in the implementing class. + Examples might be a query that checks if the date is the day before February 29th + in a leap year, or calculates the number of days to your next birthday. + + There are two equivalent ways of using this method. + The first is to invoke this method directly. + The second is to use {@link TemporalAccessor#query(TemporalQuery)}: +
+   // these two lines are equivalent, but the second approach is recommended
+   temporal = thisQuery.queryFrom(temporal);
+   temporal = temporal.query(thisQuery);
+ 
+ It is recommended to use the second approach, {@code query(TemporalQuery)}, + as it is a lot clearer to read in code. + + @implSpec + The implementation must take the input object and query it. + The implementation defines the logic of the query and is responsible for + documenting that logic. + It may use any method on {@code TemporalAccessor} to determine the result. + The input object must not be altered. + + The input temporal object may be in a calendar system other than ISO. + Implementations may choose to document compatibility with other calendar systems, + or reject non-ISO temporal objects by {@link TemporalQueries#chronology() querying the chronology}. + + This method may be called from multiple threads in parallel. + It must be thread-safe when invoked. + + @param temporal the temporal object to query, not null + @return the queried value, may return null to indicate not found + @throws DateTimeException if unable to query + @throws ArithmeticException if numeric overflow occurs" + {:arglists (quote (["java.time.temporal.TemporalQuery" + "java.time.temporal.TemporalAccessor"]))} + (^java.lang.Object + [^java.time.temporal.TemporalQuery this + ^java.time.temporal.TemporalAccessor temporal] + (.queryFrom this temporal))) diff --git a/src/cljc/java_time/temporal/temporal_query.cljs b/src/cljc/java_time/temporal/temporal_query.cljs index f51745b..3e1ca12 100644 --- a/src/cljc/java_time/temporal/temporal_query.cljs +++ b/src/cljc/java_time/temporal/temporal_query.cljs @@ -1,2 +1,49 @@ -(ns cljc.java-time.temporal.temporal-query (:refer-clojure :exclude [abs get range format min max next name resolve short]) (:require [cljc.java-time.extn.calendar-awareness] [goog.object] [java.time.temporal :refer [TemporalQuery]])) -(clojure.core/defn query-from {:arglists (quote (["java.time.temporal.TemporalQuery" "java.time.temporal.TemporalAccessor"]))} (^java.lang.Object [^js/JSJoda.TemporalQuery this15746 ^js/JSJoda.TemporalAccessor java-time-temporal-TemporalAccessor15747] (.queryFrom this15746 java-time-temporal-TemporalAccessor15747))) +(ns cljc.java-time.temporal.temporal-query + (:refer-clojure :exclude + [abs get range format min max next name resolve short]) + (:require [cljc.java-time.extn.calendar-awareness] + [goog.object] + [java.time.temporal :refer [TemporalQuery]])) + +(defn query-from + "Queries the specified temporal object. + + This queries the specified temporal object to return an object using the logic + encapsulated in the implementing class. + Examples might be a query that checks if the date is the day before February 29th + in a leap year, or calculates the number of days to your next birthday. + + There are two equivalent ways of using this method. + The first is to invoke this method directly. + The second is to use {@link TemporalAccessor#query(TemporalQuery)}: +
+   // these two lines are equivalent, but the second approach is recommended
+   temporal = thisQuery.queryFrom(temporal);
+   temporal = temporal.query(thisQuery);
+ 
+ It is recommended to use the second approach, {@code query(TemporalQuery)}, + as it is a lot clearer to read in code. + + @implSpec + The implementation must take the input object and query it. + The implementation defines the logic of the query and is responsible for + documenting that logic. + It may use any method on {@code TemporalAccessor} to determine the result. + The input object must not be altered. + + The input temporal object may be in a calendar system other than ISO. + Implementations may choose to document compatibility with other calendar systems, + or reject non-ISO temporal objects by {@link TemporalQueries#chronology() querying the chronology}. + + This method may be called from multiple threads in parallel. + It must be thread-safe when invoked. + + @param temporal the temporal object to query, not null + @return the queried value, may return null to indicate not found + @throws DateTimeException if unable to query + @throws ArithmeticException if numeric overflow occurs" + {:arglists (quote (["java.time.temporal.TemporalQuery" + "java.time.temporal.TemporalAccessor"]))} + (^java.lang.Object + [^js/JSJoda.TemporalQuery this ^js/JSJoda.TemporalAccessor temporal] + (.queryFrom this temporal))) diff --git a/src/cljc/java_time/temporal/temporal_unit.clj b/src/cljc/java_time/temporal/temporal_unit.clj index ffb5a42..a046502 100644 --- a/src/cljc/java_time/temporal/temporal_unit.clj +++ b/src/cljc/java_time/temporal/temporal_unit.clj @@ -1,9 +1,192 @@ -(ns cljc.java-time.temporal.temporal-unit (:refer-clojure :exclude [abs get range format min max next name resolve short]) (:require [cljc.java-time.extn.calendar-awareness]) (:import [java.time.temporal TemporalUnit])) -(clojure.core/defn is-date-based {:arglists (quote (["java.time.temporal.TemporalUnit"]))} (^java.lang.Boolean [^java.time.temporal.ChronoUnit this15748] (.isDateBased this15748))) -(clojure.core/defn is-supported-by {:arglists (quote (["java.time.temporal.TemporalUnit" "java.time.temporal.Temporal"]))} (^java.lang.Boolean [^java.time.temporal.ChronoUnit this15749 ^java.time.temporal.Temporal java-time-temporal-Temporal15750] (.isSupportedBy this15749 java-time-temporal-Temporal15750))) -(clojure.core/defn is-time-based {:arglists (quote (["java.time.temporal.TemporalUnit"]))} (^java.lang.Boolean [^java.time.temporal.ChronoUnit this15751] (.isTimeBased this15751))) -(clojure.core/defn get-duration {:arglists (quote (["java.time.temporal.TemporalUnit"]))} (^java.time.Duration [^java.time.temporal.ChronoUnit this15752] (.getDuration this15752))) -(clojure.core/defn add-to {:arglists (quote (["java.time.temporal.TemporalUnit" "java.time.temporal.Temporal" "long"]))} (^java.time.temporal.Temporal [^java.time.temporal.ChronoUnit this15753 ^java.time.temporal.Temporal java-time-temporal-Temporal15754 ^long long15755] (.addTo this15753 java-time-temporal-Temporal15754 long15755))) -(clojure.core/defn between {:arglists (quote (["java.time.temporal.TemporalUnit" "java.time.temporal.Temporal" "java.time.temporal.Temporal"]))} (^long [^java.time.temporal.ChronoUnit this15756 ^java.time.temporal.Temporal java-time-temporal-Temporal15757 ^java.time.temporal.Temporal java-time-temporal-Temporal15758] (.between this15756 java-time-temporal-Temporal15757 java-time-temporal-Temporal15758))) -(clojure.core/defn to-string {:arglists (quote (["java.time.temporal.TemporalUnit"]))} (^java.lang.String [^java.time.temporal.ChronoUnit this15759] (.toString this15759))) -(clojure.core/defn is-duration-estimated {:arglists (quote (["java.time.temporal.TemporalUnit"]))} (^java.lang.Boolean [^java.time.temporal.ChronoUnit this15760] (.isDurationEstimated this15760))) +(ns cljc.java-time.temporal.temporal-unit + (:refer-clojure :exclude + [abs get range format min max next name resolve short]) + (:require [cljc.java-time.extn.calendar-awareness]) + (:import [java.time.temporal TemporalUnit])) + +(defn add-to + "Returns a copy of the specified temporal object with the specified period added. + + The period added is a multiple of this unit. For example, this method + could be used to add \"3 days\" to a date by calling this method on the + instance representing \"days\", passing the date and the period \"3\". + The period to be added may be negative, which is equivalent to subtraction. + + There are two equivalent ways of using this method. + The first is to invoke this method directly. + The second is to use {@link Temporal#plus(long, TemporalUnit)}: +
+   // these two lines are equivalent, but the second approach is recommended
+   temporal = thisUnit.addTo(temporal);
+   temporal = temporal.plus(thisUnit);
+ 
+ It is recommended to use the second approach, {@code plus(TemporalUnit)}, + as it is a lot clearer to read in code. + + Implementations should perform any queries or calculations using the units + available in {@link ChronoUnit} or the fields available in {@link ChronoField}. + If the unit is not supported an {@code UnsupportedTemporalTypeException} must be thrown. + + Implementations must not alter the specified temporal object. + Instead, an adjusted copy of the original must be returned. + This provides equivalent, safe behavior for immutable and mutable implementations. + + @param the type of the Temporal object + @param temporal the temporal object to adjust, not null + @param amount the amount of this unit to add, positive or negative + @return the adjusted temporal object, not null + @throws DateTimeException if the amount cannot be added + @throws UnsupportedTemporalTypeException if the unit is not supported by the temporal" + {:arglists (quote (["java.time.temporal.TemporalUnit" + "java.time.temporal.Temporal" "long"]))} + (^java.time.temporal.Temporal + [^java.time.temporal.ChronoUnit this ^java.time.temporal.Temporal temporal + ^long amount] + (.addTo this temporal amount))) + +(defn between + "Calculates the amount of time between two temporal objects. + + This calculates the amount in terms of this unit. The start and end + points are supplied as temporal objects and must be of compatible types. + The implementation will convert the second type to be an instance of the + first type before the calculating the amount. + The result will be negative if the end is before the start. + For example, the amount in hours between two temporal objects can be + calculated using {@code HOURS.between(startTime, endTime)}. + + The calculation returns a whole number, representing the number of + complete units between the two temporals. + For example, the amount in hours between the times 11:30 and 13:29 + will only be one hour as it is one minute short of two hours. + + There are two equivalent ways of using this method. + The first is to invoke this method directly. + The second is to use {@link Temporal#until(Temporal, TemporalUnit)}: +
+   // these two lines are equivalent
+   between = thisUnit.between(start, end);
+   between = start.until(end, thisUnit);
+ 
+ The choice should be made based on which makes the code more readable. + + For example, this method allows the number of days between two dates to + be calculated: +
+  long daysBetween = DAYS.between(start, end);
+  // or alternatively
+  long daysBetween = start.until(end, DAYS);
+ 
+ + Implementations should perform any queries or calculations using the units + available in {@link ChronoUnit} or the fields available in {@link ChronoField}. + If the unit is not supported an {@code UnsupportedTemporalTypeException} must be thrown. + Implementations must not alter the specified temporal objects. + + @implSpec + Implementations must begin by checking to if the two temporals have the + same type using {@code getClass()}. If they do not, then the result must be + obtained by calling {@code temporal1Inclusive.until(temporal2Exclusive, this)}. + + @param temporal1Inclusive the base temporal object, not null + @param temporal2Exclusive the other temporal object, exclusive, not null + @return the amount of time between temporal1Inclusive and temporal2Exclusive + in terms of this unit; positive if temporal2Exclusive is later than + temporal1Inclusive, negative if earlier + @throws DateTimeException if the amount cannot be calculated, or the end + temporal cannot be converted to the same type as the start temporal + @throws UnsupportedTemporalTypeException if the unit is not supported by the temporal + @throws ArithmeticException if numeric overflow occurs" + {:arglists (quote (["java.time.temporal.TemporalUnit" + "java.time.temporal.Temporal" + "java.time.temporal.Temporal"]))} + (^long + [^java.time.temporal.ChronoUnit this + ^java.time.temporal.Temporal temporal1-inclusive + ^java.time.temporal.Temporal temporal2-exclusive] + (.between this temporal1-inclusive temporal2-exclusive))) + +(defn get-duration + "Gets the duration of this unit, which may be an estimate. + + All units return a duration measured in standard nanoseconds from this method. + The duration will be positive and non-zero. + For example, an hour has a duration of {@code 60 * 60 * 1,000,000,000ns}. + + Some units may return an accurate duration while others return an estimate. + For example, days have an estimated duration due to the possibility of + daylight saving time changes. + To determine if the duration is an estimate, use {@link #isDurationEstimated()}. + + @return the duration of this unit, which may be an estimate, not null" + {:arglists (quote (["java.time.temporal.TemporalUnit"]))} + (^java.time.Duration [^java.time.temporal.ChronoUnit this] + (.getDuration this))) + +(defn is-date-based + "Checks if this unit represents a component of a date. + + A date is time-based if it can be used to imply meaning from a date. + It must have a {@linkplain #getDuration() duration} that is an integral + multiple of the length of a standard day. + Note that it is valid for both {@code isDateBased()} and {@code isTimeBased()} + to return false, such as when representing a unit like 36 hours. + + @return true if this unit is a component of a date" + {:arglists (quote (["java.time.temporal.TemporalUnit"]))} + (^java.lang.Boolean [^java.time.temporal.ChronoUnit this] + (.isDateBased this))) + +(defn is-duration-estimated + "Checks if the duration of the unit is an estimate. + + All units have a duration, however the duration is not always accurate. + For example, days have an estimated duration due to the possibility of + daylight saving time changes. + This method returns true if the duration is an estimate and false if it is + accurate. Note that accurate/estimated ignores leap seconds. + + @return true if the duration is estimated, false if accurate" + {:arglists (quote (["java.time.temporal.TemporalUnit"]))} + (^java.lang.Boolean [^java.time.temporal.ChronoUnit this] + (.isDurationEstimated this))) + +(defn is-supported-by + "Checks if this unit is supported by the specified temporal object. + + This checks that the implementing date-time can add/subtract this unit. + This can be used to avoid throwing an exception. + + This default implementation derives the value using + {@link Temporal#plus(long, TemporalUnit)}. + + @param temporal the temporal object to check, not null + @return true if the unit is supported" + {:arglists (quote (["java.time.temporal.TemporalUnit" + "java.time.temporal.Temporal"]))} + (^java.lang.Boolean + [^java.time.temporal.ChronoUnit this ^java.time.temporal.Temporal temporal] + (.isSupportedBy this temporal))) + +(defn is-time-based + "Checks if this unit represents a component of a time. + + A unit is time-based if it can be used to imply meaning from a time. + It must have a {@linkplain #getDuration() duration} that divides into + the length of a standard day without remainder. + Note that it is valid for both {@code isDateBased()} and {@code isTimeBased()} + to return false, such as when representing a unit like 36 hours. + + @return true if this unit is a component of a time" + {:arglists (quote (["java.time.temporal.TemporalUnit"]))} + (^java.lang.Boolean [^java.time.temporal.ChronoUnit this] + (.isTimeBased this))) + +(defn to-string + "Gets a descriptive name for the unit. + + This should be in the plural and upper-first camel case, such as 'Days' or 'Minutes'. + + @return the name of this unit, not null" + {:arglists (quote (["java.time.temporal.TemporalUnit"]))} + (^java.lang.String [^java.time.temporal.ChronoUnit this] (.toString this))) diff --git a/src/cljc/java_time/temporal/temporal_unit.cljs b/src/cljc/java_time/temporal/temporal_unit.cljs index d0427a3..f2c01d7 100644 --- a/src/cljc/java_time/temporal/temporal_unit.cljs +++ b/src/cljc/java_time/temporal/temporal_unit.cljs @@ -1,9 +1,186 @@ -(ns cljc.java-time.temporal.temporal-unit (:refer-clojure :exclude [abs get range format min max next name resolve short]) (:require [cljc.java-time.extn.calendar-awareness] [goog.object] [java.time.temporal :refer [TemporalUnit]])) -(clojure.core/defn is-date-based {:arglists (quote (["java.time.temporal.TemporalUnit"]))} (^boolean [^js/JSJoda.TemporalUnit this15761] (.isDateBased this15761))) -(clojure.core/defn is-supported-by {:arglists (quote (["java.time.temporal.TemporalUnit" "java.time.temporal.Temporal"]))} (^boolean [^js/JSJoda.TemporalUnit this15762 ^js/JSJoda.Temporal java-time-temporal-Temporal15763] (.isSupportedBy this15762 java-time-temporal-Temporal15763))) -(clojure.core/defn is-time-based {:arglists (quote (["java.time.temporal.TemporalUnit"]))} (^boolean [^js/JSJoda.TemporalUnit this15764] (.isTimeBased this15764))) -(clojure.core/defn get-duration {:arglists (quote (["java.time.temporal.TemporalUnit"]))} (^js/JSJoda.Duration [^js/JSJoda.TemporalUnit this15765] (.duration this15765))) -(clojure.core/defn add-to {:arglists (quote (["java.time.temporal.TemporalUnit" "java.time.temporal.Temporal" "long"]))} (^js/JSJoda.Temporal [^js/JSJoda.TemporalUnit this15766 ^js/JSJoda.Temporal java-time-temporal-Temporal15767 ^long long15768] (.addTo this15766 java-time-temporal-Temporal15767 long15768))) -(clojure.core/defn between {:arglists (quote (["java.time.temporal.TemporalUnit" "java.time.temporal.Temporal" "java.time.temporal.Temporal"]))} (^long [^js/JSJoda.TemporalUnit this15769 ^js/JSJoda.Temporal java-time-temporal-Temporal15770 ^js/JSJoda.Temporal java-time-temporal-Temporal15771] (.between this15769 java-time-temporal-Temporal15770 java-time-temporal-Temporal15771))) -(clojure.core/defn to-string {:arglists (quote (["java.time.temporal.TemporalUnit"]))} (^java.lang.String [^js/JSJoda.TemporalUnit this15772] (.toString this15772))) -(clojure.core/defn is-duration-estimated {:arglists (quote (["java.time.temporal.TemporalUnit"]))} (^boolean [^js/JSJoda.TemporalUnit this15773] (.isDurationEstimated this15773))) +(ns cljc.java-time.temporal.temporal-unit + (:refer-clojure :exclude + [abs get range format min max next name resolve short]) + (:require [cljc.java-time.extn.calendar-awareness] + [goog.object] + [java.time.temporal :refer [TemporalUnit]])) + +(defn add-to + "Returns a copy of the specified temporal object with the specified period added. + + The period added is a multiple of this unit. For example, this method + could be used to add \"3 days\" to a date by calling this method on the + instance representing \"days\", passing the date and the period \"3\". + The period to be added may be negative, which is equivalent to subtraction. + + There are two equivalent ways of using this method. + The first is to invoke this method directly. + The second is to use {@link Temporal#plus(long, TemporalUnit)}: +
+   // these two lines are equivalent, but the second approach is recommended
+   temporal = thisUnit.addTo(temporal);
+   temporal = temporal.plus(thisUnit);
+ 
+ It is recommended to use the second approach, {@code plus(TemporalUnit)}, + as it is a lot clearer to read in code. + + Implementations should perform any queries or calculations using the units + available in {@link ChronoUnit} or the fields available in {@link ChronoField}. + If the unit is not supported an {@code UnsupportedTemporalTypeException} must be thrown. + + Implementations must not alter the specified temporal object. + Instead, an adjusted copy of the original must be returned. + This provides equivalent, safe behavior for immutable and mutable implementations. + + @param the type of the Temporal object + @param temporal the temporal object to adjust, not null + @param amount the amount of this unit to add, positive or negative + @return the adjusted temporal object, not null + @throws DateTimeException if the amount cannot be added + @throws UnsupportedTemporalTypeException if the unit is not supported by the temporal" + {:arglists (quote (["java.time.temporal.TemporalUnit" + "java.time.temporal.Temporal" "long"]))} + (^js/JSJoda.Temporal + [^js/JSJoda.TemporalUnit this ^js/JSJoda.Temporal temporal ^long amount] + (.addTo this temporal amount))) + +(defn between + "Calculates the amount of time between two temporal objects. + + This calculates the amount in terms of this unit. The start and end + points are supplied as temporal objects and must be of compatible types. + The implementation will convert the second type to be an instance of the + first type before the calculating the amount. + The result will be negative if the end is before the start. + For example, the amount in hours between two temporal objects can be + calculated using {@code HOURS.between(startTime, endTime)}. + + The calculation returns a whole number, representing the number of + complete units between the two temporals. + For example, the amount in hours between the times 11:30 and 13:29 + will only be one hour as it is one minute short of two hours. + + There are two equivalent ways of using this method. + The first is to invoke this method directly. + The second is to use {@link Temporal#until(Temporal, TemporalUnit)}: +
+   // these two lines are equivalent
+   between = thisUnit.between(start, end);
+   between = start.until(end, thisUnit);
+ 
+ The choice should be made based on which makes the code more readable. + + For example, this method allows the number of days between two dates to + be calculated: +
+  long daysBetween = DAYS.between(start, end);
+  // or alternatively
+  long daysBetween = start.until(end, DAYS);
+ 
+ + Implementations should perform any queries or calculations using the units + available in {@link ChronoUnit} or the fields available in {@link ChronoField}. + If the unit is not supported an {@code UnsupportedTemporalTypeException} must be thrown. + Implementations must not alter the specified temporal objects. + + @implSpec + Implementations must begin by checking to if the two temporals have the + same type using {@code getClass()}. If they do not, then the result must be + obtained by calling {@code temporal1Inclusive.until(temporal2Exclusive, this)}. + + @param temporal1Inclusive the base temporal object, not null + @param temporal2Exclusive the other temporal object, exclusive, not null + @return the amount of time between temporal1Inclusive and temporal2Exclusive + in terms of this unit; positive if temporal2Exclusive is later than + temporal1Inclusive, negative if earlier + @throws DateTimeException if the amount cannot be calculated, or the end + temporal cannot be converted to the same type as the start temporal + @throws UnsupportedTemporalTypeException if the unit is not supported by the temporal + @throws ArithmeticException if numeric overflow occurs" + {:arglists (quote (["java.time.temporal.TemporalUnit" + "java.time.temporal.Temporal" + "java.time.temporal.Temporal"]))} + (^long + [^js/JSJoda.TemporalUnit this ^js/JSJoda.Temporal temporal1-inclusive + ^js/JSJoda.Temporal temporal2-exclusive] + (.between this temporal1-inclusive temporal2-exclusive))) + +(defn get-duration + "Gets the duration of this unit, which may be an estimate. + + All units return a duration measured in standard nanoseconds from this method. + The duration will be positive and non-zero. + For example, an hour has a duration of {@code 60 * 60 * 1,000,000,000ns}. + + Some units may return an accurate duration while others return an estimate. + For example, days have an estimated duration due to the possibility of + daylight saving time changes. + To determine if the duration is an estimate, use {@link #isDurationEstimated()}. + + @return the duration of this unit, which may be an estimate, not null" + {:arglists (quote (["java.time.temporal.TemporalUnit"]))} + (^js/JSJoda.Duration [^js/JSJoda.TemporalUnit this] (.duration this))) + +(defn is-date-based + "Checks if this unit represents a component of a date. + + A date is time-based if it can be used to imply meaning from a date. + It must have a {@linkplain #getDuration() duration} that is an integral + multiple of the length of a standard day. + Note that it is valid for both {@code isDateBased()} and {@code isTimeBased()} + to return false, such as when representing a unit like 36 hours. + + @return true if this unit is a component of a date" + {:arglists (quote (["java.time.temporal.TemporalUnit"]))} + (^boolean [^js/JSJoda.TemporalUnit this] (.isDateBased this))) + +(defn is-duration-estimated + "Checks if the duration of the unit is an estimate. + + All units have a duration, however the duration is not always accurate. + For example, days have an estimated duration due to the possibility of + daylight saving time changes. + This method returns true if the duration is an estimate and false if it is + accurate. Note that accurate/estimated ignores leap seconds. + + @return true if the duration is estimated, false if accurate" + {:arglists (quote (["java.time.temporal.TemporalUnit"]))} + (^boolean [^js/JSJoda.TemporalUnit this] (.isDurationEstimated this))) + +(defn is-supported-by + "Checks if this unit is supported by the specified temporal object. + + This checks that the implementing date-time can add/subtract this unit. + This can be used to avoid throwing an exception. + + This default implementation derives the value using + {@link Temporal#plus(long, TemporalUnit)}. + + @param temporal the temporal object to check, not null + @return true if the unit is supported" + {:arglists (quote (["java.time.temporal.TemporalUnit" + "java.time.temporal.Temporal"]))} + (^boolean [^js/JSJoda.TemporalUnit this ^js/JSJoda.Temporal temporal] + (.isSupportedBy this temporal))) + +(defn is-time-based + "Checks if this unit represents a component of a time. + + A unit is time-based if it can be used to imply meaning from a time. + It must have a {@linkplain #getDuration() duration} that divides into + the length of a standard day without remainder. + Note that it is valid for both {@code isDateBased()} and {@code isTimeBased()} + to return false, such as when representing a unit like 36 hours. + + @return true if this unit is a component of a time" + {:arglists (quote (["java.time.temporal.TemporalUnit"]))} + (^boolean [^js/JSJoda.TemporalUnit this] (.isTimeBased this))) + +(defn to-string + "Gets a descriptive name for the unit. + + This should be in the plural and upper-first camel case, such as 'Days' or 'Minutes'. + + @return the name of this unit, not null" + {:arglists (quote (["java.time.temporal.TemporalUnit"]))} + (^java.lang.String [^js/JSJoda.TemporalUnit this] (.toString this))) diff --git a/src/cljc/java_time/temporal/value_range.clj b/src/cljc/java_time/temporal/value_range.clj index 922fcd2..113a918 100644 --- a/src/cljc/java_time/temporal/value_range.clj +++ b/src/cljc/java_time/temporal/value_range.clj @@ -1,15 +1,176 @@ -(ns cljc.java-time.temporal.value-range (:refer-clojure :exclude [abs get range format min max next name resolve short]) (:require [cljc.java-time.extn.calendar-awareness]) (:import [java.time.temporal ValueRange])) -(clojure.core/defn get-minimum {:arglists (quote (["java.time.temporal.ValueRange"]))} (^long [^java.time.temporal.ValueRange this15774] (.getMinimum this15774))) -(clojure.core/defn of {:arglists (quote (["long" "long" "long"] ["long" "long" "long" "long"] ["long" "long"]))} (^java.time.temporal.ValueRange [^long long15775 ^long long15776 ^long long15777] (java.time.temporal.ValueRange/of long15775 long15776 long15777)) (^java.time.temporal.ValueRange [^long long15778 ^long long15779 ^long long15780 ^long long15781] (java.time.temporal.ValueRange/of long15778 long15779 long15780 long15781)) (^java.time.temporal.ValueRange [^long long15782 ^long long15783] (java.time.temporal.ValueRange/of long15782 long15783))) -(clojure.core/defn is-valid-value {:arglists (quote (["java.time.temporal.ValueRange" "long"]))} (^java.lang.Boolean [^java.time.temporal.ValueRange this15784 ^long long15785] (.isValidValue this15784 long15785))) -(clojure.core/defn check-valid-int-value {:arglists (quote (["java.time.temporal.ValueRange" "long" "java.time.temporal.TemporalField"]))} (^java.lang.Integer [^java.time.temporal.ValueRange this15786 ^long long15787 ^java.time.temporal.TemporalField java-time-temporal-TemporalField15788] (.checkValidIntValue this15786 long15787 java-time-temporal-TemporalField15788))) -(clojure.core/defn to-string {:arglists (quote (["java.time.temporal.ValueRange"]))} (^java.lang.String [^java.time.temporal.ValueRange this15789] (.toString this15789))) -(clojure.core/defn is-int-value {:arglists (quote (["java.time.temporal.ValueRange"]))} (^java.lang.Boolean [^java.time.temporal.ValueRange this15790] (.isIntValue this15790))) -(clojure.core/defn get-smallest-maximum {:arglists (quote (["java.time.temporal.ValueRange"]))} (^long [^java.time.temporal.ValueRange this15791] (.getSmallestMaximum this15791))) -(clojure.core/defn is-valid-int-value {:arglists (quote (["java.time.temporal.ValueRange" "long"]))} (^java.lang.Boolean [^java.time.temporal.ValueRange this15792 ^long long15793] (.isValidIntValue this15792 long15793))) -(clojure.core/defn hash-code {:arglists (quote (["java.time.temporal.ValueRange"]))} (^java.lang.Integer [^java.time.temporal.ValueRange this15794] (.hashCode this15794))) -(clojure.core/defn is-fixed {:arglists (quote (["java.time.temporal.ValueRange"]))} (^java.lang.Boolean [^java.time.temporal.ValueRange this15795] (.isFixed this15795))) -(clojure.core/defn get-maximum {:arglists (quote (["java.time.temporal.ValueRange"]))} (^long [^java.time.temporal.ValueRange this15796] (.getMaximum this15796))) -(clojure.core/defn equals {:arglists (quote (["java.time.temporal.ValueRange" "java.lang.Object"]))} (^java.lang.Boolean [^java.time.temporal.ValueRange this15797 ^java.lang.Object java-lang-Object15798] (.equals this15797 java-lang-Object15798))) -(clojure.core/defn get-largest-minimum {:arglists (quote (["java.time.temporal.ValueRange"]))} (^long [^java.time.temporal.ValueRange this15799] (.getLargestMinimum this15799))) -(clojure.core/defn check-valid-value {:arglists (quote (["java.time.temporal.ValueRange" "long" "java.time.temporal.TemporalField"]))} (^long [^java.time.temporal.ValueRange this15800 ^long long15801 ^java.time.temporal.TemporalField java-time-temporal-TemporalField15802] (.checkValidValue this15800 long15801 java-time-temporal-TemporalField15802))) +(ns cljc.java-time.temporal.value-range + (:refer-clojure :exclude + [abs get range format min max next name resolve short]) + (:require [cljc.java-time.extn.calendar-awareness]) + (:import [java.time.temporal ValueRange])) + +(defn get-minimum + "Gets the minimum value that the field can take. + + For example, the ISO day-of-month always starts at 1. + The minimum is therefore 1. + + @return the minimum value for this field" + {:arglists (quote (["java.time.temporal.ValueRange"]))} + (^long [^java.time.temporal.ValueRange this] (.getMinimum this))) + +(defn of + {:arglists (quote (["long" "long"] + ["long" "long" "long"] + ["long" "long" "long" "long"]))} + (^java.time.temporal.ValueRange [^long min ^long max] + (java.time.temporal.ValueRange/of min max)) + (^java.time.temporal.ValueRange + [^long min ^long max-smallest ^long max-largest] + (java.time.temporal.ValueRange/of min max-smallest max-largest)) + (^java.time.temporal.ValueRange + [^long min-smallest ^long min-largest ^long max-smallest ^long max-largest] + (java.time.temporal.ValueRange/of min-smallest + min-largest + max-smallest + max-largest))) + +(defn is-valid-value + "Checks if the value is within the valid range. + + This checks that the value is within the stored range of values. + + @param value the value to check + @return true if the value is valid" + {:arglists (quote (["java.time.temporal.ValueRange" "long"]))} + (^java.lang.Boolean [^java.time.temporal.ValueRange this ^long value] + (.isValidValue this value))) + +(defn check-valid-int-value + "Checks that the specified value is valid and fits in an {@code int}. + + This validates that the value is within the valid range of values and that + all valid values are within the bounds of an {@code int}. + The field is only used to improve the error message. + + @param value the value to check + @param field the field being checked, may be null + @return the value that was passed in + @see #isValidIntValue(long)" + {:arglists (quote (["java.time.temporal.ValueRange" "long" + "java.time.temporal.TemporalField"]))} + (^java.lang.Integer + [^java.time.temporal.ValueRange this ^long value + ^java.time.temporal.TemporalField field] + (.checkValidIntValue this value field))) + +(defn to-string + "Outputs this range as a {@code String}. + + The format will be '{min}/{largestMin} - {smallestMax}/{max}', + where the largestMin or smallestMax sections may be omitted, together + with associated slash, if they are the same as the min or max. + + @return a string representation of this range, not null" + {:arglists (quote (["java.time.temporal.ValueRange"]))} + (^java.lang.String [^java.time.temporal.ValueRange this] (.toString this))) + +(defn is-int-value + "Checks if all values in the range fit in an {@code int}. + + This checks that all valid values are within the bounds of an {@code int}. + + For example, the ISO month-of-year has values from 1 to 12, which fits in an {@code int}. + By comparison, ISO nano-of-day runs from 1 to 86,400,000,000,000 which does not fit in an {@code int}. + + This implementation uses {@link #getMinimum()} and {@link #getMaximum()}. + + @return true if a valid value always fits in an {@code int}" + {:arglists (quote (["java.time.temporal.ValueRange"]))} + (^java.lang.Boolean [^java.time.temporal.ValueRange this] (.isIntValue this))) + +(defn get-smallest-maximum + "Gets the smallest possible maximum value that the field can take. + + For example, the ISO day-of-month runs to between 28 and 31 days. + The smallest maximum is therefore 28. + + @return the smallest possible maximum value for this field" + {:arglists (quote (["java.time.temporal.ValueRange"]))} + (^long [^java.time.temporal.ValueRange this] (.getSmallestMaximum this))) + +(defn is-valid-int-value + "Checks if the value is within the valid range and that all values + in the range fit in an {@code int}. + + This method combines {@link #isIntValue()} and {@link #isValidValue(long)}. + + @param value the value to check + @return true if the value is valid and fits in an {@code int}" + {:arglists (quote (["java.time.temporal.ValueRange" "long"]))} + (^java.lang.Boolean [^java.time.temporal.ValueRange this ^long value] + (.isValidIntValue this value))) + +(defn hash-code + "A hash code for this range. + + @return a suitable hash code" + {:arglists (quote (["java.time.temporal.ValueRange"]))} + (^java.lang.Integer [^java.time.temporal.ValueRange this] (.hashCode this))) + +(defn is-fixed + "Is the value range fixed and fully known. + + For example, the ISO day-of-month runs from 1 to between 28 and 31. + Since there is uncertainty about the maximum value, the range is not fixed. + However, for the month of January, the range is always 1 to 31, thus it is fixed. + + @return true if the set of values is fixed" + {:arglists (quote (["java.time.temporal.ValueRange"]))} + (^java.lang.Boolean [^java.time.temporal.ValueRange this] (.isFixed this))) + +(defn get-maximum + "Gets the maximum value that the field can take. + + For example, the ISO day-of-month runs to between 28 and 31 days. + The maximum is therefore 31. + + @return the maximum value for this field" + {:arglists (quote (["java.time.temporal.ValueRange"]))} + (^long [^java.time.temporal.ValueRange this] (.getMaximum this))) + +(defn equals + "Checks if this range is equal to another range. + + The comparison is based on the four values, minimum, largest minimum, + smallest maximum and maximum. + Only objects of type {@code ValueRange} are compared, other types return false. + + @param obj the object to check, null returns false + @return true if this is equal to the other range" + {:arglists (quote (["java.time.temporal.ValueRange" "java.lang.Object"]))} + (^java.lang.Boolean + [^java.time.temporal.ValueRange this ^java.lang.Object obj] + (.equals this obj))) + +(defn get-largest-minimum + "Gets the largest possible minimum value that the field can take. + + For example, the ISO day-of-month always starts at 1. + The largest minimum is therefore 1. + + @return the largest possible minimum value for this field" + {:arglists (quote (["java.time.temporal.ValueRange"]))} + (^long [^java.time.temporal.ValueRange this] (.getLargestMinimum this))) + +(defn check-valid-value + "Checks that the specified value is valid. + + This validates that the value is within the valid range of values. + The field is only used to improve the error message. + + @param value the value to check + @param field the field being checked, may be null + @return the value that was passed in + @see #isValidValue(long)" + {:arglists (quote (["java.time.temporal.ValueRange" "long" + "java.time.temporal.TemporalField"]))} + (^long + [^java.time.temporal.ValueRange this ^long value + ^java.time.temporal.TemporalField field] + (.checkValidValue this value field))) diff --git a/src/cljc/java_time/temporal/value_range.cljs b/src/cljc/java_time/temporal/value_range.cljs index fc1f859..20d1ce3 100644 --- a/src/cljc/java_time/temporal/value_range.cljs +++ b/src/cljc/java_time/temporal/value_range.cljs @@ -1,15 +1,173 @@ -(ns cljc.java-time.temporal.value-range (:refer-clojure :exclude [abs get range format min max next name resolve short]) (:require [cljc.java-time.extn.calendar-awareness] [goog.object] [java.time.temporal :refer [ValueRange]])) -(clojure.core/defn get-minimum {:arglists (quote (["java.time.temporal.ValueRange"]))} (^long [^js/JSJoda.ValueRange this15803] (.minimum this15803))) -(clojure.core/defn of {:arglists (quote (["long" "long" "long"] ["long" "long" "long" "long"] ["long" "long"]))} (^js/JSJoda.ValueRange [^long long15804 ^long long15805 ^long long15806] (js-invoke java.time.temporal.ValueRange "of" long15804 long15805 long15806)) (^js/JSJoda.ValueRange [^long long15807 ^long long15808 ^long long15809 ^long long15810] (js-invoke java.time.temporal.ValueRange "of" long15807 long15808 long15809 long15810)) (^js/JSJoda.ValueRange [^long long15811 ^long long15812] (js-invoke java.time.temporal.ValueRange "of" long15811 long15812))) -(clojure.core/defn is-valid-value {:arglists (quote (["java.time.temporal.ValueRange" "long"]))} (^boolean [^js/JSJoda.ValueRange this15813 ^long long15814] (.isValidValue this15813 long15814))) -(clojure.core/defn check-valid-int-value {:arglists (quote (["java.time.temporal.ValueRange" "long" "java.time.temporal.TemporalField"]))} (^int [^js/JSJoda.ValueRange this15815 ^long long15816 ^js/JSJoda.TemporalField java-time-temporal-TemporalField15817] (.checkValidIntValue this15815 long15816 java-time-temporal-TemporalField15817))) -(clojure.core/defn to-string {:arglists (quote (["java.time.temporal.ValueRange"]))} (^java.lang.String [^js/JSJoda.ValueRange this15818] (.toString this15818))) -(clojure.core/defn is-int-value {:arglists (quote (["java.time.temporal.ValueRange"]))} (^boolean [^js/JSJoda.ValueRange this15819] (.isIntValue this15819))) -(clojure.core/defn get-smallest-maximum {:arglists (quote (["java.time.temporal.ValueRange"]))} (^long [^js/JSJoda.ValueRange this15820] (.smallestMaximum this15820))) -(clojure.core/defn is-valid-int-value {:arglists (quote (["java.time.temporal.ValueRange" "long"]))} (^boolean [^js/JSJoda.ValueRange this15821 ^long long15822] (.isValidIntValue this15821 long15822))) -(clojure.core/defn hash-code {:arglists (quote (["java.time.temporal.ValueRange"]))} (^int [^js/JSJoda.ValueRange this15823] (.hashCode this15823))) -(clojure.core/defn is-fixed {:arglists (quote (["java.time.temporal.ValueRange"]))} (^boolean [^js/JSJoda.ValueRange this15824] (.isFixed this15824))) -(clojure.core/defn get-maximum {:arglists (quote (["java.time.temporal.ValueRange"]))} (^long [^js/JSJoda.ValueRange this15825] (.maximum this15825))) -(clojure.core/defn equals {:arglists (quote (["java.time.temporal.ValueRange" "java.lang.Object"]))} (^boolean [^js/JSJoda.ValueRange this15826 ^java.lang.Object java-lang-Object15827] (.equals this15826 java-lang-Object15827))) -(clojure.core/defn get-largest-minimum {:arglists (quote (["java.time.temporal.ValueRange"]))} (^long [^js/JSJoda.ValueRange this15828] (.largestMinimum this15828))) -(clojure.core/defn check-valid-value {:arglists (quote (["java.time.temporal.ValueRange" "long" "java.time.temporal.TemporalField"]))} (^long [^js/JSJoda.ValueRange this15829 ^long long15830 ^js/JSJoda.TemporalField java-time-temporal-TemporalField15831] (.checkValidValue this15829 long15830 java-time-temporal-TemporalField15831))) +(ns cljc.java-time.temporal.value-range + (:refer-clojure :exclude + [abs get range format min max next name resolve short]) + (:require [cljc.java-time.extn.calendar-awareness] + [goog.object] + [java.time.temporal :refer [ValueRange]])) + +(defn get-minimum + "Gets the minimum value that the field can take. + + For example, the ISO day-of-month always starts at 1. + The minimum is therefore 1. + + @return the minimum value for this field" + {:arglists (quote (["java.time.temporal.ValueRange"]))} + (^long [^js/JSJoda.ValueRange this] (.minimum this))) + +(defn of + {:arglists (quote (["long" "long"] + ["long" "long" "long"] + ["long" "long" "long" "long"]))} + (^js/JSJoda.ValueRange [^long min ^long max] + (js-invoke java.time.temporal.ValueRange "of" min max)) + (^js/JSJoda.ValueRange [^long min ^long max-smallest ^long max-largest] + (js-invoke java.time.temporal.ValueRange "of" min max-smallest max-largest)) + (^js/JSJoda.ValueRange + [^long min-smallest ^long min-largest ^long max-smallest ^long max-largest] + (js-invoke java.time.temporal.ValueRange + "of" + min-smallest + min-largest + max-smallest + max-largest))) + +(defn is-valid-value + "Checks if the value is within the valid range. + + This checks that the value is within the stored range of values. + + @param value the value to check + @return true if the value is valid" + {:arglists (quote (["java.time.temporal.ValueRange" "long"]))} + (^boolean [^js/JSJoda.ValueRange this ^long value] + (.isValidValue this value))) + +(defn check-valid-int-value + "Checks that the specified value is valid and fits in an {@code int}. + + This validates that the value is within the valid range of values and that + all valid values are within the bounds of an {@code int}. + The field is only used to improve the error message. + + @param value the value to check + @param field the field being checked, may be null + @return the value that was passed in + @see #isValidIntValue(long)" + {:arglists (quote (["java.time.temporal.ValueRange" "long" + "java.time.temporal.TemporalField"]))} + (^int [^js/JSJoda.ValueRange this ^long value ^js/JSJoda.TemporalField field] + (.checkValidIntValue this value field))) + +(defn to-string + "Outputs this range as a {@code String}. + + The format will be '{min}/{largestMin} - {smallestMax}/{max}', + where the largestMin or smallestMax sections may be omitted, together + with associated slash, if they are the same as the min or max. + + @return a string representation of this range, not null" + {:arglists (quote (["java.time.temporal.ValueRange"]))} + (^java.lang.String [^js/JSJoda.ValueRange this] (.toString this))) + +(defn is-int-value + "Checks if all values in the range fit in an {@code int}. + + This checks that all valid values are within the bounds of an {@code int}. + + For example, the ISO month-of-year has values from 1 to 12, which fits in an {@code int}. + By comparison, ISO nano-of-day runs from 1 to 86,400,000,000,000 which does not fit in an {@code int}. + + This implementation uses {@link #getMinimum()} and {@link #getMaximum()}. + + @return true if a valid value always fits in an {@code int}" + {:arglists (quote (["java.time.temporal.ValueRange"]))} + (^boolean [^js/JSJoda.ValueRange this] (.isIntValue this))) + +(defn get-smallest-maximum + "Gets the smallest possible maximum value that the field can take. + + For example, the ISO day-of-month runs to between 28 and 31 days. + The smallest maximum is therefore 28. + + @return the smallest possible maximum value for this field" + {:arglists (quote (["java.time.temporal.ValueRange"]))} + (^long [^js/JSJoda.ValueRange this] (.smallestMaximum this))) + +(defn is-valid-int-value + "Checks if the value is within the valid range and that all values + in the range fit in an {@code int}. + + This method combines {@link #isIntValue()} and {@link #isValidValue(long)}. + + @param value the value to check + @return true if the value is valid and fits in an {@code int}" + {:arglists (quote (["java.time.temporal.ValueRange" "long"]))} + (^boolean [^js/JSJoda.ValueRange this ^long value] + (.isValidIntValue this value))) + +(defn hash-code + "A hash code for this range. + + @return a suitable hash code" + {:arglists (quote (["java.time.temporal.ValueRange"]))} + (^int [^js/JSJoda.ValueRange this] (.hashCode this))) + +(defn is-fixed + "Is the value range fixed and fully known. + + For example, the ISO day-of-month runs from 1 to between 28 and 31. + Since there is uncertainty about the maximum value, the range is not fixed. + However, for the month of January, the range is always 1 to 31, thus it is fixed. + + @return true if the set of values is fixed" + {:arglists (quote (["java.time.temporal.ValueRange"]))} + (^boolean [^js/JSJoda.ValueRange this] (.isFixed this))) + +(defn get-maximum + "Gets the maximum value that the field can take. + + For example, the ISO day-of-month runs to between 28 and 31 days. + The maximum is therefore 31. + + @return the maximum value for this field" + {:arglists (quote (["java.time.temporal.ValueRange"]))} + (^long [^js/JSJoda.ValueRange this] (.maximum this))) + +(defn equals + "Checks if this range is equal to another range. + + The comparison is based on the four values, minimum, largest minimum, + smallest maximum and maximum. + Only objects of type {@code ValueRange} are compared, other types return false. + + @param obj the object to check, null returns false + @return true if this is equal to the other range" + {:arglists (quote (["java.time.temporal.ValueRange" "java.lang.Object"]))} + (^boolean [^js/JSJoda.ValueRange this ^java.lang.Object obj] + (.equals this obj))) + +(defn get-largest-minimum + "Gets the largest possible minimum value that the field can take. + + For example, the ISO day-of-month always starts at 1. + The largest minimum is therefore 1. + + @return the largest possible minimum value for this field" + {:arglists (quote (["java.time.temporal.ValueRange"]))} + (^long [^js/JSJoda.ValueRange this] (.largestMinimum this))) + +(defn check-valid-value + "Checks that the specified value is valid. + + This validates that the value is within the valid range of values. + The field is only used to improve the error message. + + @param value the value to check + @param field the field being checked, may be null + @return the value that was passed in + @see #isValidValue(long)" + {:arglists (quote (["java.time.temporal.ValueRange" "long" + "java.time.temporal.TemporalField"]))} + (^long [^js/JSJoda.ValueRange this ^long value ^js/JSJoda.TemporalField field] + (.checkValidValue this value field))) diff --git a/src/cljc/java_time/temporal/week_fields.clj b/src/cljc/java_time/temporal/week_fields.clj index bca4866..2513f93 100644 --- a/src/cljc/java_time/temporal/week_fields.clj +++ b/src/cljc/java_time/temporal/week_fields.clj @@ -1,15 +1,302 @@ -(ns cljc.java-time.temporal.week-fields (:refer-clojure :exclude [abs get range format min max next name resolve short]) (:require [cljc.java-time.extn.calendar-awareness]) (:import [java.time.temporal WeekFields])) -(def sunday-start java.time.temporal.WeekFields/SUNDAY_START) -(def iso java.time.temporal.WeekFields/ISO) -(def week-based-years java.time.temporal.WeekFields/WEEK_BASED_YEARS) -(clojure.core/defn day-of-week {:arglists (quote (["java.time.temporal.WeekFields"]))} (^java.time.temporal.TemporalField [^java.time.temporal.WeekFields this15692] (.dayOfWeek this15692))) -(clojure.core/defn of {:arglists (quote (["java.util.Locale"] ["java.time.DayOfWeek" "int"]))} (^java.time.temporal.WeekFields [^java.util.Locale java-util-Locale15693] (java.time.temporal.WeekFields/of java-util-Locale15693)) (^java.time.temporal.WeekFields [^java.time.DayOfWeek java-time-DayOfWeek15694 ^java.lang.Integer int15695] (java.time.temporal.WeekFields/of java-time-DayOfWeek15694 int15695))) -(clojure.core/defn get-first-day-of-week {:arglists (quote (["java.time.temporal.WeekFields"]))} (^java.time.DayOfWeek [^java.time.temporal.WeekFields this15696] (.getFirstDayOfWeek this15696))) -(clojure.core/defn to-string {:arglists (quote (["java.time.temporal.WeekFields"]))} (^java.lang.String [^java.time.temporal.WeekFields this15697] (.toString this15697))) -(clojure.core/defn week-based-year {:arglists (quote (["java.time.temporal.WeekFields"]))} (^java.time.temporal.TemporalField [^java.time.temporal.WeekFields this15698] (.weekBasedYear this15698))) -(clojure.core/defn week-of-year {:arglists (quote (["java.time.temporal.WeekFields"]))} (^java.time.temporal.TemporalField [^java.time.temporal.WeekFields this15699] (.weekOfYear this15699))) -(clojure.core/defn week-of-week-based-year {:arglists (quote (["java.time.temporal.WeekFields"]))} (^java.time.temporal.TemporalField [^java.time.temporal.WeekFields this15700] (.weekOfWeekBasedYear this15700))) -(clojure.core/defn week-of-month {:arglists (quote (["java.time.temporal.WeekFields"]))} (^java.time.temporal.TemporalField [^java.time.temporal.WeekFields this15701] (.weekOfMonth this15701))) -(clojure.core/defn hash-code {:arglists (quote (["java.time.temporal.WeekFields"]))} (^java.lang.Integer [^java.time.temporal.WeekFields this15702] (.hashCode this15702))) -(clojure.core/defn get-minimal-days-in-first-week {:arglists (quote (["java.time.temporal.WeekFields"]))} (^java.lang.Integer [^java.time.temporal.WeekFields this15703] (.getMinimalDaysInFirstWeek this15703))) -(clojure.core/defn equals {:arglists (quote (["java.time.temporal.WeekFields" "java.lang.Object"]))} (^java.lang.Boolean [^java.time.temporal.WeekFields this15704 ^java.lang.Object java-lang-Object15705] (.equals this15704 java-lang-Object15705))) +(ns cljc.java-time.temporal.week-fields + (:refer-clojure :exclude + [abs get range format min max next name resolve short]) + (:require [cljc.java-time.extn.calendar-awareness]) + (:import [java.time.temporal WeekFields])) + +(def sunday-start + "The common definition of a week that starts on Sunday and the first week + has a minimum of 1 day. + + Defined as starting on Sunday and with a minimum of 1 day in the month. + This week definition is in use in the US and other European countries." + java.time.temporal.WeekFields/SUNDAY_START) + +(def iso + "The ISO-8601 definition, where a week starts on Monday and the first week + has a minimum of 4 days. + + The ISO-8601 standard defines a calendar system based on weeks. + It uses the week-based-year and week-of-week-based-year concepts to split + up the passage of days instead of the standard year/month/day. + + Note that the first week may start in the previous calendar year. + Note also that the first few days of a calendar year may be in the + week-based-year corresponding to the previous calendar year." + java.time.temporal.WeekFields/ISO) + +(def week-based-years + "The unit that represents week-based-years for the purpose of addition and subtraction. + + This allows a number of week-based-years to be added to, or subtracted from, a date. + The unit is equal to either 52 or 53 weeks. + The estimated duration of a week-based-year is the same as that of a standard ISO + year at {@code 365.2425 Days}. + + The rules for addition add the number of week-based-years to the existing value + for the week-based-year field retaining the week-of-week-based-year + and day-of-week, unless the week number it too large for the target year. + In that case, the week is set to the last week of the year + with the same day-of-week. + + This unit is an immutable and thread-safe singleton." + java.time.temporal.WeekFields/WEEK_BASED_YEARS) + +(defn day-of-week + "Returns a field to access the day of week based on this {@code WeekFields}. + + This is similar to {@link ChronoField#DAY_OF_WEEK} but uses values for + the day-of-week based on this {@code WeekFields}. + The days are numbered from 1 to 7 where the + {@link #getFirstDayOfWeek() first day-of-week} is assigned the value 1. + + For example, if the first day-of-week is Sunday, then that will have the + value 1, with other days ranging from Monday as 2 to Saturday as 7. + + In the resolving phase of parsing, a localized day-of-week will be converted + to a standardized {@code ChronoField} day-of-week. + The day-of-week must be in the valid range 1 to 7. + Other fields in this class build dates using the standardized day-of-week. + + @return a field providing access to the day-of-week with localized numbering, not null" + {:arglists (quote (["java.time.temporal.WeekFields"]))} + (^java.time.temporal.TemporalField [^java.time.temporal.WeekFields this] + (.dayOfWeek this))) + +(defn of + {:arglists (quote (["java.util.Locale"] ["java.time.DayOfWeek" "int"]))} + (^java.time.temporal.WeekFields [^java.util.Locale locale] + (java.time.temporal.WeekFields/of locale)) + (^java.time.temporal.WeekFields + [^java.time.DayOfWeek first-day-of-week + ^java.lang.Integer minimal-days-in-first-week] + (java.time.temporal.WeekFields/of first-day-of-week + minimal-days-in-first-week))) + +(defn get-first-day-of-week + "Gets the first day-of-week. + + The first day-of-week varies by culture. + For example, the US uses Sunday, while France and the ISO-8601 standard use Monday. + This method returns the first day using the standard {@code DayOfWeek} enum. + + @return the first day-of-week, not null" + {:arglists (quote (["java.time.temporal.WeekFields"]))} + (^java.time.DayOfWeek [^java.time.temporal.WeekFields this] + (.getFirstDayOfWeek this))) + +(defn to-string + {:arglists (quote (["java.time.temporal.WeekFields"]))} + (^java.lang.String [^java.time.temporal.WeekFields this] (.toString this))) + +(defn week-based-year + "Returns a field to access the year of a week-based-year based on this {@code WeekFields}. + + This represents the concept of the year where weeks start on a fixed day-of-week, + such as Monday and each week belongs to exactly one year. + This field is typically used with {@link WeekFields#dayOfWeek()} and + {@link WeekFields#weekOfWeekBasedYear()}. + + Week one(1) is the week starting on the {@link WeekFields#getFirstDayOfWeek} + where there are at least {@link WeekFields#getMinimalDaysInFirstWeek()} days in the year. + Thus, week one may start before the start of the year. + If the first week starts after the start of the year then the period before + is in the last week of the previous year. + + This field can be used with any calendar system. + + In the resolving phase of parsing, a date can be created from a week-based-year, + week-of-year and day-of-week. + + In {@linkplain ResolverStyle#STRICT strict mode}, all three fields are + validated against their range of valid values. The week-of-year field + is validated to ensure that the resulting week-based-year is the + week-based-year requested. + + In {@linkplain ResolverStyle#SMART smart mode}, all three fields are + validated against their range of valid values. The week-of-week-based-year field + is validated from 1 to 53, meaning that the resulting date can be in the + following week-based-year to that specified. + + In {@linkplain ResolverStyle#LENIENT lenient mode}, the year and day-of-week + are validated against the range of valid values. The resulting date is calculated + equivalent to the following three stage approach. + First, create a date on the first day of the first week in the requested week-based-year. + Then take the week-of-week-based-year, subtract one, and add the amount in weeks to the date. + Finally, adjust to the correct day-of-week within the localized week. + + @return a field providing access to the week-based-year, not null" + {:arglists (quote (["java.time.temporal.WeekFields"]))} + (^java.time.temporal.TemporalField [^java.time.temporal.WeekFields this] + (.weekBasedYear this))) + +(defn week-of-year + "Returns a field to access the week of year based on this {@code WeekFields}. + + This represents the concept of the count of weeks within the year where weeks + start on a fixed day-of-week, such as Monday. + This field is typically used with {@link WeekFields#dayOfWeek()}. + + Week one(1) is the week starting on the {@link WeekFields#getFirstDayOfWeek} + where there are at least {@link WeekFields#getMinimalDaysInFirstWeek()} days in the year. + Thus, week one may start up to {@code minDays} days before the start of the year. + If the first week starts after the start of the year then the period before is week zero (0). + + For example:
+ - if the 1st day of the year is a Monday, week one starts on the 1st and there is no week zero
+ - if the 2nd day of the year is a Monday, week one starts on the 2nd and the 1st is in week zero
+ - if the 4th day of the year is a Monday, week one starts on the 4th and the 1st to 3rd is in week zero
+ - if the 5th day of the year is a Monday, week two starts on the 5th and the 1st to 4th is in week one
+ + This field can be used with any calendar system. + + In the resolving phase of parsing, a date can be created from a year, + week-of-year and day-of-week. + + In {@linkplain ResolverStyle#STRICT strict mode}, all three fields are + validated against their range of valid values. The week-of-year field + is validated to ensure that the resulting year is the year requested. + + In {@linkplain ResolverStyle#SMART smart mode}, all three fields are + validated against their range of valid values. The week-of-year field + is validated from 0 to 54, meaning that the resulting date can be in a + different year to that specified. + + In {@linkplain ResolverStyle#LENIENT lenient mode}, the year and day-of-week + are validated against the range of valid values. The resulting date is calculated + equivalent to the following three stage approach. + First, create a date on the first day of the first week in the requested year. + Then take the week-of-year, subtract one, and add the amount in weeks to the date. + Finally, adjust to the correct day-of-week within the localized week. + + @return a field providing access to the week-of-year, not null" + {:arglists (quote (["java.time.temporal.WeekFields"]))} + (^java.time.temporal.TemporalField [^java.time.temporal.WeekFields this] + (.weekOfYear this))) + +(defn week-of-week-based-year + "Returns a field to access the week of a week-based-year based on this {@code WeekFields}. + + This represents the concept of the count of weeks within the year where weeks + start on a fixed day-of-week, such as Monday and each week belongs to exactly one year. + This field is typically used with {@link WeekFields#dayOfWeek()} and + {@link WeekFields#weekBasedYear()}. + + Week one(1) is the week starting on the {@link WeekFields#getFirstDayOfWeek} + where there are at least {@link WeekFields#getMinimalDaysInFirstWeek()} days in the year. + If the first week starts after the start of the year then the period before + is in the last week of the previous year. + + For example:
+ - if the 1st day of the year is a Monday, week one starts on the 1st
+ - if the 2nd day of the year is a Monday, week one starts on the 2nd and + the 1st is in the last week of the previous year
+ - if the 4th day of the year is a Monday, week one starts on the 4th and + the 1st to 3rd is in the last week of the previous year
+ - if the 5th day of the year is a Monday, week two starts on the 5th and + the 1st to 4th is in week one
+ + This field can be used with any calendar system. + + In the resolving phase of parsing, a date can be created from a week-based-year, + week-of-year and day-of-week. + + In {@linkplain ResolverStyle#STRICT strict mode}, all three fields are + validated against their range of valid values. The week-of-year field + is validated to ensure that the resulting week-based-year is the + week-based-year requested. + + In {@linkplain ResolverStyle#SMART smart mode}, all three fields are + validated against their range of valid values. The week-of-week-based-year field + is validated from 1 to 53, meaning that the resulting date can be in the + following week-based-year to that specified. + + In {@linkplain ResolverStyle#LENIENT lenient mode}, the year and day-of-week + are validated against the range of valid values. The resulting date is calculated + equivalent to the following three stage approach. + First, create a date on the first day of the first week in the requested week-based-year. + Then take the week-of-week-based-year, subtract one, and add the amount in weeks to the date. + Finally, adjust to the correct day-of-week within the localized week. + + @return a field providing access to the week-of-week-based-year, not null" + {:arglists (quote (["java.time.temporal.WeekFields"]))} + (^java.time.temporal.TemporalField [^java.time.temporal.WeekFields this] + (.weekOfWeekBasedYear this))) + +(defn week-of-month + "Returns a field to access the week of month based on this {@code WeekFields}. + + This represents the concept of the count of weeks within the month where weeks + start on a fixed day-of-week, such as Monday. + This field is typically used with {@link WeekFields#dayOfWeek()}. + + Week one (1) is the week starting on the {@link WeekFields#getFirstDayOfWeek} + where there are at least {@link WeekFields#getMinimalDaysInFirstWeek()} days in the month. + Thus, week one may start up to {@code minDays} days before the start of the month. + If the first week starts after the start of the month then the period before is week zero (0). + + For example:
+ - if the 1st day of the month is a Monday, week one starts on the 1st and there is no week zero
+ - if the 2nd day of the month is a Monday, week one starts on the 2nd and the 1st is in week zero
+ - if the 4th day of the month is a Monday, week one starts on the 4th and the 1st to 3rd is in week zero
+ - if the 5th day of the month is a Monday, week two starts on the 5th and the 1st to 4th is in week one
+ + This field can be used with any calendar system. + + In the resolving phase of parsing, a date can be created from a year, + week-of-month, month-of-year and day-of-week. + + In {@linkplain ResolverStyle#STRICT strict mode}, all four fields are + validated against their range of valid values. The week-of-month field + is validated to ensure that the resulting month is the month requested. + + In {@linkplain ResolverStyle#SMART smart mode}, all four fields are + validated against their range of valid values. The week-of-month field + is validated from 0 to 6, meaning that the resulting date can be in a + different month to that specified. + + In {@linkplain ResolverStyle#LENIENT lenient mode}, the year and day-of-week + are validated against the range of valid values. The resulting date is calculated + equivalent to the following four stage approach. + First, create a date on the first day of the first week of January in the requested year. + Then take the month-of-year, subtract one, and add the amount in months to the date. + Then take the week-of-month, subtract one, and add the amount in weeks to the date. + Finally, adjust to the correct day-of-week within the localized week. + + @return a field providing access to the week-of-month, not null" + {:arglists (quote (["java.time.temporal.WeekFields"]))} + (^java.time.temporal.TemporalField [^java.time.temporal.WeekFields this] + (.weekOfMonth this))) + +(defn hash-code + "A hash code for this {@code WeekFields}. + + @return a suitable hash code" + {:arglists (quote (["java.time.temporal.WeekFields"]))} + (^java.lang.Integer [^java.time.temporal.WeekFields this] (.hashCode this))) + +(defn get-minimal-days-in-first-week + "Gets the minimal number of days in the first week. + + The number of days considered to define the first week of a month or year + varies by culture. + For example, the ISO-8601 requires 4 days (more than half a week) to + be present before counting the first week. + + @return the minimal number of days in the first week of a month or year, from 1 to 7" + {:arglists (quote (["java.time.temporal.WeekFields"]))} + (^java.lang.Integer [^java.time.temporal.WeekFields this] + (.getMinimalDaysInFirstWeek this))) + +(defn equals + "Checks if this {@code WeekFields} is equal to the specified object. + + The comparison is based on the entire state of the rules, which is + the first day-of-week and minimal days. + + @param object the other rules to compare to, null returns false + @return true if this is equal to the specified rules" + {:arglists (quote (["java.time.temporal.WeekFields" "java.lang.Object"]))} + (^java.lang.Boolean + [^java.time.temporal.WeekFields this ^java.lang.Object object] + (.equals this object))) diff --git a/src/cljc/java_time/temporal/week_fields.cljs b/src/cljc/java_time/temporal/week_fields.cljs index d0b24fe..918674b 100644 --- a/src/cljc/java_time/temporal/week_fields.cljs +++ b/src/cljc/java_time/temporal/week_fields.cljs @@ -1,15 +1,297 @@ -(ns cljc.java-time.temporal.week-fields (:refer-clojure :exclude [abs get range format min max next name resolve short]) (:require [cljc.java-time.extn.calendar-awareness] [goog.object] [java.time.temporal :refer [WeekFields]])) -(def sunday-start (goog.object/get java.time.temporal.WeekFields "SUNDAY_START")) -(def iso (goog.object/get java.time.temporal.WeekFields "ISO")) -(def week-based-years (goog.object/get java.time.temporal.WeekFields "WEEK_BASED_YEARS")) -(clojure.core/defn day-of-week {:arglists (quote (["java.time.temporal.WeekFields"]))} (^js/JSJoda.TemporalField [^js/JSJoda.WeekFields this15706] (.dayOfWeek this15706))) -(clojure.core/defn of {:arglists (quote (["java.util.Locale"] ["java.time.DayOfWeek" "int"]))} (^js/JSJoda.WeekFields [^java.util.Locale java-util-Locale15707] (js-invoke java.time.temporal.WeekFields "of" java-util-Locale15707)) (^js/JSJoda.WeekFields [^js/JSJoda.DayOfWeek java-time-DayOfWeek15708 ^int int15709] (js-invoke java.time.temporal.WeekFields "of" java-time-DayOfWeek15708 int15709))) -(clojure.core/defn get-first-day-of-week {:arglists (quote (["java.time.temporal.WeekFields"]))} (^js/JSJoda.DayOfWeek [^js/JSJoda.WeekFields this15710] (.firstDayOfWeek this15710))) -(clojure.core/defn to-string {:arglists (quote (["java.time.temporal.WeekFields"]))} (^java.lang.String [^js/JSJoda.WeekFields this15711] (.toString this15711))) -(clojure.core/defn week-based-year {:arglists (quote (["java.time.temporal.WeekFields"]))} (^js/JSJoda.TemporalField [^js/JSJoda.WeekFields this15712] (.weekBasedYear this15712))) -(clojure.core/defn week-of-year {:arglists (quote (["java.time.temporal.WeekFields"]))} (^js/JSJoda.TemporalField [^js/JSJoda.WeekFields this15713] (.weekOfYear this15713))) -(clojure.core/defn week-of-week-based-year {:arglists (quote (["java.time.temporal.WeekFields"]))} (^js/JSJoda.TemporalField [^js/JSJoda.WeekFields this15714] (.weekOfWeekBasedYear this15714))) -(clojure.core/defn week-of-month {:arglists (quote (["java.time.temporal.WeekFields"]))} (^js/JSJoda.TemporalField [^js/JSJoda.WeekFields this15715] (.weekOfMonth this15715))) -(clojure.core/defn hash-code {:arglists (quote (["java.time.temporal.WeekFields"]))} (^int [^js/JSJoda.WeekFields this15716] (.hashCode this15716))) -(clojure.core/defn get-minimal-days-in-first-week {:arglists (quote (["java.time.temporal.WeekFields"]))} (^int [^js/JSJoda.WeekFields this15717] (.minimalDaysInFirstWeek this15717))) -(clojure.core/defn equals {:arglists (quote (["java.time.temporal.WeekFields" "java.lang.Object"]))} (^boolean [^js/JSJoda.WeekFields this15718 ^java.lang.Object java-lang-Object15719] (.equals this15718 java-lang-Object15719))) +(ns cljc.java-time.temporal.week-fields + (:refer-clojure :exclude + [abs get range format min max next name resolve short]) + (:require [cljc.java-time.extn.calendar-awareness] + [goog.object] + [java.time.temporal :refer [WeekFields]])) + +(def sunday-start + "The common definition of a week that starts on Sunday and the first week + has a minimum of 1 day. + + Defined as starting on Sunday and with a minimum of 1 day in the month. + This week definition is in use in the US and other European countries." + (goog.object/get java.time.temporal.WeekFields "SUNDAY_START")) + +(def iso + "The ISO-8601 definition, where a week starts on Monday and the first week + has a minimum of 4 days. + + The ISO-8601 standard defines a calendar system based on weeks. + It uses the week-based-year and week-of-week-based-year concepts to split + up the passage of days instead of the standard year/month/day. + + Note that the first week may start in the previous calendar year. + Note also that the first few days of a calendar year may be in the + week-based-year corresponding to the previous calendar year." + (goog.object/get java.time.temporal.WeekFields "ISO")) + +(def week-based-years + "The unit that represents week-based-years for the purpose of addition and subtraction. + + This allows a number of week-based-years to be added to, or subtracted from, a date. + The unit is equal to either 52 or 53 weeks. + The estimated duration of a week-based-year is the same as that of a standard ISO + year at {@code 365.2425 Days}. + + The rules for addition add the number of week-based-years to the existing value + for the week-based-year field retaining the week-of-week-based-year + and day-of-week, unless the week number it too large for the target year. + In that case, the week is set to the last week of the year + with the same day-of-week. + + This unit is an immutable and thread-safe singleton." + (goog.object/get java.time.temporal.WeekFields "WEEK_BASED_YEARS")) + +(defn day-of-week + "Returns a field to access the day of week based on this {@code WeekFields}. + + This is similar to {@link ChronoField#DAY_OF_WEEK} but uses values for + the day-of-week based on this {@code WeekFields}. + The days are numbered from 1 to 7 where the + {@link #getFirstDayOfWeek() first day-of-week} is assigned the value 1. + + For example, if the first day-of-week is Sunday, then that will have the + value 1, with other days ranging from Monday as 2 to Saturday as 7. + + In the resolving phase of parsing, a localized day-of-week will be converted + to a standardized {@code ChronoField} day-of-week. + The day-of-week must be in the valid range 1 to 7. + Other fields in this class build dates using the standardized day-of-week. + + @return a field providing access to the day-of-week with localized numbering, not null" + {:arglists (quote (["java.time.temporal.WeekFields"]))} + (^js/JSJoda.TemporalField [^js/JSJoda.WeekFields this] (.dayOfWeek this))) + +(defn of + {:arglists (quote (["java.util.Locale"] ["java.time.DayOfWeek" "int"]))} + (^js/JSJoda.WeekFields [^java.util.Locale locale] + (js-invoke java.time.temporal.WeekFields "of" locale)) + (^js/JSJoda.WeekFields + [^js/JSJoda.DayOfWeek first-day-of-week ^int minimal-days-in-first-week] + (js-invoke java.time.temporal.WeekFields + "of" + first-day-of-week + minimal-days-in-first-week))) + +(defn get-first-day-of-week + "Gets the first day-of-week. + + The first day-of-week varies by culture. + For example, the US uses Sunday, while France and the ISO-8601 standard use Monday. + This method returns the first day using the standard {@code DayOfWeek} enum. + + @return the first day-of-week, not null" + {:arglists (quote (["java.time.temporal.WeekFields"]))} + (^js/JSJoda.DayOfWeek [^js/JSJoda.WeekFields this] (.firstDayOfWeek this))) + +(defn to-string + {:arglists (quote (["java.time.temporal.WeekFields"]))} + (^java.lang.String [^js/JSJoda.WeekFields this] (.toString this))) + +(defn week-based-year + "Returns a field to access the year of a week-based-year based on this {@code WeekFields}. + + This represents the concept of the year where weeks start on a fixed day-of-week, + such as Monday and each week belongs to exactly one year. + This field is typically used with {@link WeekFields#dayOfWeek()} and + {@link WeekFields#weekOfWeekBasedYear()}. + + Week one(1) is the week starting on the {@link WeekFields#getFirstDayOfWeek} + where there are at least {@link WeekFields#getMinimalDaysInFirstWeek()} days in the year. + Thus, week one may start before the start of the year. + If the first week starts after the start of the year then the period before + is in the last week of the previous year. + + This field can be used with any calendar system. + + In the resolving phase of parsing, a date can be created from a week-based-year, + week-of-year and day-of-week. + + In {@linkplain ResolverStyle#STRICT strict mode}, all three fields are + validated against their range of valid values. The week-of-year field + is validated to ensure that the resulting week-based-year is the + week-based-year requested. + + In {@linkplain ResolverStyle#SMART smart mode}, all three fields are + validated against their range of valid values. The week-of-week-based-year field + is validated from 1 to 53, meaning that the resulting date can be in the + following week-based-year to that specified. + + In {@linkplain ResolverStyle#LENIENT lenient mode}, the year and day-of-week + are validated against the range of valid values. The resulting date is calculated + equivalent to the following three stage approach. + First, create a date on the first day of the first week in the requested week-based-year. + Then take the week-of-week-based-year, subtract one, and add the amount in weeks to the date. + Finally, adjust to the correct day-of-week within the localized week. + + @return a field providing access to the week-based-year, not null" + {:arglists (quote (["java.time.temporal.WeekFields"]))} + (^js/JSJoda.TemporalField [^js/JSJoda.WeekFields this] (.weekBasedYear this))) + +(defn week-of-year + "Returns a field to access the week of year based on this {@code WeekFields}. + + This represents the concept of the count of weeks within the year where weeks + start on a fixed day-of-week, such as Monday. + This field is typically used with {@link WeekFields#dayOfWeek()}. + + Week one(1) is the week starting on the {@link WeekFields#getFirstDayOfWeek} + where there are at least {@link WeekFields#getMinimalDaysInFirstWeek()} days in the year. + Thus, week one may start up to {@code minDays} days before the start of the year. + If the first week starts after the start of the year then the period before is week zero (0). + + For example:
+ - if the 1st day of the year is a Monday, week one starts on the 1st and there is no week zero
+ - if the 2nd day of the year is a Monday, week one starts on the 2nd and the 1st is in week zero
+ - if the 4th day of the year is a Monday, week one starts on the 4th and the 1st to 3rd is in week zero
+ - if the 5th day of the year is a Monday, week two starts on the 5th and the 1st to 4th is in week one
+ + This field can be used with any calendar system. + + In the resolving phase of parsing, a date can be created from a year, + week-of-year and day-of-week. + + In {@linkplain ResolverStyle#STRICT strict mode}, all three fields are + validated against their range of valid values. The week-of-year field + is validated to ensure that the resulting year is the year requested. + + In {@linkplain ResolverStyle#SMART smart mode}, all three fields are + validated against their range of valid values. The week-of-year field + is validated from 0 to 54, meaning that the resulting date can be in a + different year to that specified. + + In {@linkplain ResolverStyle#LENIENT lenient mode}, the year and day-of-week + are validated against the range of valid values. The resulting date is calculated + equivalent to the following three stage approach. + First, create a date on the first day of the first week in the requested year. + Then take the week-of-year, subtract one, and add the amount in weeks to the date. + Finally, adjust to the correct day-of-week within the localized week. + + @return a field providing access to the week-of-year, not null" + {:arglists (quote (["java.time.temporal.WeekFields"]))} + (^js/JSJoda.TemporalField [^js/JSJoda.WeekFields this] (.weekOfYear this))) + +(defn week-of-week-based-year + "Returns a field to access the week of a week-based-year based on this {@code WeekFields}. + + This represents the concept of the count of weeks within the year where weeks + start on a fixed day-of-week, such as Monday and each week belongs to exactly one year. + This field is typically used with {@link WeekFields#dayOfWeek()} and + {@link WeekFields#weekBasedYear()}. + + Week one(1) is the week starting on the {@link WeekFields#getFirstDayOfWeek} + where there are at least {@link WeekFields#getMinimalDaysInFirstWeek()} days in the year. + If the first week starts after the start of the year then the period before + is in the last week of the previous year. + + For example:
+ - if the 1st day of the year is a Monday, week one starts on the 1st
+ - if the 2nd day of the year is a Monday, week one starts on the 2nd and + the 1st is in the last week of the previous year
+ - if the 4th day of the year is a Monday, week one starts on the 4th and + the 1st to 3rd is in the last week of the previous year
+ - if the 5th day of the year is a Monday, week two starts on the 5th and + the 1st to 4th is in week one
+ + This field can be used with any calendar system. + + In the resolving phase of parsing, a date can be created from a week-based-year, + week-of-year and day-of-week. + + In {@linkplain ResolverStyle#STRICT strict mode}, all three fields are + validated against their range of valid values. The week-of-year field + is validated to ensure that the resulting week-based-year is the + week-based-year requested. + + In {@linkplain ResolverStyle#SMART smart mode}, all three fields are + validated against their range of valid values. The week-of-week-based-year field + is validated from 1 to 53, meaning that the resulting date can be in the + following week-based-year to that specified. + + In {@linkplain ResolverStyle#LENIENT lenient mode}, the year and day-of-week + are validated against the range of valid values. The resulting date is calculated + equivalent to the following three stage approach. + First, create a date on the first day of the first week in the requested week-based-year. + Then take the week-of-week-based-year, subtract one, and add the amount in weeks to the date. + Finally, adjust to the correct day-of-week within the localized week. + + @return a field providing access to the week-of-week-based-year, not null" + {:arglists (quote (["java.time.temporal.WeekFields"]))} + (^js/JSJoda.TemporalField [^js/JSJoda.WeekFields this] + (.weekOfWeekBasedYear this))) + +(defn week-of-month + "Returns a field to access the week of month based on this {@code WeekFields}. + + This represents the concept of the count of weeks within the month where weeks + start on a fixed day-of-week, such as Monday. + This field is typically used with {@link WeekFields#dayOfWeek()}. + + Week one (1) is the week starting on the {@link WeekFields#getFirstDayOfWeek} + where there are at least {@link WeekFields#getMinimalDaysInFirstWeek()} days in the month. + Thus, week one may start up to {@code minDays} days before the start of the month. + If the first week starts after the start of the month then the period before is week zero (0). + + For example:
+ - if the 1st day of the month is a Monday, week one starts on the 1st and there is no week zero
+ - if the 2nd day of the month is a Monday, week one starts on the 2nd and the 1st is in week zero
+ - if the 4th day of the month is a Monday, week one starts on the 4th and the 1st to 3rd is in week zero
+ - if the 5th day of the month is a Monday, week two starts on the 5th and the 1st to 4th is in week one
+ + This field can be used with any calendar system. + + In the resolving phase of parsing, a date can be created from a year, + week-of-month, month-of-year and day-of-week. + + In {@linkplain ResolverStyle#STRICT strict mode}, all four fields are + validated against their range of valid values. The week-of-month field + is validated to ensure that the resulting month is the month requested. + + In {@linkplain ResolverStyle#SMART smart mode}, all four fields are + validated against their range of valid values. The week-of-month field + is validated from 0 to 6, meaning that the resulting date can be in a + different month to that specified. + + In {@linkplain ResolverStyle#LENIENT lenient mode}, the year and day-of-week + are validated against the range of valid values. The resulting date is calculated + equivalent to the following four stage approach. + First, create a date on the first day of the first week of January in the requested year. + Then take the month-of-year, subtract one, and add the amount in months to the date. + Then take the week-of-month, subtract one, and add the amount in weeks to the date. + Finally, adjust to the correct day-of-week within the localized week. + + @return a field providing access to the week-of-month, not null" + {:arglists (quote (["java.time.temporal.WeekFields"]))} + (^js/JSJoda.TemporalField [^js/JSJoda.WeekFields this] (.weekOfMonth this))) + +(defn hash-code + "A hash code for this {@code WeekFields}. + + @return a suitable hash code" + {:arglists (quote (["java.time.temporal.WeekFields"]))} + (^int [^js/JSJoda.WeekFields this] (.hashCode this))) + +(defn get-minimal-days-in-first-week + "Gets the minimal number of days in the first week. + + The number of days considered to define the first week of a month or year + varies by culture. + For example, the ISO-8601 requires 4 days (more than half a week) to + be present before counting the first week. + + @return the minimal number of days in the first week of a month or year, from 1 to 7" + {:arglists (quote (["java.time.temporal.WeekFields"]))} + (^int [^js/JSJoda.WeekFields this] (.minimalDaysInFirstWeek this))) + +(defn equals + "Checks if this {@code WeekFields} is equal to the specified object. + + The comparison is based on the entire state of the rules, which is + the first day-of-week and minimal days. + + @param object the other rules to compare to, null returns false + @return true if this is equal to the specified rules" + {:arglists (quote (["java.time.temporal.WeekFields" "java.lang.Object"]))} + (^boolean [^js/JSJoda.WeekFields this ^java.lang.Object object] + (.equals this object))) diff --git a/src/cljc/java_time/year.clj b/src/cljc/java_time/year.clj index da9c07f..94c4c3c 100644 --- a/src/cljc/java_time/year.clj +++ b/src/cljc/java_time/year.clj @@ -1,33 +1,471 @@ -(ns cljc.java-time.year (:refer-clojure :exclude [abs get range format min max next name resolve short]) (:require [cljc.java-time.extn.calendar-awareness]) (:import [java.time Year])) -(def min-value java.time.Year/MIN_VALUE) -(def max-value java.time.Year/MAX_VALUE) -(clojure.core/defn range {:arglists (quote (["java.time.Year" "java.time.temporal.TemporalField"]))} (^java.time.temporal.ValueRange [^java.time.Year this15096 ^java.time.temporal.TemporalField java-time-temporal-TemporalField15097] (.range this15096 java-time-temporal-TemporalField15097))) -(clojure.core/defn of {:arglists (quote (["int"]))} (^java.time.Year [^java.lang.Integer int15098] (java.time.Year/of int15098))) -(clojure.core/defn at-day {:arglists (quote (["java.time.Year" "int"]))} (^java.time.LocalDate [^java.time.Year this15099 ^java.lang.Integer int15100] (.atDay this15099 int15100))) -(clojure.core/defn plus {:arglists (quote (["java.time.Year" "java.time.temporal.TemporalAmount"] ["java.time.Year" "long" "java.time.temporal.TemporalUnit"]))} (^java.time.Year [^java.time.Year this15101 ^java.time.temporal.TemporalAmount java-time-temporal-TemporalAmount15102] (.plus this15101 java-time-temporal-TemporalAmount15102)) (^java.time.Year [^java.time.Year this15103 ^long long15104 ^java.time.temporal.ChronoUnit java-time-temporal-TemporalUnit15105] (.plus this15103 long15104 java-time-temporal-TemporalUnit15105))) -(clojure.core/defn is-valid-month-day {:arglists (quote (["java.time.Year" "java.time.MonthDay"]))} (^java.lang.Boolean [^java.time.Year this15106 ^java.time.MonthDay java-time-MonthDay15107] (.isValidMonthDay this15106 java-time-MonthDay15107))) -(clojure.core/defn query {:arglists (quote (["java.time.Year" "java.time.temporal.TemporalQuery"]))} (^java.lang.Object [^java.time.Year this15108 ^java.time.temporal.TemporalQuery java-time-temporal-TemporalQuery15109] (.query this15108 java-time-temporal-TemporalQuery15109))) -^{:line 84, :column 16} (clojure.core/defn is-leap {:arglists ^{:line 84, :column 54} (quote ^{:line 84, :column 61} (["long"]))} ^{:line 85, :column 18} (^java.lang.Boolean [^long long57050] ^{:line 85, :column 56} (. java.time.Year isLeap long57050))) -(clojure.core/defn to-string {:arglists (quote (["java.time.Year"]))} (^java.lang.String [^java.time.Year this15110] (.toString this15110))) -(clojure.core/defn is-before {:arglists (quote (["java.time.Year" "java.time.Year"]))} (^java.lang.Boolean [^java.time.Year this15111 ^java.time.Year java-time-Year15112] (.isBefore this15111 java-time-Year15112))) -(clojure.core/defn minus {:arglists (quote (["java.time.Year" "java.time.temporal.TemporalAmount"] ["java.time.Year" "long" "java.time.temporal.TemporalUnit"]))} (^java.time.Year [^java.time.Year this15113 ^java.time.temporal.TemporalAmount java-time-temporal-TemporalAmount15114] (.minus this15113 java-time-temporal-TemporalAmount15114)) (^java.time.Year [^java.time.Year this15115 ^long long15116 ^java.time.temporal.ChronoUnit java-time-temporal-TemporalUnit15117] (.minus this15115 long15116 java-time-temporal-TemporalUnit15117))) -(clojure.core/defn at-month-day {:arglists (quote (["java.time.Year" "java.time.MonthDay"]))} (^java.time.LocalDate [^java.time.Year this15118 ^java.time.MonthDay java-time-MonthDay15119] (.atMonthDay this15118 java-time-MonthDay15119))) -(clojure.core/defn get-value {:arglists (quote (["java.time.Year"]))} (^java.lang.Integer [^java.time.Year this15120] (.getValue this15120))) -(clojure.core/defn get-long {:arglists (quote (["java.time.Year" "java.time.temporal.TemporalField"]))} (^long [^java.time.Year this15121 ^java.time.temporal.TemporalField java-time-temporal-TemporalField15122] (.getLong this15121 java-time-temporal-TemporalField15122))) -(clojure.core/defn at-month {:arglists (quote (["java.time.Year" "int"] ["java.time.Year" "java.time.Month"]))} (^java.time.YearMonth [this15123 G__15124] (clojure.core/cond (clojure.core/and (clojure.core/instance? java.lang.Number G__15124)) (clojure.core/let [G__15124 (clojure.core/int G__15124)] (.atMonth ^java.time.Year this15123 G__15124)) (clojure.core/and (clojure.core/instance? java.time.Month G__15124)) (clojure.core/let [G__15124 ^"java.time.Month" G__15124] (.atMonth ^java.time.Year this15123 G__15124)) :else (throw (java.lang.IllegalArgumentException. "no corresponding java.time method with these args"))))) -(clojure.core/defn until {:arglists (quote (["java.time.Year" "java.time.temporal.Temporal" "java.time.temporal.TemporalUnit"]))} (^long [^java.time.Year this15125 ^java.time.temporal.Temporal java-time-temporal-Temporal15126 ^java.time.temporal.ChronoUnit java-time-temporal-TemporalUnit15127] (.until this15125 java-time-temporal-Temporal15126 java-time-temporal-TemporalUnit15127))) -(clojure.core/defn length {:arglists (quote (["java.time.Year"]))} (^java.lang.Integer [^java.time.Year this15128] (.length this15128))) -(clojure.core/defn from {:arglists (quote (["java.time.temporal.TemporalAccessor"]))} (^java.time.Year [^java.time.temporal.TemporalAccessor java-time-temporal-TemporalAccessor15129] (java.time.Year/from java-time-temporal-TemporalAccessor15129))) -(clojure.core/defn is-after {:arglists (quote (["java.time.Year" "java.time.Year"]))} (^java.lang.Boolean [^java.time.Year this15130 ^java.time.Year java-time-Year15131] (.isAfter this15130 java-time-Year15131))) -(clojure.core/defn is-supported {:arglists (quote (["java.time.Year" "java.time.temporal.TemporalField"] ["java.time.Year" "java.time.temporal.TemporalUnit"]))} (^java.lang.Boolean [this15132 G__15133] (clojure.core/cond (clojure.core/and (clojure.core/instance? java.time.temporal.TemporalField G__15133)) (clojure.core/let [G__15133 ^"java.time.temporal.TemporalField" G__15133] (.isSupported ^java.time.Year this15132 G__15133)) (clojure.core/and (clojure.core/instance? java.time.temporal.ChronoUnit G__15133)) (clojure.core/let [G__15133 ^"java.time.temporal.ChronoUnit" G__15133] (.isSupported ^java.time.Year this15132 G__15133)) :else (throw (java.lang.IllegalArgumentException. "no corresponding java.time method with these args"))))) -(clojure.core/defn minus-years {:arglists (quote (["java.time.Year" "long"]))} (^java.time.Year [^java.time.Year this15134 ^long long15135] (.minusYears this15134 long15135))) -(clojure.core/defn parse {:arglists (quote (["java.lang.CharSequence" "java.time.format.DateTimeFormatter"] ["java.lang.CharSequence"]))} (^java.time.Year [^java.lang.CharSequence java-lang-CharSequence15136 ^java.time.format.DateTimeFormatter java-time-format-DateTimeFormatter15137] (java.time.Year/parse java-lang-CharSequence15136 java-time-format-DateTimeFormatter15137)) (^java.time.Year [^java.lang.CharSequence java-lang-CharSequence15138] (java.time.Year/parse java-lang-CharSequence15138))) -(clojure.core/defn hash-code {:arglists (quote (["java.time.Year"]))} (^java.lang.Integer [^java.time.Year this15139] (.hashCode this15139))) -(clojure.core/defn adjust-into {:arglists (quote (["java.time.Year" "java.time.temporal.Temporal"]))} (^java.time.temporal.Temporal [^java.time.Year this15140 ^java.time.temporal.Temporal java-time-temporal-Temporal15141] (.adjustInto this15140 java-time-temporal-Temporal15141))) -(clojure.core/defn with {:arglists (quote (["java.time.Year" "java.time.temporal.TemporalField" "long"] ["java.time.Year" "java.time.temporal.TemporalAdjuster"]))} (^java.time.Year [^java.time.Year this15142 ^java.time.temporal.TemporalField java-time-temporal-TemporalField15143 ^long long15144] (.with this15142 java-time-temporal-TemporalField15143 long15144)) (^java.time.Year [^java.time.Year this15145 ^java.time.temporal.TemporalAdjuster java-time-temporal-TemporalAdjuster15146] (.with this15145 java-time-temporal-TemporalAdjuster15146))) -(clojure.core/defn now {:arglists (quote ([] ["java.time.Clock"] ["java.time.ZoneId"]))} (^java.time.Year [] (java.time.Year/now)) (^java.time.Year [G__15148] (clojure.core/cond (clojure.core/and (clojure.core/instance? java.time.Clock G__15148)) (clojure.core/let [G__15148 ^"java.time.Clock" G__15148] (java.time.Year/now G__15148)) (clojure.core/and (clojure.core/instance? java.time.ZoneId G__15148)) (clojure.core/let [G__15148 ^"java.time.ZoneId" G__15148] (java.time.Year/now G__15148)) :else (throw (java.lang.IllegalArgumentException. "no corresponding java.time method with these args"))))) -(clojure.core/defn compare-to {:arglists (quote (["java.time.Year" "java.time.Year"]))} (^java.lang.Integer [^java.time.Year this15149 ^java.time.Year java-time-Year15150] (.compareTo this15149 java-time-Year15150))) -(clojure.core/defn get {:arglists (quote (["java.time.Year" "java.time.temporal.TemporalField"]))} (^java.lang.Integer [^java.time.Year this15151 ^java.time.temporal.TemporalField java-time-temporal-TemporalField15152] (.get this15151 java-time-temporal-TemporalField15152))) -(clojure.core/defn equals {:arglists (quote (["java.time.Year" "java.lang.Object"]))} (^java.lang.Boolean [^java.time.Year this15153 ^java.lang.Object java-lang-Object15154] (.equals this15153 java-lang-Object15154))) -(clojure.core/defn format {:arglists (quote (["java.time.Year" "java.time.format.DateTimeFormatter"]))} (^java.lang.String [^java.time.Year this15155 ^java.time.format.DateTimeFormatter java-time-format-DateTimeFormatter15156] (.format this15155 java-time-format-DateTimeFormatter15156))) -(clojure.core/defn plus-years {:arglists (quote (["java.time.Year" "long"]))} (^java.time.Year [^java.time.Year this15157 ^long long15158] (.plusYears this15157 long15158))) +(ns cljc.java-time.year + (:refer-clojure :exclude + [abs get range format min max next name resolve short]) + (:require [cljc.java-time.extn.calendar-awareness]) + (:import [java.time Year])) + +(def min-value + "The minimum supported year, '-999,999,999'." + java.time.Year/MIN_VALUE) + +(def max-value + "The maximum supported year, '+999,999,999'." + java.time.Year/MAX_VALUE) + +(defn range + "Gets the range of valid values for the specified field. + + The range object expresses the minimum and maximum valid values for a field. + This year is used to enhance the accuracy of the returned range. + If it is not possible to return the range, because the field is not supported + or for some other reason, an exception is thrown. + + If the field is a {@link ChronoField} then the query is implemented here. + The {@link #isSupported(TemporalField) supported fields} will return + appropriate range instances. + All other {@code ChronoField} instances will throw an {@code UnsupportedTemporalTypeException}. + + If the field is not a {@code ChronoField}, then the result of this method + is obtained by invoking {@code TemporalField.rangeRefinedBy(TemporalAccessor)} + passing {@code this} as the argument. + Whether the range can be obtained is determined by the field. + + @param field the field to query the range for, not null + @return the range of valid values for the field, not null + @throws DateTimeException if the range for the field cannot be obtained + @throws UnsupportedTemporalTypeException if the field is not supported" + {:arglists (quote (["java.time.Year" "java.time.temporal.TemporalField"]))} + (^java.time.temporal.ValueRange + [^java.time.Year this ^java.time.temporal.TemporalField field] + (.range this field))) + +(defn of + "Obtains an instance of {@code Year}. + + This method accepts a year value from the proleptic ISO calendar system. + + The year 2AD/CE is represented by 2.
+ The year 1AD/CE is represented by 1.
+ The year 1BC/BCE is represented by 0.
+ The year 2BC/BCE is represented by -1.
+ + @param isoYear the ISO proleptic year to represent, from {@code MIN_VALUE} to {@code MAX_VALUE} + @return the year, not null + @throws DateTimeException if the field is invalid" + {:arglists (quote (["int"]))} + (^java.time.Year [^java.lang.Integer iso-year] (java.time.Year/of iso-year))) + +(defn at-day + "Combines this year with a day-of-year to create a {@code LocalDate}. + + This returns a {@code LocalDate} formed from this year and the specified day-of-year. + + The day-of-year value 366 is only valid in a leap year. + + @param dayOfYear the day-of-year to use, from 1 to 365-366 + @return the local date formed from this year and the specified date of year, not null + @throws DateTimeException if the day of year is zero or less, 366 or greater or equal + to 366 and this is not a leap year" + {:arglists (quote (["java.time.Year" "int"]))} + (^java.time.LocalDate [^java.time.Year this ^java.lang.Integer day-of-year] + (.atDay this day-of-year))) + +(defn plus + {:arglists (quote (["java.time.Year" "java.time.temporal.TemporalAmount"] + ["java.time.Year" "long" + "java.time.temporal.TemporalUnit"]))} + (^java.time.Year + [^java.time.Year this ^java.time.temporal.TemporalAmount amount-to-add] + (.plus this amount-to-add)) + (^java.time.Year + [^java.time.Year this ^long amount-to-add + ^java.time.temporal.ChronoUnit unit] + (.plus this amount-to-add unit))) + +(defn is-valid-month-day + "Checks if the month-day is valid for this year. + + This method checks whether this year and the input month and day form + a valid date. + + @param monthDay the month-day to validate, null returns false + @return true if the month and day are valid for this year" + {:arglists (quote (["java.time.Year" "java.time.MonthDay"]))} + (^java.lang.Boolean [^java.time.Year this ^java.time.MonthDay month-day] + (.isValidMonthDay this month-day))) + +(defn query + "Queries this year using the specified query. + + This queries this year using the specified query strategy object. + The {@code TemporalQuery} object defines the logic to be used to + obtain the result. Read the documentation of the query to understand + what the result of this method will be. + + The result of this method is obtained by invoking the + {@link TemporalQuery#queryFrom(TemporalAccessor)} method on the + specified query passing {@code this} as the argument. + + @param the type of the result + @param query the query to invoke, not null + @return the query result, null may be returned (defined by the query) + @throws DateTimeException if unable to query (defined by the query) + @throws ArithmeticException if numeric overflow occurs (defined by the query)" + {:arglists (quote (["java.time.Year" "java.time.temporal.TemporalQuery"]))} + (^java.lang.Object + [^java.time.Year this ^java.time.temporal.TemporalQuery query] + (.query this query))) + +(defn is-leap + {:arglists (quote (["long"]))} + (^java.lang.Boolean [^long year] (. java.time.Year isLeap year))) + +(defn to-string + "Outputs this year as a {@code String}. + + @return a string representation of this year, not null" + {:arglists (quote (["java.time.Year"]))} + (^java.lang.String [^java.time.Year this] (.toString this))) + +(defn is-before + "Checks if this year is before the specified year. + + @param other the other year to compare to, not null + @return true if this point is before the specified year" + {:arglists (quote (["java.time.Year" "java.time.Year"]))} + (^java.lang.Boolean [^java.time.Year this ^java.time.Year other] + (.isBefore this other))) + +(defn minus + {:arglists (quote (["java.time.Year" "java.time.temporal.TemporalAmount"] + ["java.time.Year" "long" + "java.time.temporal.TemporalUnit"]))} + (^java.time.Year + [^java.time.Year this ^java.time.temporal.TemporalAmount amount-to-subtract] + (.minus this amount-to-subtract)) + (^java.time.Year + [^java.time.Year this ^long amount-to-subtract + ^java.time.temporal.ChronoUnit unit] + (.minus this amount-to-subtract unit))) + +(defn at-month-day + "Combines this year with a month-day to create a {@code LocalDate}. + + This returns a {@code LocalDate} formed from this year and the specified month-day. + + A month-day of February 29th will be adjusted to February 28th in the resulting + date if the year is not a leap year. + + @param monthDay the month-day to use, not null + @return the local date formed from this year and the specified month-day, not null" + {:arglists (quote (["java.time.Year" "java.time.MonthDay"]))} + (^java.time.LocalDate [^java.time.Year this ^java.time.MonthDay month-day] + (.atMonthDay this month-day))) + +(defn get-value + "Gets the year value. + + The year returned by this method is proleptic as per {@code get(YEAR)}. + + @return the year, {@code MIN_VALUE} to {@code MAX_VALUE}" + {:arglists (quote (["java.time.Year"]))} + (^java.lang.Integer [^java.time.Year this] (.getValue this))) + +(defn get-long + "Gets the value of the specified field from this year as a {@code long}. + + This queries this year for the value of the specified field. + If it is not possible to return the value, because the field is not supported + or for some other reason, an exception is thrown. + + If the field is a {@link ChronoField} then the query is implemented here. + The {@link #isSupported(TemporalField) supported fields} will return valid + values based on this year. + All other {@code ChronoField} instances will throw an {@code UnsupportedTemporalTypeException}. + + If the field is not a {@code ChronoField}, then the result of this method + is obtained by invoking {@code TemporalField.getFrom(TemporalAccessor)} + passing {@code this} as the argument. Whether the value can be obtained, + and what the value represents, is determined by the field. + + @param field the field to get, not null + @return the value for the field + @throws DateTimeException if a value for the field cannot be obtained + @throws UnsupportedTemporalTypeException if the field is not supported + @throws ArithmeticException if numeric overflow occurs" + {:arglists (quote (["java.time.Year" "java.time.temporal.TemporalField"]))} + (^long [^java.time.Year this ^java.time.temporal.TemporalField field] + (.getLong this field))) + +(defn at-month + {:arglists (quote (["java.time.Year" "int"] + ["java.time.Year" "java.time.Month"]))} + (^java.time.YearMonth [^java.time.Year this arg0] + (cond (instance? java.lang.Number arg0) (let [month (int arg0)] + (.atMonth this month)) + (instance? java.time.Month arg0) (let [^java.time.Month month arg0] + (.atMonth this month)) + :else (throw (java.lang.IllegalArgumentException. + "no corresponding java.time method with these args"))))) + +(defn until + "Calculates the amount of time until another year in terms of the specified unit. + + This calculates the amount of time between two {@code Year} + objects in terms of a single {@code TemporalUnit}. + The start and end points are {@code this} and the specified year. + The result will be negative if the end is before the start. + The {@code Temporal} passed to this method is converted to a + {@code Year} using {@link #from(TemporalAccessor)}. + For example, the amount in decades between two year can be calculated + using {@code startYear.until(endYear, DECADES)}. + + The calculation returns a whole number, representing the number of + complete units between the two years. + For example, the amount in decades between 2012 and 2031 + will only be one decade as it is one year short of two decades. + + There are two equivalent ways of using this method. + The first is to invoke this method. + The second is to use {@link TemporalUnit#between(Temporal, Temporal)}: +
+   // these two lines are equivalent
+   amount = start.until(end, YEARS);
+   amount = YEARS.between(start, end);
+ 
+ The choice should be made based on which makes the code more readable. + + The calculation is implemented in this method for {@link ChronoUnit}. + The units {@code YEARS}, {@code DECADES}, {@code CENTURIES}, + {@code MILLENNIA} and {@code ERAS} are supported. + Other {@code ChronoUnit} values will throw an exception. + + If the unit is not a {@code ChronoUnit}, then the result of this method + is obtained by invoking {@code TemporalUnit.between(Temporal, Temporal)} + passing {@code this} as the first argument and the converted input temporal + as the second argument. + + This instance is immutable and unaffected by this method call. + + @param endExclusive the end date, exclusive, which is converted to a {@code Year}, not null + @param unit the unit to measure the amount in, not null + @return the amount of time between this year and the end year + @throws DateTimeException if the amount cannot be calculated, or the end + temporal cannot be converted to a {@code Year} + @throws UnsupportedTemporalTypeException if the unit is not supported + @throws ArithmeticException if numeric overflow occurs" + {:arglists (quote (["java.time.Year" "java.time.temporal.Temporal" + "java.time.temporal.TemporalUnit"]))} + (^long + [^java.time.Year this ^java.time.temporal.Temporal end-exclusive + ^java.time.temporal.ChronoUnit unit] + (.until this end-exclusive unit))) + +(defn length + "Gets the length of this year in days. + + @return the length of this year in days, 365 or 366" + {:arglists (quote (["java.time.Year"]))} + (^java.lang.Integer [^java.time.Year this] (.length this))) + +(defn from + "Obtains an instance of {@code Year} from a temporal object. + + This obtains a year based on the specified temporal. + A {@code TemporalAccessor} represents an arbitrary set of date and time information, + which this factory converts to an instance of {@code Year}. + + The conversion extracts the {@link ChronoField#YEAR year} field. + The extraction is only permitted if the temporal object has an ISO + chronology, or can be converted to a {@code LocalDate}. + + This method matches the signature of the functional interface {@link TemporalQuery} + allowing it to be used as a query via method reference, {@code Year::from}. + + @param temporal the temporal object to convert, not null + @return the year, not null + @throws DateTimeException if unable to convert to a {@code Year}" + {:arglists (quote (["java.time.temporal.TemporalAccessor"]))} + (^java.time.Year [^java.time.temporal.TemporalAccessor temporal] + (java.time.Year/from temporal))) + +(defn is-after + "Checks if this year is after the specified year. + + @param other the other year to compare to, not null + @return true if this is after the specified year" + {:arglists (quote (["java.time.Year" "java.time.Year"]))} + (^java.lang.Boolean [^java.time.Year this ^java.time.Year other] + (.isAfter this other))) + +(defn is-supported + {:arglists (quote (["java.time.Year" "java.time.temporal.TemporalField"] + ["java.time.Year" "java.time.temporal.TemporalUnit"]))} + (^java.lang.Boolean [^java.time.Year this arg0] + (cond (instance? java.time.temporal.TemporalField arg0) + (let [^java.time.temporal.TemporalField field arg0] + (.isSupported this field)) + (instance? java.time.temporal.ChronoUnit arg0) + (let [^java.time.temporal.TemporalUnit unit arg0] + (.isSupported this unit)) + :else (throw (java.lang.IllegalArgumentException. + "no corresponding java.time method with these args"))))) + +(defn minus-years + "Returns a copy of this {@code Year} with the specified number of years subtracted. + + This instance is immutable and unaffected by this method call. + + @param yearsToSubtract the years to subtract, may be negative + @return a {@code Year} based on this year with the year subtracted, not null + @throws DateTimeException if the result exceeds the supported range" + {:arglists (quote (["java.time.Year" "long"]))} + (^java.time.Year [^java.time.Year this ^long years-to-subtract] + (.minusYears this years-to-subtract))) + +(defn parse + {:arglists (quote (["java.lang.CharSequence"] + ["java.lang.CharSequence" + "java.time.format.DateTimeFormatter"]))} + (^java.time.Year [^java.lang.CharSequence text] (java.time.Year/parse text)) + (^java.time.Year + [^java.lang.CharSequence text ^java.time.format.DateTimeFormatter formatter] + (java.time.Year/parse text formatter))) + +(defn hash-code + "A hash code for this year. + + @return a suitable hash code" + {:arglists (quote (["java.time.Year"]))} + (^java.lang.Integer [^java.time.Year this] (.hashCode this))) + +(defn adjust-into + "Adjusts the specified temporal object to have this year. + + This returns a temporal object of the same observable type as the input + with the year changed to be the same as this. + + The adjustment is equivalent to using {@link Temporal#with(TemporalField, long)} + passing {@link ChronoField#YEAR} as the field. + If the specified temporal object does not use the ISO calendar system then + a {@code DateTimeException} is thrown. + + In most cases, it is clearer to reverse the calling pattern by using + {@link Temporal#with(TemporalAdjuster)}: +
+   // these two lines are equivalent, but the second approach is recommended
+   temporal = thisYear.adjustInto(temporal);
+   temporal = temporal.with(thisYear);
+ 
+ + This instance is immutable and unaffected by this method call. + + @param temporal the target object to be adjusted, not null + @return the adjusted object, not null + @throws DateTimeException if unable to make the adjustment + @throws ArithmeticException if numeric overflow occurs" + {:arglists (quote (["java.time.Year" "java.time.temporal.Temporal"]))} + (^java.time.temporal.Temporal + [^java.time.Year this ^java.time.temporal.Temporal temporal] + (.adjustInto this temporal))) + +(defn with + {:arglists (quote (["java.time.Year" "java.time.temporal.TemporalAdjuster"] + ["java.time.Year" "java.time.temporal.TemporalField" + "long"]))} + (^java.time.Year + [^java.time.Year this ^java.time.temporal.TemporalAdjuster adjuster] + (.with this adjuster)) + (^java.time.Year + [^java.time.Year this ^java.time.temporal.TemporalField field + ^long new-value] + (.with this field new-value))) + +(defn now + {:arglists (quote ([] ["java.time.Clock"] ["java.time.ZoneId"]))} + (^java.time.Year [] (java.time.Year/now)) + (^java.time.Year [arg0] + (cond (instance? java.time.Clock arg0) (let [^java.time.Clock clock arg0] + (java.time.Year/now clock)) + (instance? java.time.ZoneId arg0) (let [^java.time.ZoneId zone arg0] + (java.time.Year/now zone)) + :else (throw (java.lang.IllegalArgumentException. + "no corresponding java.time method with these args"))))) + +(defn compare-to + "Compares this year to another year. + + The comparison is based on the value of the year. + It is \"consistent with equals\", as defined by {@link Comparable}. + + @param other the other year to compare to, not null + @return the comparator value, negative if less, positive if greater" + {:arglists (quote (["java.time.Year" "java.time.Year"]))} + (^java.lang.Integer [^java.time.Year this ^java.time.Year other] + (.compareTo this other))) + +(defn get + "Gets the value of the specified field from this year as an {@code int}. + + This queries this year for the value of the specified field. + The returned value will always be within the valid range of values for the field. + If it is not possible to return the value, because the field is not supported + or for some other reason, an exception is thrown. + + If the field is a {@link ChronoField} then the query is implemented here. + The {@link #isSupported(TemporalField) supported fields} will return valid + values based on this year. + All other {@code ChronoField} instances will throw an {@code UnsupportedTemporalTypeException}. + + If the field is not a {@code ChronoField}, then the result of this method + is obtained by invoking {@code TemporalField.getFrom(TemporalAccessor)} + passing {@code this} as the argument. Whether the value can be obtained, + and what the value represents, is determined by the field. + + @param field the field to get, not null + @return the value for the field + @throws DateTimeException if a value for the field cannot be obtained or + the value is outside the range of valid values for the field + @throws UnsupportedTemporalTypeException if the field is not supported or + the range of values exceeds an {@code int} + @throws ArithmeticException if numeric overflow occurs" + {:arglists (quote (["java.time.Year" "java.time.temporal.TemporalField"]))} + (^java.lang.Integer + [^java.time.Year this ^java.time.temporal.TemporalField field] + (.get this field))) + +(defn equals + "Checks if this year is equal to another year. + + The comparison is based on the time-line position of the years. + + @param obj the object to check, null returns false + @return true if this is equal to the other year" + {:arglists (quote (["java.time.Year" "java.lang.Object"]))} + (^java.lang.Boolean [^java.time.Year this ^java.lang.Object obj] + (.equals this obj))) + +(defn format + "Formats this year using the specified formatter. + + This year will be passed to the formatter to produce a string. + + @param formatter the formatter to use, not null + @return the formatted year string, not null + @throws DateTimeException if an error occurs during printing" + {:arglists (quote (["java.time.Year" "java.time.format.DateTimeFormatter"]))} + (^java.lang.String + [^java.time.Year this ^java.time.format.DateTimeFormatter formatter] + (.format this formatter))) + +(defn plus-years + "Returns a copy of this {@code Year} with the specified number of years added. + + This instance is immutable and unaffected by this method call. + + @param yearsToAdd the years to add, may be negative + @return a {@code Year} based on this year with the years added, not null + @throws DateTimeException if the result exceeds the supported range" + {:arglists (quote (["java.time.Year" "long"]))} + (^java.time.Year [^java.time.Year this ^long years-to-add] + (.plusYears this years-to-add))) diff --git a/src/cljc/java_time/year.cljs b/src/cljc/java_time/year.cljs index d4ab8af..ce870cb 100644 --- a/src/cljc/java_time/year.cljs +++ b/src/cljc/java_time/year.cljs @@ -1,33 +1,444 @@ -(ns cljc.java-time.year (:refer-clojure :exclude [abs get range format min max next name resolve short]) (:require [cljc.java-time.extn.calendar-awareness] [goog.object] [java.time :refer [Year]])) -(def min-value (goog.object/get java.time.Year "MIN_VALUE")) -(def max-value (goog.object/get java.time.Year "MAX_VALUE")) -(clojure.core/defn range {:arglists (quote (["java.time.Year" "java.time.temporal.TemporalField"]))} (^js/JSJoda.ValueRange [^js/JSJoda.Year this15159 ^js/JSJoda.TemporalField java-time-temporal-TemporalField15160] (.range this15159 java-time-temporal-TemporalField15160))) -(clojure.core/defn of {:arglists (quote (["int"]))} (^js/JSJoda.Year [^int int15161] (js-invoke java.time.Year "of" int15161))) -(clojure.core/defn at-day {:arglists (quote (["java.time.Year" "int"]))} (^js/JSJoda.LocalDate [^js/JSJoda.Year this15162 ^int int15163] (.atDay this15162 int15163))) -(clojure.core/defn plus {:arglists (quote (["java.time.Year" "java.time.temporal.TemporalAmount"] ["java.time.Year" "long" "java.time.temporal.TemporalUnit"]))} (^js/JSJoda.Year [^js/JSJoda.Year this15164 ^js/JSJoda.TemporalAmount java-time-temporal-TemporalAmount15165] (.plus this15164 java-time-temporal-TemporalAmount15165)) (^js/JSJoda.Year [^js/JSJoda.Year this15166 ^long long15167 ^js/JSJoda.TemporalUnit java-time-temporal-TemporalUnit15168] (.plus this15166 long15167 java-time-temporal-TemporalUnit15168))) -(clojure.core/defn is-valid-month-day {:arglists (quote (["java.time.Year" "java.time.MonthDay"]))} (^boolean [^js/JSJoda.Year this15169 ^js/JSJoda.MonthDay java-time-MonthDay15170] (.isValidMonthDay this15169 java-time-MonthDay15170))) -(clojure.core/defn query {:arglists (quote (["java.time.Year" "java.time.temporal.TemporalQuery"]))} (^java.lang.Object [^js/JSJoda.Year this15171 ^js/JSJoda.TemporalQuery java-time-temporal-TemporalQuery15172] (.query this15171 java-time-temporal-TemporalQuery15172))) -^{:line 84, :column 16} (clojure.core/defn is-leap {:arglists ^{:line 84, :column 54} (quote ^{:line 84, :column 61} (["long"]))} ^{:line 85, :column 18} (^java.lang.Boolean [^long long57050] ^{:line 85, :column 56} (. java.time.Year isLeap long57050))) -(clojure.core/defn to-string {:arglists (quote (["java.time.Year"]))} (^java.lang.String [^js/JSJoda.Year this15173] (.toString this15173))) -(clojure.core/defn is-before {:arglists (quote (["java.time.Year" "java.time.Year"]))} (^boolean [^js/JSJoda.Year this15174 ^js/JSJoda.Year java-time-Year15175] (.isBefore this15174 java-time-Year15175))) -(clojure.core/defn minus {:arglists (quote (["java.time.Year" "java.time.temporal.TemporalAmount"] ["java.time.Year" "long" "java.time.temporal.TemporalUnit"]))} (^js/JSJoda.Year [^js/JSJoda.Year this15176 ^js/JSJoda.TemporalAmount java-time-temporal-TemporalAmount15177] (.minus this15176 java-time-temporal-TemporalAmount15177)) (^js/JSJoda.Year [^js/JSJoda.Year this15178 ^long long15179 ^js/JSJoda.TemporalUnit java-time-temporal-TemporalUnit15180] (.minus this15178 long15179 java-time-temporal-TemporalUnit15180))) -(clojure.core/defn at-month-day {:arglists (quote (["java.time.Year" "java.time.MonthDay"]))} (^js/JSJoda.LocalDate [^js/JSJoda.Year this15181 ^js/JSJoda.MonthDay java-time-MonthDay15182] (.atMonthDay this15181 java-time-MonthDay15182))) -(clojure.core/defn get-value {:arglists (quote (["java.time.Year"]))} (^int [^js/JSJoda.Year this15183] (.value this15183))) -(clojure.core/defn get-long {:arglists (quote (["java.time.Year" "java.time.temporal.TemporalField"]))} (^long [^js/JSJoda.Year this15184 ^js/JSJoda.TemporalField java-time-temporal-TemporalField15185] (.getLong this15184 java-time-temporal-TemporalField15185))) -(clojure.core/defn at-month {:arglists (quote (["java.time.Year" "int"] ["java.time.Year" "java.time.Month"]))} (^js/JSJoda.YearMonth [this15186 G__15187] (.atMonth ^js/JSJoda.Year this15186 G__15187))) -(clojure.core/defn until {:arglists (quote (["java.time.Year" "java.time.temporal.Temporal" "java.time.temporal.TemporalUnit"]))} (^long [^js/JSJoda.Year this15188 ^js/JSJoda.Temporal java-time-temporal-Temporal15189 ^js/JSJoda.TemporalUnit java-time-temporal-TemporalUnit15190] (.until this15188 java-time-temporal-Temporal15189 java-time-temporal-TemporalUnit15190))) -(clojure.core/defn length {:arglists (quote (["java.time.Year"]))} (^int [^js/JSJoda.Year this15191] (.length this15191))) -(clojure.core/defn from {:arglists (quote (["java.time.temporal.TemporalAccessor"]))} (^js/JSJoda.Year [^js/JSJoda.TemporalAccessor java-time-temporal-TemporalAccessor15192] (js-invoke java.time.Year "from" java-time-temporal-TemporalAccessor15192))) -(clojure.core/defn is-after {:arglists (quote (["java.time.Year" "java.time.Year"]))} (^boolean [^js/JSJoda.Year this15193 ^js/JSJoda.Year java-time-Year15194] (.isAfter this15193 java-time-Year15194))) -(clojure.core/defn is-supported {:arglists (quote (["java.time.Year" "java.time.temporal.TemporalField"] ["java.time.Year" "java.time.temporal.TemporalUnit"]))} (^boolean [this15195 G__15196] (.isSupported ^js/JSJoda.Year this15195 G__15196))) -(clojure.core/defn minus-years {:arglists (quote (["java.time.Year" "long"]))} (^js/JSJoda.Year [^js/JSJoda.Year this15197 ^long long15198] (.minusYears this15197 long15198))) -(clojure.core/defn parse {:arglists (quote (["java.lang.CharSequence" "java.time.format.DateTimeFormatter"] ["java.lang.CharSequence"]))} (^js/JSJoda.Year [^java.lang.CharSequence java-lang-CharSequence15199 ^js/JSJoda.DateTimeFormatter java-time-format-DateTimeFormatter15200] (js-invoke java.time.Year "parse" java-lang-CharSequence15199 java-time-format-DateTimeFormatter15200)) (^js/JSJoda.Year [^java.lang.CharSequence java-lang-CharSequence15201] (js-invoke java.time.Year "parse" java-lang-CharSequence15201))) -(clojure.core/defn hash-code {:arglists (quote (["java.time.Year"]))} (^int [^js/JSJoda.Year this15202] (.hashCode this15202))) -(clojure.core/defn adjust-into {:arglists (quote (["java.time.Year" "java.time.temporal.Temporal"]))} (^js/JSJoda.Temporal [^js/JSJoda.Year this15203 ^js/JSJoda.Temporal java-time-temporal-Temporal15204] (.adjustInto this15203 java-time-temporal-Temporal15204))) -(clojure.core/defn with {:arglists (quote (["java.time.Year" "java.time.temporal.TemporalField" "long"] ["java.time.Year" "java.time.temporal.TemporalAdjuster"]))} (^js/JSJoda.Year [^js/JSJoda.Year this15205 ^js/JSJoda.TemporalField java-time-temporal-TemporalField15206 ^long long15207] (.with this15205 java-time-temporal-TemporalField15206 long15207)) (^js/JSJoda.Year [^js/JSJoda.Year this15208 ^js/JSJoda.TemporalAdjuster java-time-temporal-TemporalAdjuster15209] (.with this15208 java-time-temporal-TemporalAdjuster15209))) -(clojure.core/defn now {:arglists (quote ([] ["java.time.Clock"] ["java.time.ZoneId"]))} (^js/JSJoda.Year [] (js-invoke java.time.Year "now")) (^js/JSJoda.Year [G__15211] (js-invoke java.time.Year "now" G__15211))) -(clojure.core/defn compare-to {:arglists (quote (["java.time.Year" "java.time.Year"]))} (^int [^js/JSJoda.Year this15212 ^js/JSJoda.Year java-time-Year15213] (.compareTo this15212 java-time-Year15213))) -(clojure.core/defn get {:arglists (quote (["java.time.Year" "java.time.temporal.TemporalField"]))} (^int [^js/JSJoda.Year this15214 ^js/JSJoda.TemporalField java-time-temporal-TemporalField15215] (.get this15214 java-time-temporal-TemporalField15215))) -(clojure.core/defn equals {:arglists (quote (["java.time.Year" "java.lang.Object"]))} (^boolean [^js/JSJoda.Year this15216 ^java.lang.Object java-lang-Object15217] (.equals this15216 java-lang-Object15217))) -(clojure.core/defn format {:arglists (quote (["java.time.Year" "java.time.format.DateTimeFormatter"]))} (^java.lang.String [^js/JSJoda.Year this15218 ^js/JSJoda.DateTimeFormatter java-time-format-DateTimeFormatter15219] (.format this15218 java-time-format-DateTimeFormatter15219))) -(clojure.core/defn plus-years {:arglists (quote (["java.time.Year" "long"]))} (^js/JSJoda.Year [^js/JSJoda.Year this15220 ^long long15221] (.plusYears this15220 long15221))) +(ns cljc.java-time.year + (:refer-clojure :exclude + [abs get range format min max next name resolve short]) + (:require [cljc.java-time.extn.calendar-awareness] + [goog.object] + [java.time :refer [Year]])) + +(def min-value + "The minimum supported year, '-999,999,999'." + (goog.object/get java.time.Year "MIN_VALUE")) + +(def max-value + "The maximum supported year, '+999,999,999'." + (goog.object/get java.time.Year "MAX_VALUE")) + +(defn range + "Gets the range of valid values for the specified field. + + The range object expresses the minimum and maximum valid values for a field. + This year is used to enhance the accuracy of the returned range. + If it is not possible to return the range, because the field is not supported + or for some other reason, an exception is thrown. + + If the field is a {@link ChronoField} then the query is implemented here. + The {@link #isSupported(TemporalField) supported fields} will return + appropriate range instances. + All other {@code ChronoField} instances will throw an {@code UnsupportedTemporalTypeException}. + + If the field is not a {@code ChronoField}, then the result of this method + is obtained by invoking {@code TemporalField.rangeRefinedBy(TemporalAccessor)} + passing {@code this} as the argument. + Whether the range can be obtained is determined by the field. + + @param field the field to query the range for, not null + @return the range of valid values for the field, not null + @throws DateTimeException if the range for the field cannot be obtained + @throws UnsupportedTemporalTypeException if the field is not supported" + {:arglists (quote (["java.time.Year" "java.time.temporal.TemporalField"]))} + (^js/JSJoda.ValueRange [^js/JSJoda.Year this ^js/JSJoda.TemporalField field] + (.range this field))) + +(defn of + "Obtains an instance of {@code Year}. + + This method accepts a year value from the proleptic ISO calendar system. + + The year 2AD/CE is represented by 2.
+ The year 1AD/CE is represented by 1.
+ The year 1BC/BCE is represented by 0.
+ The year 2BC/BCE is represented by -1.
+ + @param isoYear the ISO proleptic year to represent, from {@code MIN_VALUE} to {@code MAX_VALUE} + @return the year, not null + @throws DateTimeException if the field is invalid" + {:arglists (quote (["int"]))} + (^js/JSJoda.Year [^int iso-year] (js-invoke java.time.Year "of" iso-year))) + +(defn at-day + "Combines this year with a day-of-year to create a {@code LocalDate}. + + This returns a {@code LocalDate} formed from this year and the specified day-of-year. + + The day-of-year value 366 is only valid in a leap year. + + @param dayOfYear the day-of-year to use, from 1 to 365-366 + @return the local date formed from this year and the specified date of year, not null + @throws DateTimeException if the day of year is zero or less, 366 or greater or equal + to 366 and this is not a leap year" + {:arglists (quote (["java.time.Year" "int"]))} + (^js/JSJoda.LocalDate [^js/JSJoda.Year this ^int day-of-year] + (.atDay this day-of-year))) + +(defn plus + {:arglists (quote (["java.time.Year" "java.time.temporal.TemporalAmount"] + ["java.time.Year" "long" + "java.time.temporal.TemporalUnit"]))} + (^js/JSJoda.Year + [^js/JSJoda.Year this ^js/JSJoda.TemporalAmount amount-to-add] + (.plus this amount-to-add)) + (^js/JSJoda.Year + [^js/JSJoda.Year this ^long amount-to-add ^js/JSJoda.TemporalUnit unit] + (.plus this amount-to-add unit))) + +(defn is-valid-month-day + "Checks if the month-day is valid for this year. + + This method checks whether this year and the input month and day form + a valid date. + + @param monthDay the month-day to validate, null returns false + @return true if the month and day are valid for this year" + {:arglists (quote (["java.time.Year" "java.time.MonthDay"]))} + (^boolean [^js/JSJoda.Year this ^js/JSJoda.MonthDay month-day] + (.isValidMonthDay this month-day))) + +(defn query + "Queries this year using the specified query. + + This queries this year using the specified query strategy object. + The {@code TemporalQuery} object defines the logic to be used to + obtain the result. Read the documentation of the query to understand + what the result of this method will be. + + The result of this method is obtained by invoking the + {@link TemporalQuery#queryFrom(TemporalAccessor)} method on the + specified query passing {@code this} as the argument. + + @param the type of the result + @param query the query to invoke, not null + @return the query result, null may be returned (defined by the query) + @throws DateTimeException if unable to query (defined by the query) + @throws ArithmeticException if numeric overflow occurs (defined by the query)" + {:arglists (quote (["java.time.Year" "java.time.temporal.TemporalQuery"]))} + (^java.lang.Object [^js/JSJoda.Year this ^js/JSJoda.TemporalQuery query] + (.query this query))) + +(defn is-leap + {:arglists (quote (["long"]))} + (^java.lang.Boolean [^long year] (. java.time.Year isLeap year))) + +(defn to-string + "Outputs this year as a {@code String}. + + @return a string representation of this year, not null" + {:arglists (quote (["java.time.Year"]))} + (^java.lang.String [^js/JSJoda.Year this] (.toString this))) + +(defn is-before + "Checks if this year is before the specified year. + + @param other the other year to compare to, not null + @return true if this point is before the specified year" + {:arglists (quote (["java.time.Year" "java.time.Year"]))} + (^boolean [^js/JSJoda.Year this ^js/JSJoda.Year other] + (.isBefore this other))) + +(defn minus + {:arglists (quote (["java.time.Year" "java.time.temporal.TemporalAmount"] + ["java.time.Year" "long" + "java.time.temporal.TemporalUnit"]))} + (^js/JSJoda.Year + [^js/JSJoda.Year this ^js/JSJoda.TemporalAmount amount-to-subtract] + (.minus this amount-to-subtract)) + (^js/JSJoda.Year + [^js/JSJoda.Year this ^long amount-to-subtract ^js/JSJoda.TemporalUnit unit] + (.minus this amount-to-subtract unit))) + +(defn at-month-day + "Combines this year with a month-day to create a {@code LocalDate}. + + This returns a {@code LocalDate} formed from this year and the specified month-day. + + A month-day of February 29th will be adjusted to February 28th in the resulting + date if the year is not a leap year. + + @param monthDay the month-day to use, not null + @return the local date formed from this year and the specified month-day, not null" + {:arglists (quote (["java.time.Year" "java.time.MonthDay"]))} + (^js/JSJoda.LocalDate [^js/JSJoda.Year this ^js/JSJoda.MonthDay month-day] + (.atMonthDay this month-day))) + +(defn get-value + "Gets the year value. + + The year returned by this method is proleptic as per {@code get(YEAR)}. + + @return the year, {@code MIN_VALUE} to {@code MAX_VALUE}" + {:arglists (quote (["java.time.Year"]))} + (^int [^js/JSJoda.Year this] (.value this))) + +(defn get-long + "Gets the value of the specified field from this year as a {@code long}. + + This queries this year for the value of the specified field. + If it is not possible to return the value, because the field is not supported + or for some other reason, an exception is thrown. + + If the field is a {@link ChronoField} then the query is implemented here. + The {@link #isSupported(TemporalField) supported fields} will return valid + values based on this year. + All other {@code ChronoField} instances will throw an {@code UnsupportedTemporalTypeException}. + + If the field is not a {@code ChronoField}, then the result of this method + is obtained by invoking {@code TemporalField.getFrom(TemporalAccessor)} + passing {@code this} as the argument. Whether the value can be obtained, + and what the value represents, is determined by the field. + + @param field the field to get, not null + @return the value for the field + @throws DateTimeException if a value for the field cannot be obtained + @throws UnsupportedTemporalTypeException if the field is not supported + @throws ArithmeticException if numeric overflow occurs" + {:arglists (quote (["java.time.Year" "java.time.temporal.TemporalField"]))} + (^long [^js/JSJoda.Year this ^js/JSJoda.TemporalField field] + (.getLong this field))) + +(defn at-month + {:arglists (quote (["java.time.Year" "int"] + ["java.time.Year" "java.time.Month"]))} + (^js/JSJoda.YearMonth [^js/JSJoda.Year this arg0] + (.atMonth ^js/JSJoda.Year this arg0))) + +(defn until + "Calculates the amount of time until another year in terms of the specified unit. + + This calculates the amount of time between two {@code Year} + objects in terms of a single {@code TemporalUnit}. + The start and end points are {@code this} and the specified year. + The result will be negative if the end is before the start. + The {@code Temporal} passed to this method is converted to a + {@code Year} using {@link #from(TemporalAccessor)}. + For example, the amount in decades between two year can be calculated + using {@code startYear.until(endYear, DECADES)}. + + The calculation returns a whole number, representing the number of + complete units between the two years. + For example, the amount in decades between 2012 and 2031 + will only be one decade as it is one year short of two decades. + + There are two equivalent ways of using this method. + The first is to invoke this method. + The second is to use {@link TemporalUnit#between(Temporal, Temporal)}: +
+   // these two lines are equivalent
+   amount = start.until(end, YEARS);
+   amount = YEARS.between(start, end);
+ 
+ The choice should be made based on which makes the code more readable. + + The calculation is implemented in this method for {@link ChronoUnit}. + The units {@code YEARS}, {@code DECADES}, {@code CENTURIES}, + {@code MILLENNIA} and {@code ERAS} are supported. + Other {@code ChronoUnit} values will throw an exception. + + If the unit is not a {@code ChronoUnit}, then the result of this method + is obtained by invoking {@code TemporalUnit.between(Temporal, Temporal)} + passing {@code this} as the first argument and the converted input temporal + as the second argument. + + This instance is immutable and unaffected by this method call. + + @param endExclusive the end date, exclusive, which is converted to a {@code Year}, not null + @param unit the unit to measure the amount in, not null + @return the amount of time between this year and the end year + @throws DateTimeException if the amount cannot be calculated, or the end + temporal cannot be converted to a {@code Year} + @throws UnsupportedTemporalTypeException if the unit is not supported + @throws ArithmeticException if numeric overflow occurs" + {:arglists (quote (["java.time.Year" "java.time.temporal.Temporal" + "java.time.temporal.TemporalUnit"]))} + (^long + [^js/JSJoda.Year this ^js/JSJoda.Temporal end-exclusive + ^js/JSJoda.TemporalUnit unit] + (.until this end-exclusive unit))) + +(defn length + "Gets the length of this year in days. + + @return the length of this year in days, 365 or 366" + {:arglists (quote (["java.time.Year"]))} + (^int [^js/JSJoda.Year this] (.length this))) + +(defn from + "Obtains an instance of {@code Year} from a temporal object. + + This obtains a year based on the specified temporal. + A {@code TemporalAccessor} represents an arbitrary set of date and time information, + which this factory converts to an instance of {@code Year}. + + The conversion extracts the {@link ChronoField#YEAR year} field. + The extraction is only permitted if the temporal object has an ISO + chronology, or can be converted to a {@code LocalDate}. + + This method matches the signature of the functional interface {@link TemporalQuery} + allowing it to be used as a query via method reference, {@code Year::from}. + + @param temporal the temporal object to convert, not null + @return the year, not null + @throws DateTimeException if unable to convert to a {@code Year}" + {:arglists (quote (["java.time.temporal.TemporalAccessor"]))} + (^js/JSJoda.Year [^js/JSJoda.TemporalAccessor temporal] + (js-invoke java.time.Year "from" temporal))) + +(defn is-after + "Checks if this year is after the specified year. + + @param other the other year to compare to, not null + @return true if this is after the specified year" + {:arglists (quote (["java.time.Year" "java.time.Year"]))} + (^boolean [^js/JSJoda.Year this ^js/JSJoda.Year other] (.isAfter this other))) + +(defn is-supported + {:arglists (quote (["java.time.Year" "java.time.temporal.TemporalField"] + ["java.time.Year" "java.time.temporal.TemporalUnit"]))} + (^boolean [^js/JSJoda.Year this arg0] + (.isSupported ^js/JSJoda.Year this arg0))) + +(defn minus-years + "Returns a copy of this {@code Year} with the specified number of years subtracted. + + This instance is immutable and unaffected by this method call. + + @param yearsToSubtract the years to subtract, may be negative + @return a {@code Year} based on this year with the year subtracted, not null + @throws DateTimeException if the result exceeds the supported range" + {:arglists (quote (["java.time.Year" "long"]))} + (^js/JSJoda.Year [^js/JSJoda.Year this ^long years-to-subtract] + (.minusYears this years-to-subtract))) + +(defn parse + {:arglists (quote (["java.lang.CharSequence"] + ["java.lang.CharSequence" + "java.time.format.DateTimeFormatter"]))} + (^js/JSJoda.Year [^java.lang.CharSequence text] + (js-invoke java.time.Year "parse" text)) + (^js/JSJoda.Year + [^java.lang.CharSequence text ^js/JSJoda.DateTimeFormatter formatter] + (js-invoke java.time.Year "parse" text formatter))) + +(defn hash-code + "A hash code for this year. + + @return a suitable hash code" + {:arglists (quote (["java.time.Year"]))} + (^int [^js/JSJoda.Year this] (.hashCode this))) + +(defn adjust-into + "Adjusts the specified temporal object to have this year. + + This returns a temporal object of the same observable type as the input + with the year changed to be the same as this. + + The adjustment is equivalent to using {@link Temporal#with(TemporalField, long)} + passing {@link ChronoField#YEAR} as the field. + If the specified temporal object does not use the ISO calendar system then + a {@code DateTimeException} is thrown. + + In most cases, it is clearer to reverse the calling pattern by using + {@link Temporal#with(TemporalAdjuster)}: +
+   // these two lines are equivalent, but the second approach is recommended
+   temporal = thisYear.adjustInto(temporal);
+   temporal = temporal.with(thisYear);
+ 
+ + This instance is immutable and unaffected by this method call. + + @param temporal the target object to be adjusted, not null + @return the adjusted object, not null + @throws DateTimeException if unable to make the adjustment + @throws ArithmeticException if numeric overflow occurs" + {:arglists (quote (["java.time.Year" "java.time.temporal.Temporal"]))} + (^js/JSJoda.Temporal [^js/JSJoda.Year this ^js/JSJoda.Temporal temporal] + (.adjustInto this temporal))) + +(defn with + {:arglists (quote (["java.time.Year" "java.time.temporal.TemporalAdjuster"] + ["java.time.Year" "java.time.temporal.TemporalField" + "long"]))} + (^js/JSJoda.Year [^js/JSJoda.Year this ^js/JSJoda.TemporalAdjuster adjuster] + (.with this adjuster)) + (^js/JSJoda.Year + [^js/JSJoda.Year this ^js/JSJoda.TemporalField field ^long new-value] + (.with this field new-value))) + +(defn now + {:arglists (quote ([] ["java.time.Clock"] ["java.time.ZoneId"]))} + (^js/JSJoda.Year [] (js-invoke java.time.Year "now")) + (^js/JSJoda.Year [arg0] (js-invoke java.time.Year "now" arg0))) + +(defn compare-to + "Compares this year to another year. + + The comparison is based on the value of the year. + It is \"consistent with equals\", as defined by {@link Comparable}. + + @param other the other year to compare to, not null + @return the comparator value, negative if less, positive if greater" + {:arglists (quote (["java.time.Year" "java.time.Year"]))} + (^int [^js/JSJoda.Year this ^js/JSJoda.Year other] (.compareTo this other))) + +(defn get + "Gets the value of the specified field from this year as an {@code int}. + + This queries this year for the value of the specified field. + The returned value will always be within the valid range of values for the field. + If it is not possible to return the value, because the field is not supported + or for some other reason, an exception is thrown. + + If the field is a {@link ChronoField} then the query is implemented here. + The {@link #isSupported(TemporalField) supported fields} will return valid + values based on this year. + All other {@code ChronoField} instances will throw an {@code UnsupportedTemporalTypeException}. + + If the field is not a {@code ChronoField}, then the result of this method + is obtained by invoking {@code TemporalField.getFrom(TemporalAccessor)} + passing {@code this} as the argument. Whether the value can be obtained, + and what the value represents, is determined by the field. + + @param field the field to get, not null + @return the value for the field + @throws DateTimeException if a value for the field cannot be obtained or + the value is outside the range of valid values for the field + @throws UnsupportedTemporalTypeException if the field is not supported or + the range of values exceeds an {@code int} + @throws ArithmeticException if numeric overflow occurs" + {:arglists (quote (["java.time.Year" "java.time.temporal.TemporalField"]))} + (^int [^js/JSJoda.Year this ^js/JSJoda.TemporalField field] + (.get this field))) + +(defn equals + "Checks if this year is equal to another year. + + The comparison is based on the time-line position of the years. + + @param obj the object to check, null returns false + @return true if this is equal to the other year" + {:arglists (quote (["java.time.Year" "java.lang.Object"]))} + (^boolean [^js/JSJoda.Year this ^java.lang.Object obj] (.equals this obj))) + +(defn format + "Formats this year using the specified formatter. + + This year will be passed to the formatter to produce a string. + + @param formatter the formatter to use, not null + @return the formatted year string, not null + @throws DateTimeException if an error occurs during printing" + {:arglists (quote (["java.time.Year" "java.time.format.DateTimeFormatter"]))} + (^java.lang.String + [^js/JSJoda.Year this ^js/JSJoda.DateTimeFormatter formatter] + (.format this formatter))) + +(defn plus-years + "Returns a copy of this {@code Year} with the specified number of years added. + + This instance is immutable and unaffected by this method call. + + @param yearsToAdd the years to add, may be negative + @return a {@code Year} based on this year with the years added, not null + @throws DateTimeException if the result exceeds the supported range" + {:arglists (quote (["java.time.Year" "long"]))} + (^js/JSJoda.Year [^js/JSJoda.Year this ^long years-to-add] + (.plusYears this years-to-add))) diff --git a/src/cljc/java_time/year_month.clj b/src/cljc/java_time/year_month.clj index d5247a0..17bfeae 100644 --- a/src/cljc/java_time/year_month.clj +++ b/src/cljc/java_time/year_month.clj @@ -1,37 +1,577 @@ -(ns cljc.java-time.year-month (:refer-clojure :exclude [abs get range format min max next name resolve short]) (:require [cljc.java-time.extn.calendar-awareness]) (:import [java.time YearMonth])) -(clojure.core/defn length-of-year {:arglists (quote (["java.time.YearMonth"]))} (^java.lang.Integer [^java.time.YearMonth this15222] (.lengthOfYear this15222))) -(clojure.core/defn range {:arglists (quote (["java.time.YearMonth" "java.time.temporal.TemporalField"]))} (^java.time.temporal.ValueRange [^java.time.YearMonth this15223 ^java.time.temporal.TemporalField java-time-temporal-TemporalField15224] (.range this15223 java-time-temporal-TemporalField15224))) -(clojure.core/defn is-valid-day {:arglists (quote (["java.time.YearMonth" "int"]))} (^java.lang.Boolean [^java.time.YearMonth this15225 ^java.lang.Integer int15226] (.isValidDay this15225 int15226))) -(clojure.core/defn of {:arglists (quote (["int" "int"] ["int" "java.time.Month"]))} (^java.time.YearMonth [G__15228 G__15229] (clojure.core/cond (clojure.core/and (clojure.core/instance? java.lang.Number G__15228) (clojure.core/instance? java.lang.Number G__15229)) (clojure.core/let [G__15228 (clojure.core/int G__15228) G__15229 (clojure.core/int G__15229)] (java.time.YearMonth/of G__15228 G__15229)) (clojure.core/and (clojure.core/instance? java.lang.Number G__15228) (clojure.core/instance? java.time.Month G__15229)) (clojure.core/let [G__15228 (clojure.core/int G__15228) G__15229 ^"java.time.Month" G__15229] (java.time.YearMonth/of G__15228 G__15229)) :else (throw (java.lang.IllegalArgumentException. "no corresponding java.time method with these args"))))) -(clojure.core/defn with-month {:arglists (quote (["java.time.YearMonth" "int"]))} (^java.time.YearMonth [^java.time.YearMonth this15230 ^java.lang.Integer int15231] (.withMonth this15230 int15231))) -(clojure.core/defn at-day {:arglists (quote (["java.time.YearMonth" "int"]))} (^java.time.LocalDate [^java.time.YearMonth this15232 ^java.lang.Integer int15233] (.atDay this15232 int15233))) -(clojure.core/defn get-year {:arglists (quote (["java.time.YearMonth"]))} (^java.lang.Integer [^java.time.YearMonth this15234] (.getYear this15234))) -(clojure.core/defn plus {:arglists (quote (["java.time.YearMonth" "long" "java.time.temporal.TemporalUnit"] ["java.time.YearMonth" "java.time.temporal.TemporalAmount"]))} (^java.time.YearMonth [^java.time.YearMonth this15235 ^long long15236 ^java.time.temporal.ChronoUnit java-time-temporal-TemporalUnit15237] (.plus this15235 long15236 java-time-temporal-TemporalUnit15237)) (^java.time.YearMonth [^java.time.YearMonth this15238 ^java.time.temporal.TemporalAmount java-time-temporal-TemporalAmount15239] (.plus this15238 java-time-temporal-TemporalAmount15239))) -(clojure.core/defn is-leap-year {:arglists (quote (["java.time.YearMonth"]))} (^java.lang.Boolean [^java.time.YearMonth this15240] (.isLeapYear this15240))) -(clojure.core/defn query {:arglists (quote (["java.time.YearMonth" "java.time.temporal.TemporalQuery"]))} (^java.lang.Object [^java.time.YearMonth this15241 ^java.time.temporal.TemporalQuery java-time-temporal-TemporalQuery15242] (.query this15241 java-time-temporal-TemporalQuery15242))) -(clojure.core/defn to-string {:arglists (quote (["java.time.YearMonth"]))} (^java.lang.String [^java.time.YearMonth this15243] (.toString this15243))) -(clojure.core/defn plus-months {:arglists (quote (["java.time.YearMonth" "long"]))} (^java.time.YearMonth [^java.time.YearMonth this15244 ^long long15245] (.plusMonths this15244 long15245))) -(clojure.core/defn is-before {:arglists (quote (["java.time.YearMonth" "java.time.YearMonth"]))} (^java.lang.Boolean [^java.time.YearMonth this15246 ^java.time.YearMonth java-time-YearMonth15247] (.isBefore this15246 java-time-YearMonth15247))) -(clojure.core/defn minus-months {:arglists (quote (["java.time.YearMonth" "long"]))} (^java.time.YearMonth [^java.time.YearMonth this15248 ^long long15249] (.minusMonths this15248 long15249))) -(clojure.core/defn minus {:arglists (quote (["java.time.YearMonth" "java.time.temporal.TemporalAmount"] ["java.time.YearMonth" "long" "java.time.temporal.TemporalUnit"]))} (^java.time.YearMonth [^java.time.YearMonth this15250 ^java.time.temporal.TemporalAmount java-time-temporal-TemporalAmount15251] (.minus this15250 java-time-temporal-TemporalAmount15251)) (^java.time.YearMonth [^java.time.YearMonth this15252 ^long long15253 ^java.time.temporal.ChronoUnit java-time-temporal-TemporalUnit15254] (.minus this15252 long15253 java-time-temporal-TemporalUnit15254))) -(clojure.core/defn get-long {:arglists (quote (["java.time.YearMonth" "java.time.temporal.TemporalField"]))} (^long [^java.time.YearMonth this15255 ^java.time.temporal.TemporalField java-time-temporal-TemporalField15256] (.getLong this15255 java-time-temporal-TemporalField15256))) -(clojure.core/defn with-year {:arglists (quote (["java.time.YearMonth" "int"]))} (^java.time.YearMonth [^java.time.YearMonth this15257 ^java.lang.Integer int15258] (.withYear this15257 int15258))) -(clojure.core/defn at-end-of-month {:arglists (quote (["java.time.YearMonth"]))} (^java.time.LocalDate [^java.time.YearMonth this15259] (.atEndOfMonth this15259))) -(clojure.core/defn length-of-month {:arglists (quote (["java.time.YearMonth"]))} (^java.lang.Integer [^java.time.YearMonth this15260] (.lengthOfMonth this15260))) -(clojure.core/defn until {:arglists (quote (["java.time.YearMonth" "java.time.temporal.Temporal" "java.time.temporal.TemporalUnit"]))} (^long [^java.time.YearMonth this15261 ^java.time.temporal.Temporal java-time-temporal-Temporal15262 ^java.time.temporal.ChronoUnit java-time-temporal-TemporalUnit15263] (.until this15261 java-time-temporal-Temporal15262 java-time-temporal-TemporalUnit15263))) -(clojure.core/defn from {:arglists (quote (["java.time.temporal.TemporalAccessor"]))} (^java.time.YearMonth [^java.time.temporal.TemporalAccessor java-time-temporal-TemporalAccessor15264] (java.time.YearMonth/from java-time-temporal-TemporalAccessor15264))) -(clojure.core/defn is-after {:arglists (quote (["java.time.YearMonth" "java.time.YearMonth"]))} (^java.lang.Boolean [^java.time.YearMonth this15265 ^java.time.YearMonth java-time-YearMonth15266] (.isAfter this15265 java-time-YearMonth15266))) -(clojure.core/defn is-supported {:arglists (quote (["java.time.YearMonth" "java.time.temporal.TemporalField"] ["java.time.YearMonth" "java.time.temporal.TemporalUnit"]))} (^java.lang.Boolean [this15267 G__15268] (clojure.core/cond (clojure.core/and (clojure.core/instance? java.time.temporal.TemporalField G__15268)) (clojure.core/let [G__15268 ^"java.time.temporal.TemporalField" G__15268] (.isSupported ^java.time.YearMonth this15267 G__15268)) (clojure.core/and (clojure.core/instance? java.time.temporal.ChronoUnit G__15268)) (clojure.core/let [G__15268 ^"java.time.temporal.ChronoUnit" G__15268] (.isSupported ^java.time.YearMonth this15267 G__15268)) :else (throw (java.lang.IllegalArgumentException. "no corresponding java.time method with these args"))))) -(clojure.core/defn minus-years {:arglists (quote (["java.time.YearMonth" "long"]))} (^java.time.YearMonth [^java.time.YearMonth this15269 ^long long15270] (.minusYears this15269 long15270))) -(clojure.core/defn parse {:arglists (quote (["java.lang.CharSequence" "java.time.format.DateTimeFormatter"] ["java.lang.CharSequence"]))} (^java.time.YearMonth [^java.lang.CharSequence java-lang-CharSequence15271 ^java.time.format.DateTimeFormatter java-time-format-DateTimeFormatter15272] (java.time.YearMonth/parse java-lang-CharSequence15271 java-time-format-DateTimeFormatter15272)) (^java.time.YearMonth [^java.lang.CharSequence java-lang-CharSequence15273] (java.time.YearMonth/parse java-lang-CharSequence15273))) -(clojure.core/defn hash-code {:arglists (quote (["java.time.YearMonth"]))} (^java.lang.Integer [^java.time.YearMonth this15274] (.hashCode this15274))) -(clojure.core/defn adjust-into {:arglists (quote (["java.time.YearMonth" "java.time.temporal.Temporal"]))} (^java.time.temporal.Temporal [^java.time.YearMonth this15275 ^java.time.temporal.Temporal java-time-temporal-Temporal15276] (.adjustInto this15275 java-time-temporal-Temporal15276))) -(clojure.core/defn with {:arglists (quote (["java.time.YearMonth" "java.time.temporal.TemporalField" "long"] ["java.time.YearMonth" "java.time.temporal.TemporalAdjuster"]))} (^java.time.YearMonth [^java.time.YearMonth this15277 ^java.time.temporal.TemporalField java-time-temporal-TemporalField15278 ^long long15279] (.with this15277 java-time-temporal-TemporalField15278 long15279)) (^java.time.YearMonth [^java.time.YearMonth this15280 ^java.time.temporal.TemporalAdjuster java-time-temporal-TemporalAdjuster15281] (.with this15280 java-time-temporal-TemporalAdjuster15281))) -(clojure.core/defn now {:arglists (quote ([] ["java.time.Clock"] ["java.time.ZoneId"]))} (^java.time.YearMonth [] (java.time.YearMonth/now)) (^java.time.YearMonth [G__15283] (clojure.core/cond (clojure.core/and (clojure.core/instance? java.time.Clock G__15283)) (clojure.core/let [G__15283 ^"java.time.Clock" G__15283] (java.time.YearMonth/now G__15283)) (clojure.core/and (clojure.core/instance? java.time.ZoneId G__15283)) (clojure.core/let [G__15283 ^"java.time.ZoneId" G__15283] (java.time.YearMonth/now G__15283)) :else (throw (java.lang.IllegalArgumentException. "no corresponding java.time method with these args"))))) -(clojure.core/defn get-month-value {:arglists (quote (["java.time.YearMonth"]))} (^java.lang.Integer [^java.time.YearMonth this15284] (.getMonthValue this15284))) -(clojure.core/defn compare-to {:arglists (quote (["java.time.YearMonth" "java.time.YearMonth"]))} (^java.lang.Integer [^java.time.YearMonth this15285 ^java.time.YearMonth java-time-YearMonth15286] (.compareTo this15285 java-time-YearMonth15286))) -(clojure.core/defn get-month {:arglists (quote (["java.time.YearMonth"]))} (^java.time.Month [^java.time.YearMonth this15287] (.getMonth this15287))) -(clojure.core/defn get {:arglists (quote (["java.time.YearMonth" "java.time.temporal.TemporalField"]))} (^java.lang.Integer [^java.time.YearMonth this15288 ^java.time.temporal.TemporalField java-time-temporal-TemporalField15289] (.get this15288 java-time-temporal-TemporalField15289))) -(clojure.core/defn equals {:arglists (quote (["java.time.YearMonth" "java.lang.Object"]))} (^java.lang.Boolean [^java.time.YearMonth this15290 ^java.lang.Object java-lang-Object15291] (.equals this15290 java-lang-Object15291))) -(clojure.core/defn format {:arglists (quote (["java.time.YearMonth" "java.time.format.DateTimeFormatter"]))} (^java.lang.String [^java.time.YearMonth this15292 ^java.time.format.DateTimeFormatter java-time-format-DateTimeFormatter15293] (.format this15292 java-time-format-DateTimeFormatter15293))) -(clojure.core/defn plus-years {:arglists (quote (["java.time.YearMonth" "long"]))} (^java.time.YearMonth [^java.time.YearMonth this15294 ^long long15295] (.plusYears this15294 long15295))) +(ns cljc.java-time.year-month + (:refer-clojure :exclude + [abs get range format min max next name resolve short]) + (:require [cljc.java-time.extn.calendar-awareness]) + (:import [java.time YearMonth])) + +(defn length-of-year + "Returns the length of the year. + + This returns the length of the year in days, either 365 or 366. + + @return 366 if the year is leap, 365 otherwise" + {:arglists (quote (["java.time.YearMonth"]))} + (^java.lang.Integer [^java.time.YearMonth this] (.lengthOfYear this))) + +(defn range + "Gets the range of valid values for the specified field. + + The range object expresses the minimum and maximum valid values for a field. + This year-month is used to enhance the accuracy of the returned range. + If it is not possible to return the range, because the field is not supported + or for some other reason, an exception is thrown. + + If the field is a {@link ChronoField} then the query is implemented here. + The {@link #isSupported(TemporalField) supported fields} will return + appropriate range instances. + All other {@code ChronoField} instances will throw an {@code UnsupportedTemporalTypeException}. + + If the field is not a {@code ChronoField}, then the result of this method + is obtained by invoking {@code TemporalField.rangeRefinedBy(TemporalAccessor)} + passing {@code this} as the argument. + Whether the range can be obtained is determined by the field. + + @param field the field to query the range for, not null + @return the range of valid values for the field, not null + @throws DateTimeException if the range for the field cannot be obtained + @throws UnsupportedTemporalTypeException if the field is not supported" + {:arglists (quote (["java.time.YearMonth" + "java.time.temporal.TemporalField"]))} + (^java.time.temporal.ValueRange + [^java.time.YearMonth this ^java.time.temporal.TemporalField field] + (.range this field))) + +(defn is-valid-day + "Checks if the day-of-month is valid for this year-month. + + This method checks whether this year and month and the input day form + a valid date. + + @param dayOfMonth the day-of-month to validate, from 1 to 31, invalid value returns false + @return true if the day is valid for this year-month" + {:arglists (quote (["java.time.YearMonth" "int"]))} + (^java.lang.Boolean + [^java.time.YearMonth this ^java.lang.Integer day-of-month] + (.isValidDay this day-of-month))) + +(defn of + {:arglists (quote (["int" "int"] ["int" "java.time.Month"]))} + (^java.time.YearMonth [arg0 arg1] + (cond (and (instance? java.lang.Number arg0) + (instance? java.lang.Number arg1)) + (let [year (int arg0) + month (int arg1)] + (java.time.YearMonth/of year month)) + (and (instance? java.lang.Number arg0) + (instance? java.time.Month arg1)) + (let [year (int arg0) + ^java.time.Month month arg1] + (java.time.YearMonth/of year month)) + :else (throw (java.lang.IllegalArgumentException. + "no corresponding java.time method with these args"))))) + +(defn with-month + "Returns a copy of this {@code YearMonth} with the month-of-year altered. + + This instance is immutable and unaffected by this method call. + + @param month the month-of-year to set in the returned year-month, from 1 (January) to 12 (December) + @return a {@code YearMonth} based on this year-month with the requested month, not null + @throws DateTimeException if the month-of-year value is invalid" + {:arglists (quote (["java.time.YearMonth" "int"]))} + (^java.time.YearMonth [^java.time.YearMonth this ^java.lang.Integer month] + (.withMonth this month))) + +(defn at-day + "Combines this year-month with a day-of-month to create a {@code LocalDate}. + + This returns a {@code LocalDate} formed from this year-month and the specified day-of-month. + + The day-of-month value must be valid for the year-month. + + This method can be used as part of a chain to produce a date: +
+  LocalDate date = year.atMonth(month).atDay(day);
+ 
+ + @param dayOfMonth the day-of-month to use, from 1 to 31 + @return the date formed from this year-month and the specified day, not null + @throws DateTimeException if the day is invalid for the year-month + @see #isValidDay(int)" + {:arglists (quote (["java.time.YearMonth" "int"]))} + (^java.time.LocalDate + [^java.time.YearMonth this ^java.lang.Integer day-of-month] + (.atDay this day-of-month))) + +(defn get-year + "Gets the year field. + + This method returns the primitive {@code int} value for the year. + + The year returned by this method is proleptic as per {@code get(YEAR)}. + + @return the year, from MIN_YEAR to MAX_YEAR" + {:arglists (quote (["java.time.YearMonth"]))} + (^java.lang.Integer [^java.time.YearMonth this] (.getYear this))) + +(defn plus + {:arglists (quote (["java.time.YearMonth" "java.time.temporal.TemporalAmount"] + ["java.time.YearMonth" "long" + "java.time.temporal.TemporalUnit"]))} + (^java.time.YearMonth + [^java.time.YearMonth this ^java.time.temporal.TemporalAmount amount-to-add] + (.plus this amount-to-add)) + (^java.time.YearMonth + [^java.time.YearMonth this ^long amount-to-add + ^java.time.temporal.ChronoUnit unit] + (.plus this amount-to-add unit))) + +(defn is-leap-year + "Checks if the year is a leap year, according to the ISO proleptic + calendar system rules. + + This method applies the current rules for leap years across the whole time-line. + In general, a year is a leap year if it is divisible by four without + remainder. However, years divisible by 100, are not leap years, with + the exception of years divisible by 400 which are. + + For example, 1904 is a leap year it is divisible by 4. + 1900 was not a leap year as it is divisible by 100, however 2000 was a + leap year as it is divisible by 400. + + The calculation is proleptic - applying the same rules into the far future and far past. + This is historically inaccurate, but is correct for the ISO-8601 standard. + + @return true if the year is leap, false otherwise" + {:arglists (quote (["java.time.YearMonth"]))} + (^java.lang.Boolean [^java.time.YearMonth this] (.isLeapYear this))) + +(defn query + "Queries this year-month using the specified query. + + This queries this year-month using the specified query strategy object. + The {@code TemporalQuery} object defines the logic to be used to + obtain the result. Read the documentation of the query to understand + what the result of this method will be. + + The result of this method is obtained by invoking the + {@link TemporalQuery#queryFrom(TemporalAccessor)} method on the + specified query passing {@code this} as the argument. + + @param the type of the result + @param query the query to invoke, not null + @return the query result, null may be returned (defined by the query) + @throws DateTimeException if unable to query (defined by the query) + @throws ArithmeticException if numeric overflow occurs (defined by the query)" + {:arglists (quote (["java.time.YearMonth" + "java.time.temporal.TemporalQuery"]))} + (^java.lang.Object + [^java.time.YearMonth this ^java.time.temporal.TemporalQuery query] + (.query this query))) + +(defn to-string + "Outputs this year-month as a {@code String}, such as {@code 2007-12}. + + The output will be in the format {@code uuuu-MM}: + + @return a string representation of this year-month, not null" + {:arglists (quote (["java.time.YearMonth"]))} + (^java.lang.String [^java.time.YearMonth this] (.toString this))) + +(defn plus-months + "Returns a copy of this {@code YearMonth} with the specified number of months added. + + This instance is immutable and unaffected by this method call. + + @param monthsToAdd the months to add, may be negative + @return a {@code YearMonth} based on this year-month with the months added, not null + @throws DateTimeException if the result exceeds the supported range" + {:arglists (quote (["java.time.YearMonth" "long"]))} + (^java.time.YearMonth [^java.time.YearMonth this ^long months-to-add] + (.plusMonths this months-to-add))) + +(defn is-before + "Checks if this year-month is before the specified year-month. + + @param other the other year-month to compare to, not null + @return true if this point is before the specified year-month" + {:arglists (quote (["java.time.YearMonth" "java.time.YearMonth"]))} + (^java.lang.Boolean [^java.time.YearMonth this ^java.time.YearMonth other] + (.isBefore this other))) + +(defn minus-months + "Returns a copy of this {@code YearMonth} with the specified number of months subtracted. + + This instance is immutable and unaffected by this method call. + + @param monthsToSubtract the months to subtract, may be negative + @return a {@code YearMonth} based on this year-month with the months subtracted, not null + @throws DateTimeException if the result exceeds the supported range" + {:arglists (quote (["java.time.YearMonth" "long"]))} + (^java.time.YearMonth [^java.time.YearMonth this ^long months-to-subtract] + (.minusMonths this months-to-subtract))) + +(defn minus + {:arglists (quote (["java.time.YearMonth" "java.time.temporal.TemporalAmount"] + ["java.time.YearMonth" "long" + "java.time.temporal.TemporalUnit"]))} + (^java.time.YearMonth + [^java.time.YearMonth this + ^java.time.temporal.TemporalAmount amount-to-subtract] + (.minus this amount-to-subtract)) + (^java.time.YearMonth + [^java.time.YearMonth this ^long amount-to-subtract + ^java.time.temporal.ChronoUnit unit] + (.minus this amount-to-subtract unit))) + +(defn get-long + "Gets the value of the specified field from this year-month as a {@code long}. + + This queries this year-month for the value of the specified field. + If it is not possible to return the value, because the field is not supported + or for some other reason, an exception is thrown. + + If the field is a {@link ChronoField} then the query is implemented here. + The {@link #isSupported(TemporalField) supported fields} will return valid + values based on this year-month. + All other {@code ChronoField} instances will throw an {@code UnsupportedTemporalTypeException}. + + If the field is not a {@code ChronoField}, then the result of this method + is obtained by invoking {@code TemporalField.getFrom(TemporalAccessor)} + passing {@code this} as the argument. Whether the value can be obtained, + and what the value represents, is determined by the field. + + @param field the field to get, not null + @return the value for the field + @throws DateTimeException if a value for the field cannot be obtained + @throws UnsupportedTemporalTypeException if the field is not supported + @throws ArithmeticException if numeric overflow occurs" + {:arglists (quote (["java.time.YearMonth" + "java.time.temporal.TemporalField"]))} + (^long [^java.time.YearMonth this ^java.time.temporal.TemporalField field] + (.getLong this field))) + +(defn with-year + "Returns a copy of this {@code YearMonth} with the year altered. + + This instance is immutable and unaffected by this method call. + + @param year the year to set in the returned year-month, from MIN_YEAR to MAX_YEAR + @return a {@code YearMonth} based on this year-month with the requested year, not null + @throws DateTimeException if the year value is invalid" + {:arglists (quote (["java.time.YearMonth" "int"]))} + (^java.time.YearMonth [^java.time.YearMonth this ^java.lang.Integer year] + (.withYear this year))) + +(defn at-end-of-month + "Returns a {@code LocalDate} at the end of the month. + + This returns a {@code LocalDate} based on this year-month. + The day-of-month is set to the last valid day of the month, taking + into account leap years. + + This method can be used as part of a chain to produce a date: +
+  LocalDate date = year.atMonth(month).atEndOfMonth();
+ 
+ + @return the last valid date of this year-month, not null" + {:arglists (quote (["java.time.YearMonth"]))} + (^java.time.LocalDate [^java.time.YearMonth this] (.atEndOfMonth this))) + +(defn length-of-month + "Returns the length of the month, taking account of the year. + + This returns the length of the month in days. + For example, a date in January would return 31. + + @return the length of the month in days, from 28 to 31" + {:arglists (quote (["java.time.YearMonth"]))} + (^java.lang.Integer [^java.time.YearMonth this] (.lengthOfMonth this))) + +(defn until + "Calculates the amount of time until another year-month in terms of the specified unit. + + This calculates the amount of time between two {@code YearMonth} + objects in terms of a single {@code TemporalUnit}. + The start and end points are {@code this} and the specified year-month. + The result will be negative if the end is before the start. + The {@code Temporal} passed to this method is converted to a + {@code YearMonth} using {@link #from(TemporalAccessor)}. + For example, the amount in years between two year-months can be calculated + using {@code startYearMonth.until(endYearMonth, YEARS)}. + + The calculation returns a whole number, representing the number of + complete units between the two year-months. + For example, the amount in decades between 2012-06 and 2032-05 + will only be one decade as it is one month short of two decades. + + There are two equivalent ways of using this method. + The first is to invoke this method. + The second is to use {@link TemporalUnit#between(Temporal, Temporal)}: +
+   // these two lines are equivalent
+   amount = start.until(end, MONTHS);
+   amount = MONTHS.between(start, end);
+ 
+ The choice should be made based on which makes the code more readable. + + The calculation is implemented in this method for {@link ChronoUnit}. + The units {@code MONTHS}, {@code YEARS}, {@code DECADES}, + {@code CENTURIES}, {@code MILLENNIA} and {@code ERAS} are supported. + Other {@code ChronoUnit} values will throw an exception. + + If the unit is not a {@code ChronoUnit}, then the result of this method + is obtained by invoking {@code TemporalUnit.between(Temporal, Temporal)} + passing {@code this} as the first argument and the converted input temporal + as the second argument. + + This instance is immutable and unaffected by this method call. + + @param endExclusive the end date, exclusive, which is converted to a {@code YearMonth}, not null + @param unit the unit to measure the amount in, not null + @return the amount of time between this year-month and the end year-month + @throws DateTimeException if the amount cannot be calculated, or the end + temporal cannot be converted to a {@code YearMonth} + @throws UnsupportedTemporalTypeException if the unit is not supported + @throws ArithmeticException if numeric overflow occurs" + {:arglists (quote (["java.time.YearMonth" "java.time.temporal.Temporal" + "java.time.temporal.TemporalUnit"]))} + (^long + [^java.time.YearMonth this ^java.time.temporal.Temporal end-exclusive + ^java.time.temporal.ChronoUnit unit] + (.until this end-exclusive unit))) + +(defn from + "Obtains an instance of {@code YearMonth} from a temporal object. + + This obtains a year-month based on the specified temporal. + A {@code TemporalAccessor} represents an arbitrary set of date and time information, + which this factory converts to an instance of {@code YearMonth}. + + The conversion extracts the {@link ChronoField#YEAR YEAR} and + {@link ChronoField#MONTH_OF_YEAR MONTH_OF_YEAR} fields. + The extraction is only permitted if the temporal object has an ISO + chronology, or can be converted to a {@code LocalDate}. + + This method matches the signature of the functional interface {@link TemporalQuery} + allowing it to be used as a query via method reference, {@code YearMonth::from}. + + @param temporal the temporal object to convert, not null + @return the year-month, not null + @throws DateTimeException if unable to convert to a {@code YearMonth}" + {:arglists (quote (["java.time.temporal.TemporalAccessor"]))} + (^java.time.YearMonth [^java.time.temporal.TemporalAccessor temporal] + (java.time.YearMonth/from temporal))) + +(defn is-after + "Checks if this year-month is after the specified year-month. + + @param other the other year-month to compare to, not null + @return true if this is after the specified year-month" + {:arglists (quote (["java.time.YearMonth" "java.time.YearMonth"]))} + (^java.lang.Boolean [^java.time.YearMonth this ^java.time.YearMonth other] + (.isAfter this other))) + +(defn is-supported + {:arglists (quote (["java.time.YearMonth" "java.time.temporal.TemporalField"] + ["java.time.YearMonth" + "java.time.temporal.TemporalUnit"]))} + (^java.lang.Boolean [^java.time.YearMonth this arg0] + (cond (instance? java.time.temporal.TemporalField arg0) + (let [^java.time.temporal.TemporalField field arg0] + (.isSupported this field)) + (instance? java.time.temporal.ChronoUnit arg0) + (let [^java.time.temporal.TemporalUnit unit arg0] + (.isSupported this unit)) + :else (throw (java.lang.IllegalArgumentException. + "no corresponding java.time method with these args"))))) + +(defn minus-years + "Returns a copy of this {@code YearMonth} with the specified number of years subtracted. + + This instance is immutable and unaffected by this method call. + + @param yearsToSubtract the years to subtract, may be negative + @return a {@code YearMonth} based on this year-month with the years subtracted, not null + @throws DateTimeException if the result exceeds the supported range" + {:arglists (quote (["java.time.YearMonth" "long"]))} + (^java.time.YearMonth [^java.time.YearMonth this ^long years-to-subtract] + (.minusYears this years-to-subtract))) + +(defn parse + {:arglists (quote (["java.lang.CharSequence"] + ["java.lang.CharSequence" + "java.time.format.DateTimeFormatter"]))} + (^java.time.YearMonth [^java.lang.CharSequence text] + (java.time.YearMonth/parse text)) + (^java.time.YearMonth + [^java.lang.CharSequence text ^java.time.format.DateTimeFormatter formatter] + (java.time.YearMonth/parse text formatter))) + +(defn hash-code + "A hash code for this year-month. + + @return a suitable hash code" + {:arglists (quote (["java.time.YearMonth"]))} + (^java.lang.Integer [^java.time.YearMonth this] (.hashCode this))) + +(defn adjust-into + "Adjusts the specified temporal object to have this year-month. + + This returns a temporal object of the same observable type as the input + with the year and month changed to be the same as this. + + The adjustment is equivalent to using {@link Temporal#with(TemporalField, long)} + passing {@link ChronoField#PROLEPTIC_MONTH} as the field. + If the specified temporal object does not use the ISO calendar system then + a {@code DateTimeException} is thrown. + + In most cases, it is clearer to reverse the calling pattern by using + {@link Temporal#with(TemporalAdjuster)}: +
+   // these two lines are equivalent, but the second approach is recommended
+   temporal = thisYearMonth.adjustInto(temporal);
+   temporal = temporal.with(thisYearMonth);
+ 
+ + This instance is immutable and unaffected by this method call. + + @param temporal the target object to be adjusted, not null + @return the adjusted object, not null + @throws DateTimeException if unable to make the adjustment + @throws ArithmeticException if numeric overflow occurs" + {:arglists (quote (["java.time.YearMonth" "java.time.temporal.Temporal"]))} + (^java.time.temporal.Temporal + [^java.time.YearMonth this ^java.time.temporal.Temporal temporal] + (.adjustInto this temporal))) + +(defn with + {:arglists (quote (["java.time.YearMonth" + "java.time.temporal.TemporalAdjuster"] + ["java.time.YearMonth" "java.time.temporal.TemporalField" + "long"]))} + (^java.time.YearMonth + [^java.time.YearMonth this ^java.time.temporal.TemporalAdjuster adjuster] + (.with this adjuster)) + (^java.time.YearMonth + [^java.time.YearMonth this ^java.time.temporal.TemporalField field + ^long new-value] + (.with this field new-value))) + +(defn now + {:arglists (quote ([] ["java.time.Clock"] ["java.time.ZoneId"]))} + (^java.time.YearMonth [] (java.time.YearMonth/now)) + (^java.time.YearMonth [arg0] + (cond (instance? java.time.Clock arg0) (let [^java.time.Clock clock arg0] + (java.time.YearMonth/now clock)) + (instance? java.time.ZoneId arg0) (let [^java.time.ZoneId zone arg0] + (java.time.YearMonth/now zone)) + :else (throw (java.lang.IllegalArgumentException. + "no corresponding java.time method with these args"))))) + +(defn get-month-value + "Gets the month-of-year field from 1 to 12. + + This method returns the month as an {@code int} from 1 to 12. + Application code is frequently clearer if the enum {@link Month} + is used by calling {@link #getMonth()}. + + @return the month-of-year, from 1 to 12 + @see #getMonth()" + {:arglists (quote (["java.time.YearMonth"]))} + (^java.lang.Integer [^java.time.YearMonth this] (.getMonthValue this))) + +(defn compare-to + "Compares this year-month to another year-month. + + The comparison is based first on the value of the year, then on the value of the month. + It is \"consistent with equals\", as defined by {@link Comparable}. + + @param other the other year-month to compare to, not null + @return the comparator value, negative if less, positive if greater" + {:arglists (quote (["java.time.YearMonth" "java.time.YearMonth"]))} + (^java.lang.Integer [^java.time.YearMonth this ^java.time.YearMonth other] + (.compareTo this other))) + +(defn get-month + "Gets the month-of-year field using the {@code Month} enum. + + This method returns the enum {@link Month} for the month. + This avoids confusion as to what {@code int} values mean. + If you need access to the primitive {@code int} value then the enum + provides the {@link Month#getValue() int value}. + + @return the month-of-year, not null + @see #getMonthValue()" + {:arglists (quote (["java.time.YearMonth"]))} + (^java.time.Month [^java.time.YearMonth this] (.getMonth this))) + +(defn get + "Gets the value of the specified field from this year-month as an {@code int}. + + This queries this year-month for the value of the specified field. + The returned value will always be within the valid range of values for the field. + If it is not possible to return the value, because the field is not supported + or for some other reason, an exception is thrown. + + If the field is a {@link ChronoField} then the query is implemented here. + The {@link #isSupported(TemporalField) supported fields} will return valid + values based on this year-month, except {@code PROLEPTIC_MONTH} which is too + large to fit in an {@code int} and throw a {@code DateTimeException}. + All other {@code ChronoField} instances will throw an {@code UnsupportedTemporalTypeException}. + + If the field is not a {@code ChronoField}, then the result of this method + is obtained by invoking {@code TemporalField.getFrom(TemporalAccessor)} + passing {@code this} as the argument. Whether the value can be obtained, + and what the value represents, is determined by the field. + + @param field the field to get, not null + @return the value for the field + @throws DateTimeException if a value for the field cannot be obtained or + the value is outside the range of valid values for the field + @throws UnsupportedTemporalTypeException if the field is not supported or + the range of values exceeds an {@code int} + @throws ArithmeticException if numeric overflow occurs" + {:arglists (quote (["java.time.YearMonth" + "java.time.temporal.TemporalField"]))} + (^java.lang.Integer + [^java.time.YearMonth this ^java.time.temporal.TemporalField field] + (.get this field))) + +(defn equals + "Checks if this year-month is equal to another year-month. + + The comparison is based on the time-line position of the year-months. + + @param obj the object to check, null returns false + @return true if this is equal to the other year-month" + {:arglists (quote (["java.time.YearMonth" "java.lang.Object"]))} + (^java.lang.Boolean [^java.time.YearMonth this ^java.lang.Object obj] + (.equals this obj))) + +(defn format + "Formats this year-month using the specified formatter. + + This year-month will be passed to the formatter to produce a string. + + @param formatter the formatter to use, not null + @return the formatted year-month string, not null + @throws DateTimeException if an error occurs during printing" + {:arglists (quote (["java.time.YearMonth" + "java.time.format.DateTimeFormatter"]))} + (^java.lang.String + [^java.time.YearMonth this ^java.time.format.DateTimeFormatter formatter] + (.format this formatter))) + +(defn plus-years + "Returns a copy of this {@code YearMonth} with the specified number of years added. + + This instance is immutable and unaffected by this method call. + + @param yearsToAdd the years to add, may be negative + @return a {@code YearMonth} based on this year-month with the years added, not null + @throws DateTimeException if the result exceeds the supported range" + {:arglists (quote (["java.time.YearMonth" "long"]))} + (^java.time.YearMonth [^java.time.YearMonth this ^long years-to-add] + (.plusYears this years-to-add))) diff --git a/src/cljc/java_time/year_month.cljs b/src/cljc/java_time/year_month.cljs index 033e178..d48abbc 100644 --- a/src/cljc/java_time/year_month.cljs +++ b/src/cljc/java_time/year_month.cljs @@ -1,37 +1,546 @@ -(ns cljc.java-time.year-month (:refer-clojure :exclude [abs get range format min max next name resolve short]) (:require [cljc.java-time.extn.calendar-awareness] [goog.object] [java.time :refer [YearMonth]])) -(clojure.core/defn length-of-year {:arglists (quote (["java.time.YearMonth"]))} (^int [^js/JSJoda.YearMonth this15296] (.lengthOfYear this15296))) -(clojure.core/defn range {:arglists (quote (["java.time.YearMonth" "java.time.temporal.TemporalField"]))} (^js/JSJoda.ValueRange [^js/JSJoda.YearMonth this15297 ^js/JSJoda.TemporalField java-time-temporal-TemporalField15298] (.range this15297 java-time-temporal-TemporalField15298))) -(clojure.core/defn is-valid-day {:arglists (quote (["java.time.YearMonth" "int"]))} (^boolean [^js/JSJoda.YearMonth this15299 ^int int15300] (.isValidDay this15299 int15300))) -(clojure.core/defn of {:arglists (quote (["int" "int"] ["int" "java.time.Month"]))} (^js/JSJoda.YearMonth [G__15302 G__15303] (js-invoke java.time.YearMonth "of" G__15302 G__15303))) -(clojure.core/defn with-month {:arglists (quote (["java.time.YearMonth" "int"]))} (^js/JSJoda.YearMonth [^js/JSJoda.YearMonth this15304 ^int int15305] (.withMonth this15304 int15305))) -(clojure.core/defn at-day {:arglists (quote (["java.time.YearMonth" "int"]))} (^js/JSJoda.LocalDate [^js/JSJoda.YearMonth this15306 ^int int15307] (.atDay this15306 int15307))) -(clojure.core/defn get-year {:arglists (quote (["java.time.YearMonth"]))} (^int [^js/JSJoda.YearMonth this15308] (.year this15308))) -(clojure.core/defn plus {:arglists (quote (["java.time.YearMonth" "long" "java.time.temporal.TemporalUnit"] ["java.time.YearMonth" "java.time.temporal.TemporalAmount"]))} (^js/JSJoda.YearMonth [^js/JSJoda.YearMonth this15309 ^long long15310 ^js/JSJoda.TemporalUnit java-time-temporal-TemporalUnit15311] (.plus this15309 long15310 java-time-temporal-TemporalUnit15311)) (^js/JSJoda.YearMonth [^js/JSJoda.YearMonth this15312 ^js/JSJoda.TemporalAmount java-time-temporal-TemporalAmount15313] (.plus this15312 java-time-temporal-TemporalAmount15313))) -(clojure.core/defn is-leap-year {:arglists (quote (["java.time.YearMonth"]))} (^boolean [^js/JSJoda.YearMonth this15314] (.isLeapYear this15314))) -(clojure.core/defn query {:arglists (quote (["java.time.YearMonth" "java.time.temporal.TemporalQuery"]))} (^java.lang.Object [^js/JSJoda.YearMonth this15315 ^js/JSJoda.TemporalQuery java-time-temporal-TemporalQuery15316] (.query this15315 java-time-temporal-TemporalQuery15316))) -(clojure.core/defn to-string {:arglists (quote (["java.time.YearMonth"]))} (^java.lang.String [^js/JSJoda.YearMonth this15317] (.toString this15317))) -(clojure.core/defn plus-months {:arglists (quote (["java.time.YearMonth" "long"]))} (^js/JSJoda.YearMonth [^js/JSJoda.YearMonth this15318 ^long long15319] (.plusMonths this15318 long15319))) -(clojure.core/defn is-before {:arglists (quote (["java.time.YearMonth" "java.time.YearMonth"]))} (^boolean [^js/JSJoda.YearMonth this15320 ^js/JSJoda.YearMonth java-time-YearMonth15321] (.isBefore this15320 java-time-YearMonth15321))) -(clojure.core/defn minus-months {:arglists (quote (["java.time.YearMonth" "long"]))} (^js/JSJoda.YearMonth [^js/JSJoda.YearMonth this15322 ^long long15323] (.minusMonths this15322 long15323))) -(clojure.core/defn minus {:arglists (quote (["java.time.YearMonth" "java.time.temporal.TemporalAmount"] ["java.time.YearMonth" "long" "java.time.temporal.TemporalUnit"]))} (^js/JSJoda.YearMonth [^js/JSJoda.YearMonth this15324 ^js/JSJoda.TemporalAmount java-time-temporal-TemporalAmount15325] (.minus this15324 java-time-temporal-TemporalAmount15325)) (^js/JSJoda.YearMonth [^js/JSJoda.YearMonth this15326 ^long long15327 ^js/JSJoda.TemporalUnit java-time-temporal-TemporalUnit15328] (.minus this15326 long15327 java-time-temporal-TemporalUnit15328))) -(clojure.core/defn get-long {:arglists (quote (["java.time.YearMonth" "java.time.temporal.TemporalField"]))} (^long [^js/JSJoda.YearMonth this15329 ^js/JSJoda.TemporalField java-time-temporal-TemporalField15330] (.getLong this15329 java-time-temporal-TemporalField15330))) -(clojure.core/defn with-year {:arglists (quote (["java.time.YearMonth" "int"]))} (^js/JSJoda.YearMonth [^js/JSJoda.YearMonth this15331 ^int int15332] (.withYear this15331 int15332))) -(clojure.core/defn at-end-of-month {:arglists (quote (["java.time.YearMonth"]))} (^js/JSJoda.LocalDate [^js/JSJoda.YearMonth this15333] (.atEndOfMonth this15333))) -(clojure.core/defn length-of-month {:arglists (quote (["java.time.YearMonth"]))} (^int [^js/JSJoda.YearMonth this15334] (.lengthOfMonth this15334))) -(clojure.core/defn until {:arglists (quote (["java.time.YearMonth" "java.time.temporal.Temporal" "java.time.temporal.TemporalUnit"]))} (^long [^js/JSJoda.YearMonth this15335 ^js/JSJoda.Temporal java-time-temporal-Temporal15336 ^js/JSJoda.TemporalUnit java-time-temporal-TemporalUnit15337] (.until this15335 java-time-temporal-Temporal15336 java-time-temporal-TemporalUnit15337))) -(clojure.core/defn from {:arglists (quote (["java.time.temporal.TemporalAccessor"]))} (^js/JSJoda.YearMonth [^js/JSJoda.TemporalAccessor java-time-temporal-TemporalAccessor15338] (js-invoke java.time.YearMonth "from" java-time-temporal-TemporalAccessor15338))) -(clojure.core/defn is-after {:arglists (quote (["java.time.YearMonth" "java.time.YearMonth"]))} (^boolean [^js/JSJoda.YearMonth this15339 ^js/JSJoda.YearMonth java-time-YearMonth15340] (.isAfter this15339 java-time-YearMonth15340))) -(clojure.core/defn is-supported {:arglists (quote (["java.time.YearMonth" "java.time.temporal.TemporalField"] ["java.time.YearMonth" "java.time.temporal.TemporalUnit"]))} (^boolean [this15341 G__15342] (.isSupported ^js/JSJoda.YearMonth this15341 G__15342))) -(clojure.core/defn minus-years {:arglists (quote (["java.time.YearMonth" "long"]))} (^js/JSJoda.YearMonth [^js/JSJoda.YearMonth this15343 ^long long15344] (.minusYears this15343 long15344))) -(clojure.core/defn parse {:arglists (quote (["java.lang.CharSequence" "java.time.format.DateTimeFormatter"] ["java.lang.CharSequence"]))} (^js/JSJoda.YearMonth [^java.lang.CharSequence java-lang-CharSequence15345 ^js/JSJoda.DateTimeFormatter java-time-format-DateTimeFormatter15346] (js-invoke java.time.YearMonth "parse" java-lang-CharSequence15345 java-time-format-DateTimeFormatter15346)) (^js/JSJoda.YearMonth [^java.lang.CharSequence java-lang-CharSequence15347] (js-invoke java.time.YearMonth "parse" java-lang-CharSequence15347))) -(clojure.core/defn hash-code {:arglists (quote (["java.time.YearMonth"]))} (^int [^js/JSJoda.YearMonth this15348] (.hashCode this15348))) -(clojure.core/defn adjust-into {:arglists (quote (["java.time.YearMonth" "java.time.temporal.Temporal"]))} (^js/JSJoda.Temporal [^js/JSJoda.YearMonth this15349 ^js/JSJoda.Temporal java-time-temporal-Temporal15350] (.adjustInto this15349 java-time-temporal-Temporal15350))) -(clojure.core/defn with {:arglists (quote (["java.time.YearMonth" "java.time.temporal.TemporalField" "long"] ["java.time.YearMonth" "java.time.temporal.TemporalAdjuster"]))} (^js/JSJoda.YearMonth [^js/JSJoda.YearMonth this15351 ^js/JSJoda.TemporalField java-time-temporal-TemporalField15352 ^long long15353] (.with this15351 java-time-temporal-TemporalField15352 long15353)) (^js/JSJoda.YearMonth [^js/JSJoda.YearMonth this15354 ^js/JSJoda.TemporalAdjuster java-time-temporal-TemporalAdjuster15355] (.with this15354 java-time-temporal-TemporalAdjuster15355))) -(clojure.core/defn now {:arglists (quote ([] ["java.time.Clock"] ["java.time.ZoneId"]))} (^js/JSJoda.YearMonth [] (js-invoke java.time.YearMonth "now")) (^js/JSJoda.YearMonth [G__15357] (js-invoke java.time.YearMonth "now" G__15357))) -(clojure.core/defn get-month-value {:arglists (quote (["java.time.YearMonth"]))} (^int [^js/JSJoda.YearMonth this15358] (.monthValue this15358))) -(clojure.core/defn compare-to {:arglists (quote (["java.time.YearMonth" "java.time.YearMonth"]))} (^int [^js/JSJoda.YearMonth this15359 ^js/JSJoda.YearMonth java-time-YearMonth15360] (.compareTo this15359 java-time-YearMonth15360))) -(clojure.core/defn get-month {:arglists (quote (["java.time.YearMonth"]))} (^js/JSJoda.Month [^js/JSJoda.YearMonth this15361] (.month this15361))) -(clojure.core/defn get {:arglists (quote (["java.time.YearMonth" "java.time.temporal.TemporalField"]))} (^int [^js/JSJoda.YearMonth this15362 ^js/JSJoda.TemporalField java-time-temporal-TemporalField15363] (.get this15362 java-time-temporal-TemporalField15363))) -(clojure.core/defn equals {:arglists (quote (["java.time.YearMonth" "java.lang.Object"]))} (^boolean [^js/JSJoda.YearMonth this15364 ^java.lang.Object java-lang-Object15365] (.equals this15364 java-lang-Object15365))) -(clojure.core/defn format {:arglists (quote (["java.time.YearMonth" "java.time.format.DateTimeFormatter"]))} (^java.lang.String [^js/JSJoda.YearMonth this15366 ^js/JSJoda.DateTimeFormatter java-time-format-DateTimeFormatter15367] (.format this15366 java-time-format-DateTimeFormatter15367))) -(clojure.core/defn plus-years {:arglists (quote (["java.time.YearMonth" "long"]))} (^js/JSJoda.YearMonth [^js/JSJoda.YearMonth this15368 ^long long15369] (.plusYears this15368 long15369))) +(ns cljc.java-time.year-month + (:refer-clojure :exclude + [abs get range format min max next name resolve short]) + (:require [cljc.java-time.extn.calendar-awareness] + [goog.object] + [java.time :refer [YearMonth]])) + +(defn length-of-year + "Returns the length of the year. + + This returns the length of the year in days, either 365 or 366. + + @return 366 if the year is leap, 365 otherwise" + {:arglists (quote (["java.time.YearMonth"]))} + (^int [^js/JSJoda.YearMonth this] (.lengthOfYear this))) + +(defn range + "Gets the range of valid values for the specified field. + + The range object expresses the minimum and maximum valid values for a field. + This year-month is used to enhance the accuracy of the returned range. + If it is not possible to return the range, because the field is not supported + or for some other reason, an exception is thrown. + + If the field is a {@link ChronoField} then the query is implemented here. + The {@link #isSupported(TemporalField) supported fields} will return + appropriate range instances. + All other {@code ChronoField} instances will throw an {@code UnsupportedTemporalTypeException}. + + If the field is not a {@code ChronoField}, then the result of this method + is obtained by invoking {@code TemporalField.rangeRefinedBy(TemporalAccessor)} + passing {@code this} as the argument. + Whether the range can be obtained is determined by the field. + + @param field the field to query the range for, not null + @return the range of valid values for the field, not null + @throws DateTimeException if the range for the field cannot be obtained + @throws UnsupportedTemporalTypeException if the field is not supported" + {:arglists (quote (["java.time.YearMonth" + "java.time.temporal.TemporalField"]))} + (^js/JSJoda.ValueRange + [^js/JSJoda.YearMonth this ^js/JSJoda.TemporalField field] + (.range this field))) + +(defn is-valid-day + "Checks if the day-of-month is valid for this year-month. + + This method checks whether this year and month and the input day form + a valid date. + + @param dayOfMonth the day-of-month to validate, from 1 to 31, invalid value returns false + @return true if the day is valid for this year-month" + {:arglists (quote (["java.time.YearMonth" "int"]))} + (^boolean [^js/JSJoda.YearMonth this ^int day-of-month] + (.isValidDay this day-of-month))) + +(defn of + {:arglists (quote (["int" "int"] ["int" "java.time.Month"]))} + (^js/JSJoda.YearMonth [arg0 arg1] + (js-invoke java.time.YearMonth "of" arg0 arg1))) + +(defn with-month + "Returns a copy of this {@code YearMonth} with the month-of-year altered. + + This instance is immutable and unaffected by this method call. + + @param month the month-of-year to set in the returned year-month, from 1 (January) to 12 (December) + @return a {@code YearMonth} based on this year-month with the requested month, not null + @throws DateTimeException if the month-of-year value is invalid" + {:arglists (quote (["java.time.YearMonth" "int"]))} + (^js/JSJoda.YearMonth [^js/JSJoda.YearMonth this ^int month] + (.withMonth this month))) + +(defn at-day + "Combines this year-month with a day-of-month to create a {@code LocalDate}. + + This returns a {@code LocalDate} formed from this year-month and the specified day-of-month. + + The day-of-month value must be valid for the year-month. + + This method can be used as part of a chain to produce a date: +
+  LocalDate date = year.atMonth(month).atDay(day);
+ 
+ + @param dayOfMonth the day-of-month to use, from 1 to 31 + @return the date formed from this year-month and the specified day, not null + @throws DateTimeException if the day is invalid for the year-month + @see #isValidDay(int)" + {:arglists (quote (["java.time.YearMonth" "int"]))} + (^js/JSJoda.LocalDate [^js/JSJoda.YearMonth this ^int day-of-month] + (.atDay this day-of-month))) + +(defn get-year + "Gets the year field. + + This method returns the primitive {@code int} value for the year. + + The year returned by this method is proleptic as per {@code get(YEAR)}. + + @return the year, from MIN_YEAR to MAX_YEAR" + {:arglists (quote (["java.time.YearMonth"]))} + (^int [^js/JSJoda.YearMonth this] (.year this))) + +(defn plus + {:arglists (quote (["java.time.YearMonth" "java.time.temporal.TemporalAmount"] + ["java.time.YearMonth" "long" + "java.time.temporal.TemporalUnit"]))} + (^js/JSJoda.YearMonth + [^js/JSJoda.YearMonth this ^js/JSJoda.TemporalAmount amount-to-add] + (.plus this amount-to-add)) + (^js/JSJoda.YearMonth + [^js/JSJoda.YearMonth this ^long amount-to-add ^js/JSJoda.TemporalUnit unit] + (.plus this amount-to-add unit))) + +(defn is-leap-year + "Checks if the year is a leap year, according to the ISO proleptic + calendar system rules. + + This method applies the current rules for leap years across the whole time-line. + In general, a year is a leap year if it is divisible by four without + remainder. However, years divisible by 100, are not leap years, with + the exception of years divisible by 400 which are. + + For example, 1904 is a leap year it is divisible by 4. + 1900 was not a leap year as it is divisible by 100, however 2000 was a + leap year as it is divisible by 400. + + The calculation is proleptic - applying the same rules into the far future and far past. + This is historically inaccurate, but is correct for the ISO-8601 standard. + + @return true if the year is leap, false otherwise" + {:arglists (quote (["java.time.YearMonth"]))} + (^boolean [^js/JSJoda.YearMonth this] (.isLeapYear this))) + +(defn query + "Queries this year-month using the specified query. + + This queries this year-month using the specified query strategy object. + The {@code TemporalQuery} object defines the logic to be used to + obtain the result. Read the documentation of the query to understand + what the result of this method will be. + + The result of this method is obtained by invoking the + {@link TemporalQuery#queryFrom(TemporalAccessor)} method on the + specified query passing {@code this} as the argument. + + @param the type of the result + @param query the query to invoke, not null + @return the query result, null may be returned (defined by the query) + @throws DateTimeException if unable to query (defined by the query) + @throws ArithmeticException if numeric overflow occurs (defined by the query)" + {:arglists (quote (["java.time.YearMonth" + "java.time.temporal.TemporalQuery"]))} + (^java.lang.Object [^js/JSJoda.YearMonth this ^js/JSJoda.TemporalQuery query] + (.query this query))) + +(defn to-string + "Outputs this year-month as a {@code String}, such as {@code 2007-12}. + + The output will be in the format {@code uuuu-MM}: + + @return a string representation of this year-month, not null" + {:arglists (quote (["java.time.YearMonth"]))} + (^java.lang.String [^js/JSJoda.YearMonth this] (.toString this))) + +(defn plus-months + "Returns a copy of this {@code YearMonth} with the specified number of months added. + + This instance is immutable and unaffected by this method call. + + @param monthsToAdd the months to add, may be negative + @return a {@code YearMonth} based on this year-month with the months added, not null + @throws DateTimeException if the result exceeds the supported range" + {:arglists (quote (["java.time.YearMonth" "long"]))} + (^js/JSJoda.YearMonth [^js/JSJoda.YearMonth this ^long months-to-add] + (.plusMonths this months-to-add))) + +(defn is-before + "Checks if this year-month is before the specified year-month. + + @param other the other year-month to compare to, not null + @return true if this point is before the specified year-month" + {:arglists (quote (["java.time.YearMonth" "java.time.YearMonth"]))} + (^boolean [^js/JSJoda.YearMonth this ^js/JSJoda.YearMonth other] + (.isBefore this other))) + +(defn minus-months + "Returns a copy of this {@code YearMonth} with the specified number of months subtracted. + + This instance is immutable and unaffected by this method call. + + @param monthsToSubtract the months to subtract, may be negative + @return a {@code YearMonth} based on this year-month with the months subtracted, not null + @throws DateTimeException if the result exceeds the supported range" + {:arglists (quote (["java.time.YearMonth" "long"]))} + (^js/JSJoda.YearMonth [^js/JSJoda.YearMonth this ^long months-to-subtract] + (.minusMonths this months-to-subtract))) + +(defn minus + {:arglists (quote (["java.time.YearMonth" "java.time.temporal.TemporalAmount"] + ["java.time.YearMonth" "long" + "java.time.temporal.TemporalUnit"]))} + (^js/JSJoda.YearMonth + [^js/JSJoda.YearMonth this ^js/JSJoda.TemporalAmount amount-to-subtract] + (.minus this amount-to-subtract)) + (^js/JSJoda.YearMonth + [^js/JSJoda.YearMonth this ^long amount-to-subtract + ^js/JSJoda.TemporalUnit unit] + (.minus this amount-to-subtract unit))) + +(defn get-long + "Gets the value of the specified field from this year-month as a {@code long}. + + This queries this year-month for the value of the specified field. + If it is not possible to return the value, because the field is not supported + or for some other reason, an exception is thrown. + + If the field is a {@link ChronoField} then the query is implemented here. + The {@link #isSupported(TemporalField) supported fields} will return valid + values based on this year-month. + All other {@code ChronoField} instances will throw an {@code UnsupportedTemporalTypeException}. + + If the field is not a {@code ChronoField}, then the result of this method + is obtained by invoking {@code TemporalField.getFrom(TemporalAccessor)} + passing {@code this} as the argument. Whether the value can be obtained, + and what the value represents, is determined by the field. + + @param field the field to get, not null + @return the value for the field + @throws DateTimeException if a value for the field cannot be obtained + @throws UnsupportedTemporalTypeException if the field is not supported + @throws ArithmeticException if numeric overflow occurs" + {:arglists (quote (["java.time.YearMonth" + "java.time.temporal.TemporalField"]))} + (^long [^js/JSJoda.YearMonth this ^js/JSJoda.TemporalField field] + (.getLong this field))) + +(defn with-year + "Returns a copy of this {@code YearMonth} with the year altered. + + This instance is immutable and unaffected by this method call. + + @param year the year to set in the returned year-month, from MIN_YEAR to MAX_YEAR + @return a {@code YearMonth} based on this year-month with the requested year, not null + @throws DateTimeException if the year value is invalid" + {:arglists (quote (["java.time.YearMonth" "int"]))} + (^js/JSJoda.YearMonth [^js/JSJoda.YearMonth this ^int year] + (.withYear this year))) + +(defn at-end-of-month + "Returns a {@code LocalDate} at the end of the month. + + This returns a {@code LocalDate} based on this year-month. + The day-of-month is set to the last valid day of the month, taking + into account leap years. + + This method can be used as part of a chain to produce a date: +
+  LocalDate date = year.atMonth(month).atEndOfMonth();
+ 
+ + @return the last valid date of this year-month, not null" + {:arglists (quote (["java.time.YearMonth"]))} + (^js/JSJoda.LocalDate [^js/JSJoda.YearMonth this] (.atEndOfMonth this))) + +(defn length-of-month + "Returns the length of the month, taking account of the year. + + This returns the length of the month in days. + For example, a date in January would return 31. + + @return the length of the month in days, from 28 to 31" + {:arglists (quote (["java.time.YearMonth"]))} + (^int [^js/JSJoda.YearMonth this] (.lengthOfMonth this))) + +(defn until + "Calculates the amount of time until another year-month in terms of the specified unit. + + This calculates the amount of time between two {@code YearMonth} + objects in terms of a single {@code TemporalUnit}. + The start and end points are {@code this} and the specified year-month. + The result will be negative if the end is before the start. + The {@code Temporal} passed to this method is converted to a + {@code YearMonth} using {@link #from(TemporalAccessor)}. + For example, the amount in years between two year-months can be calculated + using {@code startYearMonth.until(endYearMonth, YEARS)}. + + The calculation returns a whole number, representing the number of + complete units between the two year-months. + For example, the amount in decades between 2012-06 and 2032-05 + will only be one decade as it is one month short of two decades. + + There are two equivalent ways of using this method. + The first is to invoke this method. + The second is to use {@link TemporalUnit#between(Temporal, Temporal)}: +
+   // these two lines are equivalent
+   amount = start.until(end, MONTHS);
+   amount = MONTHS.between(start, end);
+ 
+ The choice should be made based on which makes the code more readable. + + The calculation is implemented in this method for {@link ChronoUnit}. + The units {@code MONTHS}, {@code YEARS}, {@code DECADES}, + {@code CENTURIES}, {@code MILLENNIA} and {@code ERAS} are supported. + Other {@code ChronoUnit} values will throw an exception. + + If the unit is not a {@code ChronoUnit}, then the result of this method + is obtained by invoking {@code TemporalUnit.between(Temporal, Temporal)} + passing {@code this} as the first argument and the converted input temporal + as the second argument. + + This instance is immutable and unaffected by this method call. + + @param endExclusive the end date, exclusive, which is converted to a {@code YearMonth}, not null + @param unit the unit to measure the amount in, not null + @return the amount of time between this year-month and the end year-month + @throws DateTimeException if the amount cannot be calculated, or the end + temporal cannot be converted to a {@code YearMonth} + @throws UnsupportedTemporalTypeException if the unit is not supported + @throws ArithmeticException if numeric overflow occurs" + {:arglists (quote (["java.time.YearMonth" "java.time.temporal.Temporal" + "java.time.temporal.TemporalUnit"]))} + (^long + [^js/JSJoda.YearMonth this ^js/JSJoda.Temporal end-exclusive + ^js/JSJoda.TemporalUnit unit] + (.until this end-exclusive unit))) + +(defn from + "Obtains an instance of {@code YearMonth} from a temporal object. + + This obtains a year-month based on the specified temporal. + A {@code TemporalAccessor} represents an arbitrary set of date and time information, + which this factory converts to an instance of {@code YearMonth}. + + The conversion extracts the {@link ChronoField#YEAR YEAR} and + {@link ChronoField#MONTH_OF_YEAR MONTH_OF_YEAR} fields. + The extraction is only permitted if the temporal object has an ISO + chronology, or can be converted to a {@code LocalDate}. + + This method matches the signature of the functional interface {@link TemporalQuery} + allowing it to be used as a query via method reference, {@code YearMonth::from}. + + @param temporal the temporal object to convert, not null + @return the year-month, not null + @throws DateTimeException if unable to convert to a {@code YearMonth}" + {:arglists (quote (["java.time.temporal.TemporalAccessor"]))} + (^js/JSJoda.YearMonth [^js/JSJoda.TemporalAccessor temporal] + (js-invoke java.time.YearMonth "from" temporal))) + +(defn is-after + "Checks if this year-month is after the specified year-month. + + @param other the other year-month to compare to, not null + @return true if this is after the specified year-month" + {:arglists (quote (["java.time.YearMonth" "java.time.YearMonth"]))} + (^boolean [^js/JSJoda.YearMonth this ^js/JSJoda.YearMonth other] + (.isAfter this other))) + +(defn is-supported + {:arglists (quote (["java.time.YearMonth" "java.time.temporal.TemporalField"] + ["java.time.YearMonth" + "java.time.temporal.TemporalUnit"]))} + (^boolean [^js/JSJoda.YearMonth this arg0] + (.isSupported ^js/JSJoda.YearMonth this arg0))) + +(defn minus-years + "Returns a copy of this {@code YearMonth} with the specified number of years subtracted. + + This instance is immutable and unaffected by this method call. + + @param yearsToSubtract the years to subtract, may be negative + @return a {@code YearMonth} based on this year-month with the years subtracted, not null + @throws DateTimeException if the result exceeds the supported range" + {:arglists (quote (["java.time.YearMonth" "long"]))} + (^js/JSJoda.YearMonth [^js/JSJoda.YearMonth this ^long years-to-subtract] + (.minusYears this years-to-subtract))) + +(defn parse + {:arglists (quote (["java.lang.CharSequence"] + ["java.lang.CharSequence" + "java.time.format.DateTimeFormatter"]))} + (^js/JSJoda.YearMonth [^java.lang.CharSequence text] + (js-invoke java.time.YearMonth "parse" text)) + (^js/JSJoda.YearMonth + [^java.lang.CharSequence text ^js/JSJoda.DateTimeFormatter formatter] + (js-invoke java.time.YearMonth "parse" text formatter))) + +(defn hash-code + "A hash code for this year-month. + + @return a suitable hash code" + {:arglists (quote (["java.time.YearMonth"]))} + (^int [^js/JSJoda.YearMonth this] (.hashCode this))) + +(defn adjust-into + "Adjusts the specified temporal object to have this year-month. + + This returns a temporal object of the same observable type as the input + with the year and month changed to be the same as this. + + The adjustment is equivalent to using {@link Temporal#with(TemporalField, long)} + passing {@link ChronoField#PROLEPTIC_MONTH} as the field. + If the specified temporal object does not use the ISO calendar system then + a {@code DateTimeException} is thrown. + + In most cases, it is clearer to reverse the calling pattern by using + {@link Temporal#with(TemporalAdjuster)}: +
+   // these two lines are equivalent, but the second approach is recommended
+   temporal = thisYearMonth.adjustInto(temporal);
+   temporal = temporal.with(thisYearMonth);
+ 
+ + This instance is immutable and unaffected by this method call. + + @param temporal the target object to be adjusted, not null + @return the adjusted object, not null + @throws DateTimeException if unable to make the adjustment + @throws ArithmeticException if numeric overflow occurs" + {:arglists (quote (["java.time.YearMonth" "java.time.temporal.Temporal"]))} + (^js/JSJoda.Temporal [^js/JSJoda.YearMonth this ^js/JSJoda.Temporal temporal] + (.adjustInto this temporal))) + +(defn with + {:arglists (quote (["java.time.YearMonth" + "java.time.temporal.TemporalAdjuster"] + ["java.time.YearMonth" "java.time.temporal.TemporalField" + "long"]))} + (^js/JSJoda.YearMonth + [^js/JSJoda.YearMonth this ^js/JSJoda.TemporalAdjuster adjuster] + (.with this adjuster)) + (^js/JSJoda.YearMonth + [^js/JSJoda.YearMonth this ^js/JSJoda.TemporalField field ^long new-value] + (.with this field new-value))) + +(defn now + {:arglists (quote ([] ["java.time.Clock"] ["java.time.ZoneId"]))} + (^js/JSJoda.YearMonth [] (js-invoke java.time.YearMonth "now")) + (^js/JSJoda.YearMonth [arg0] (js-invoke java.time.YearMonth "now" arg0))) + +(defn get-month-value + "Gets the month-of-year field from 1 to 12. + + This method returns the month as an {@code int} from 1 to 12. + Application code is frequently clearer if the enum {@link Month} + is used by calling {@link #getMonth()}. + + @return the month-of-year, from 1 to 12 + @see #getMonth()" + {:arglists (quote (["java.time.YearMonth"]))} + (^int [^js/JSJoda.YearMonth this] (.monthValue this))) + +(defn compare-to + "Compares this year-month to another year-month. + + The comparison is based first on the value of the year, then on the value of the month. + It is \"consistent with equals\", as defined by {@link Comparable}. + + @param other the other year-month to compare to, not null + @return the comparator value, negative if less, positive if greater" + {:arglists (quote (["java.time.YearMonth" "java.time.YearMonth"]))} + (^int [^js/JSJoda.YearMonth this ^js/JSJoda.YearMonth other] + (.compareTo this other))) + +(defn get-month + "Gets the month-of-year field using the {@code Month} enum. + + This method returns the enum {@link Month} for the month. + This avoids confusion as to what {@code int} values mean. + If you need access to the primitive {@code int} value then the enum + provides the {@link Month#getValue() int value}. + + @return the month-of-year, not null + @see #getMonthValue()" + {:arglists (quote (["java.time.YearMonth"]))} + (^js/JSJoda.Month [^js/JSJoda.YearMonth this] (.month this))) + +(defn get + "Gets the value of the specified field from this year-month as an {@code int}. + + This queries this year-month for the value of the specified field. + The returned value will always be within the valid range of values for the field. + If it is not possible to return the value, because the field is not supported + or for some other reason, an exception is thrown. + + If the field is a {@link ChronoField} then the query is implemented here. + The {@link #isSupported(TemporalField) supported fields} will return valid + values based on this year-month, except {@code PROLEPTIC_MONTH} which is too + large to fit in an {@code int} and throw a {@code DateTimeException}. + All other {@code ChronoField} instances will throw an {@code UnsupportedTemporalTypeException}. + + If the field is not a {@code ChronoField}, then the result of this method + is obtained by invoking {@code TemporalField.getFrom(TemporalAccessor)} + passing {@code this} as the argument. Whether the value can be obtained, + and what the value represents, is determined by the field. + + @param field the field to get, not null + @return the value for the field + @throws DateTimeException if a value for the field cannot be obtained or + the value is outside the range of valid values for the field + @throws UnsupportedTemporalTypeException if the field is not supported or + the range of values exceeds an {@code int} + @throws ArithmeticException if numeric overflow occurs" + {:arglists (quote (["java.time.YearMonth" + "java.time.temporal.TemporalField"]))} + (^int [^js/JSJoda.YearMonth this ^js/JSJoda.TemporalField field] + (.get this field))) + +(defn equals + "Checks if this year-month is equal to another year-month. + + The comparison is based on the time-line position of the year-months. + + @param obj the object to check, null returns false + @return true if this is equal to the other year-month" + {:arglists (quote (["java.time.YearMonth" "java.lang.Object"]))} + (^boolean [^js/JSJoda.YearMonth this ^java.lang.Object obj] + (.equals this obj))) + +(defn format + "Formats this year-month using the specified formatter. + + This year-month will be passed to the formatter to produce a string. + + @param formatter the formatter to use, not null + @return the formatted year-month string, not null + @throws DateTimeException if an error occurs during printing" + {:arglists (quote (["java.time.YearMonth" + "java.time.format.DateTimeFormatter"]))} + (^java.lang.String + [^js/JSJoda.YearMonth this ^js/JSJoda.DateTimeFormatter formatter] + (.format this formatter))) + +(defn plus-years + "Returns a copy of this {@code YearMonth} with the specified number of years added. + + This instance is immutable and unaffected by this method call. + + @param yearsToAdd the years to add, may be negative + @return a {@code YearMonth} based on this year-month with the years added, not null + @throws DateTimeException if the result exceeds the supported range" + {:arglists (quote (["java.time.YearMonth" "long"]))} + (^js/JSJoda.YearMonth [^js/JSJoda.YearMonth this ^long years-to-add] + (.plusYears this years-to-add))) diff --git a/src/cljc/java_time/zone_id.clj b/src/cljc/java_time/zone_id.clj index 3adb5b0..43398e0 100644 --- a/src/cljc/java_time/zone_id.clj +++ b/src/cljc/java_time/zone_id.clj @@ -1,14 +1,215 @@ -(ns cljc.java-time.zone-id (:refer-clojure :exclude [abs get range format min max next name resolve short]) (:require [cljc.java-time.extn.calendar-awareness]) (:import [java.time ZoneId])) -(def short-ids java.time.ZoneId/SHORT_IDS) -(clojure.core/defn get-available-zone-ids {:arglists (quote ([]))} (^java.util.Set [] (java.time.ZoneId/getAvailableZoneIds))) -(clojure.core/defn of {:arglists (quote (["java.lang.String" "java.util.Map"] ["java.lang.String"]))} (^java.time.ZoneId [^java.lang.String java-lang-String14472 ^java.util.Map java-util-Map14473] (java.time.ZoneId/of java-lang-String14472 java-util-Map14473)) (^java.time.ZoneId [^java.lang.String java-lang-String14474] (java.time.ZoneId/of java-lang-String14474))) -(clojure.core/defn of-offset {:arglists (quote (["java.lang.String" "java.time.ZoneOffset"]))} (^java.time.ZoneId [^java.lang.String java-lang-String14475 ^java.time.ZoneOffset java-time-ZoneOffset14476] (java.time.ZoneId/ofOffset java-lang-String14475 java-time-ZoneOffset14476))) -(clojure.core/defn to-string {:arglists (quote (["java.time.ZoneId"]))} (^java.lang.String [^java.time.ZoneId this14477] (.toString this14477))) -(clojure.core/defn get-display-name {:arglists (quote (["java.time.ZoneId" "java.time.format.TextStyle" "java.util.Locale"]))} (^java.lang.String [^java.time.ZoneId this14478 ^java.time.format.TextStyle java-time-format-TextStyle14479 ^java.util.Locale java-util-Locale14480] (.getDisplayName this14478 java-time-format-TextStyle14479 java-util-Locale14480))) -(clojure.core/defn get-rules {:arglists (quote (["java.time.ZoneId"]))} (^java.time.zone.ZoneRules [^java.time.ZoneId this14481] (.getRules this14481))) -(clojure.core/defn get-id {:arglists (quote (["java.time.ZoneId"]))} (^java.lang.String [^java.time.ZoneId this14482] (.getId this14482))) -(clojure.core/defn normalized {:arglists (quote (["java.time.ZoneId"]))} (^java.time.ZoneId [^java.time.ZoneId this14483] (.normalized this14483))) -(clojure.core/defn system-default {:arglists (quote ([]))} (^java.time.ZoneId [] (java.time.ZoneId/systemDefault))) -(clojure.core/defn from {:arglists (quote (["java.time.temporal.TemporalAccessor"]))} (^java.time.ZoneId [^java.time.temporal.TemporalAccessor java-time-temporal-TemporalAccessor14484] (java.time.ZoneId/from java-time-temporal-TemporalAccessor14484))) -(clojure.core/defn hash-code {:arglists (quote (["java.time.ZoneId"]))} (^java.lang.Integer [^java.time.ZoneId this14485] (.hashCode this14485))) -(clojure.core/defn equals {:arglists (quote (["java.time.ZoneId" "java.lang.Object"]))} (^java.lang.Boolean [^java.time.ZoneId this14486 ^java.lang.Object java-lang-Object14487] (.equals this14486 java-lang-Object14487))) +(ns cljc.java-time.zone-id + (:refer-clojure :exclude + [abs get range format min max next name resolve short]) + (:require [cljc.java-time.extn.calendar-awareness]) + (:import [java.time ZoneId])) + +(def short-ids + "A map of zone overrides to enable the short time-zone names to be used. + + Use of short zone IDs has been deprecated in {@code java.util.TimeZone}. + This map allows the IDs to continue to be used via the + {@link #of(String, Map)} factory method. + + This map contains a mapping of the IDs that is in line with TZDB 2005r and + later, where 'EST', 'MST' and 'HST' map to IDs which do not include daylight + savings. + + This maps as follows: +
    +
  • EST - -05:00
  • +
  • HST - -10:00
  • +
  • MST - -07:00
  • +
  • ACT - Australia/Darwin
  • +
  • AET - Australia/Sydney
  • +
  • AGT - America/Argentina/Buenos_Aires
  • +
  • ART - Africa/Cairo
  • +
  • AST - America/Anchorage
  • +
  • BET - America/Sao_Paulo
  • +
  • BST - Asia/Dhaka
  • +
  • CAT - Africa/Harare
  • +
  • CNT - America/St_Johns
  • +
  • CST - America/Chicago
  • +
  • CTT - Asia/Shanghai
  • +
  • EAT - Africa/Addis_Ababa
  • +
  • ECT - Europe/Paris
  • +
  • IET - America/Indiana/Indianapolis
  • +
  • IST - Asia/Kolkata
  • +
  • JST - Asia/Tokyo
  • +
  • MIT - Pacific/Apia
  • +
  • NET - Asia/Yerevan
  • +
  • NST - Pacific/Auckland
  • +
  • PLT - Asia/Karachi
  • +
  • PNT - America/Phoenix
  • +
  • PRT - America/Puerto_Rico
  • +
  • PST - America/Los_Angeles
  • +
  • SST - Pacific/Guadalcanal
  • +
  • VST - Asia/Ho_Chi_Minh
  • +
+ The map is unmodifiable." + java.time.ZoneId/SHORT_IDS) + +(defn get-available-zone-ids + "Gets the set of available zone IDs. + + This set includes the string form of all available region-based IDs. + Offset-based zone IDs are not included in the returned set. + The ID can be passed to {@link #of(String)} to create a {@code ZoneId}. + + The set of zone IDs can increase over time, although in a typical application + the set of IDs is fixed. Each call to this method is thread-safe. + + @return a modifiable copy of the set of zone IDs, not null" + {:arglists (quote ([]))} + (^java.util.Set [] (java.time.ZoneId/getAvailableZoneIds))) + +(defn of + {:arglists (quote (["java.lang.String"] + ["java.lang.String" "java.util.Map"]))} + (^java.time.ZoneId [^java.lang.String zone-id] (java.time.ZoneId/of zone-id)) + (^java.time.ZoneId [^java.lang.String zone-id ^java.util.Map alias-map] + (java.time.ZoneId/of zone-id alias-map))) + +(defn of-offset + "Obtains an instance of {@code ZoneId} wrapping an offset. + + If the prefix is \"GMT\", \"UTC\", or \"UT\" a {@code ZoneId} + with the prefix and the non-zero offset is returned. + If the prefix is empty {@code \"\"} the {@code ZoneOffset} is returned. + + @param prefix the time-zone ID, not null + @param offset the offset, not null + @return the zone ID, not null + @throws IllegalArgumentException if the prefix is not one of + \"GMT\", \"UTC\", or \"UT\", or \"\"" + {:arglists (quote (["java.lang.String" "java.time.ZoneOffset"]))} + (^java.time.ZoneId [^java.lang.String prefix ^java.time.ZoneOffset offset] + (java.time.ZoneId/ofOffset prefix offset))) + +(defn to-string + "Outputs this zone as a {@code String}, using the ID. + + @return a string representation of this time-zone ID, not null" + {:arglists (quote (["java.time.ZoneId"]))} + (^java.lang.String [^java.time.ZoneId this] (.toString this))) + +(defn get-display-name + "Gets the textual representation of the zone, such as 'British Time' or + '+02:00'. + + This returns the textual name used to identify the time-zone ID, + suitable for presentation to the user. + The parameters control the style of the returned text and the locale. + + If no textual mapping is found then the {@link #getId() full ID} is returned. + + @param style the length of the text required, not null + @param locale the locale to use, not null + @return the text value of the zone, not null" + {:arglists (quote (["java.time.ZoneId" "java.time.format.TextStyle" + "java.util.Locale"]))} + (^java.lang.String + [^java.time.ZoneId this ^java.time.format.TextStyle style + ^java.util.Locale locale] + (.getDisplayName this style locale))) + +(defn get-rules + "Gets the time-zone rules for this ID allowing calculations to be performed. + + The rules provide the functionality associated with a time-zone, + such as finding the offset for a given instant or local date-time. + + A time-zone can be invalid if it is deserialized in a Java Runtime which + does not have the same rules loaded as the Java Runtime that stored it. + In this case, calling this method will throw a {@code ZoneRulesException}. + + The rules are supplied by {@link ZoneRulesProvider}. An advanced provider may + support dynamic updates to the rules without restarting the Java Runtime. + If so, then the result of this method may change over time. + Each individual call will be still remain thread-safe. + + {@link ZoneOffset} will always return a set of rules where the offset never changes. + + @return the rules, not null + @throws ZoneRulesException if no rules are available for this ID" + {:arglists (quote (["java.time.ZoneId"]))} + (^java.time.zone.ZoneRules [^java.time.ZoneId this] (.getRules this))) + +(defn get-id + "Gets the unique time-zone ID. + + This ID uniquely defines this object. + The format of an offset based ID is defined by {@link ZoneOffset#getId()}. + + @return the time-zone unique ID, not null" + {:arglists (quote (["java.time.ZoneId"]))} + (^java.lang.String [^java.time.ZoneId this] (.getId this))) + +(defn normalized + "Normalizes the time-zone ID, returning a {@code ZoneOffset} where possible. + + The returns a normalized {@code ZoneId} that can be used in place of this ID. + The result will have {@code ZoneRules} equivalent to those returned by this object, + however the ID returned by {@code getId()} may be different. + + The normalization checks if the rules of this {@code ZoneId} have a fixed offset. + If they do, then the {@code ZoneOffset} equal to that offset is returned. + Otherwise {@code this} is returned. + + @return the time-zone unique ID, not null" + {:arglists (quote (["java.time.ZoneId"]))} + (^java.time.ZoneId [^java.time.ZoneId this] (.normalized this))) + +(defn system-default + "Gets the system default time-zone. + + This queries {@link TimeZone#getDefault()} to find the default time-zone + and converts it to a {@code ZoneId}. If the system default time-zone is changed, + then the result of this method will also change. + + @return the zone ID, not null + @throws DateTimeException if the converted zone ID has an invalid format + @throws ZoneRulesException if the converted zone region ID cannot be found" + {:arglists (quote ([]))} + (^java.time.ZoneId [] (java.time.ZoneId/systemDefault))) + +(defn from + "Obtains an instance of {@code ZoneId} from a temporal object. + + This obtains a zone based on the specified temporal. + A {@code TemporalAccessor} represents an arbitrary set of date and time information, + which this factory converts to an instance of {@code ZoneId}. + + A {@code TemporalAccessor} represents some form of date and time information. + This factory converts the arbitrary temporal object to an instance of {@code ZoneId}. + + The conversion will try to obtain the zone in a way that favours region-based + zones over offset-based zones using {@link TemporalQueries#zone()}. + + This method matches the signature of the functional interface {@link TemporalQuery} + allowing it to be used as a query via method reference, {@code ZoneId::from}. + + @param temporal the temporal object to convert, not null + @return the zone ID, not null + @throws DateTimeException if unable to convert to a {@code ZoneId}" + {:arglists (quote (["java.time.temporal.TemporalAccessor"]))} + (^java.time.ZoneId [^java.time.temporal.TemporalAccessor temporal] + (java.time.ZoneId/from temporal))) + +(defn hash-code + "A hash code for this time-zone ID. + + @return a suitable hash code" + {:arglists (quote (["java.time.ZoneId"]))} + (^java.lang.Integer [^java.time.ZoneId this] (.hashCode this))) + +(defn equals + "Checks if this time-zone ID is equal to another time-zone ID. + + The comparison is based on the ID. + + @param obj the object to check, null returns false + @return true if this is equal to the other time-zone ID" + {:arglists (quote (["java.time.ZoneId" "java.lang.Object"]))} + (^java.lang.Boolean [^java.time.ZoneId this ^java.lang.Object obj] + (.equals this obj))) diff --git a/src/cljc/java_time/zone_id.cljs b/src/cljc/java_time/zone_id.cljs index c6f1281..b0e065f 100644 --- a/src/cljc/java_time/zone_id.cljs +++ b/src/cljc/java_time/zone_id.cljs @@ -1,14 +1,215 @@ -(ns cljc.java-time.zone-id (:refer-clojure :exclude [abs get range format min max next name resolve short]) (:require [cljc.java-time.extn.calendar-awareness] [goog.object] [java.time :refer [ZoneId]])) -(def short-ids (goog.object/get java.time.ZoneId "SHORT_IDS")) -(clojure.core/defn get-available-zone-ids {:arglists (quote ([]))} (^java.util.Set [] (js-invoke java.time.ZoneId "getAvailableZoneIds"))) -(clojure.core/defn of {:arglists (quote (["java.lang.String" "java.util.Map"] ["java.lang.String"]))} (^js/JSJoda.ZoneId [^java.lang.String java-lang-String14488 ^java.util.Map java-util-Map14489] (js-invoke java.time.ZoneId "of" java-lang-String14488 java-util-Map14489)) (^js/JSJoda.ZoneId [^java.lang.String java-lang-String14490] (js-invoke java.time.ZoneId "of" java-lang-String14490))) -(clojure.core/defn of-offset {:arglists (quote (["java.lang.String" "java.time.ZoneOffset"]))} (^js/JSJoda.ZoneId [^java.lang.String java-lang-String14491 ^js/JSJoda.ZoneOffset java-time-ZoneOffset14492] (js-invoke java.time.ZoneId "ofOffset" java-lang-String14491 java-time-ZoneOffset14492))) -(clojure.core/defn to-string {:arglists (quote (["java.time.ZoneId"]))} (^java.lang.String [^js/JSJoda.ZoneId this14493] (.toString this14493))) -(clojure.core/defn get-display-name {:arglists (quote (["java.time.ZoneId" "java.time.format.TextStyle" "java.util.Locale"]))} (^java.lang.String [^js/JSJoda.ZoneId this14494 ^js/JSJoda.TextStyle java-time-format-TextStyle14495 ^java.util.Locale java-util-Locale14496] (.displayName this14494 java-time-format-TextStyle14495 java-util-Locale14496))) -(clojure.core/defn get-rules {:arglists (quote (["java.time.ZoneId"]))} (^js/JSJoda.ZoneRules [^js/JSJoda.ZoneId this14497] (.rules this14497))) -(clojure.core/defn get-id {:arglists (quote (["java.time.ZoneId"]))} (^java.lang.String [^js/JSJoda.ZoneId this14498] (.id this14498))) -(clojure.core/defn normalized {:arglists (quote (["java.time.ZoneId"]))} (^js/JSJoda.ZoneId [^js/JSJoda.ZoneId this14499] (.normalized this14499))) -(clojure.core/defn system-default {:arglists (quote ([]))} (^js/JSJoda.ZoneId [] (js-invoke java.time.ZoneId "systemDefault"))) -(clojure.core/defn from {:arglists (quote (["java.time.temporal.TemporalAccessor"]))} (^js/JSJoda.ZoneId [^js/JSJoda.TemporalAccessor java-time-temporal-TemporalAccessor14500] (js-invoke java.time.ZoneId "from" java-time-temporal-TemporalAccessor14500))) -(clojure.core/defn hash-code {:arglists (quote (["java.time.ZoneId"]))} (^int [^js/JSJoda.ZoneId this14501] (.hashCode this14501))) -(clojure.core/defn equals {:arglists (quote (["java.time.ZoneId" "java.lang.Object"]))} (^boolean [^js/JSJoda.ZoneId this14502 ^java.lang.Object java-lang-Object14503] (.equals this14502 java-lang-Object14503))) +(ns cljc.java-time.zone-id + (:refer-clojure :exclude + [abs get range format min max next name resolve short]) + (:require [cljc.java-time.extn.calendar-awareness] + [goog.object] + [java.time :refer [ZoneId]])) + +(def short-ids + "A map of zone overrides to enable the short time-zone names to be used. + + Use of short zone IDs has been deprecated in {@code java.util.TimeZone}. + This map allows the IDs to continue to be used via the + {@link #of(String, Map)} factory method. + + This map contains a mapping of the IDs that is in line with TZDB 2005r and + later, where 'EST', 'MST' and 'HST' map to IDs which do not include daylight + savings. + + This maps as follows: +
    +
  • EST - -05:00
  • +
  • HST - -10:00
  • +
  • MST - -07:00
  • +
  • ACT - Australia/Darwin
  • +
  • AET - Australia/Sydney
  • +
  • AGT - America/Argentina/Buenos_Aires
  • +
  • ART - Africa/Cairo
  • +
  • AST - America/Anchorage
  • +
  • BET - America/Sao_Paulo
  • +
  • BST - Asia/Dhaka
  • +
  • CAT - Africa/Harare
  • +
  • CNT - America/St_Johns
  • +
  • CST - America/Chicago
  • +
  • CTT - Asia/Shanghai
  • +
  • EAT - Africa/Addis_Ababa
  • +
  • ECT - Europe/Paris
  • +
  • IET - America/Indiana/Indianapolis
  • +
  • IST - Asia/Kolkata
  • +
  • JST - Asia/Tokyo
  • +
  • MIT - Pacific/Apia
  • +
  • NET - Asia/Yerevan
  • +
  • NST - Pacific/Auckland
  • +
  • PLT - Asia/Karachi
  • +
  • PNT - America/Phoenix
  • +
  • PRT - America/Puerto_Rico
  • +
  • PST - America/Los_Angeles
  • +
  • SST - Pacific/Guadalcanal
  • +
  • VST - Asia/Ho_Chi_Minh
  • +
+ The map is unmodifiable." + (goog.object/get java.time.ZoneId "SHORT_IDS")) + +(defn get-available-zone-ids + "Gets the set of available zone IDs. + + This set includes the string form of all available region-based IDs. + Offset-based zone IDs are not included in the returned set. + The ID can be passed to {@link #of(String)} to create a {@code ZoneId}. + + The set of zone IDs can increase over time, although in a typical application + the set of IDs is fixed. Each call to this method is thread-safe. + + @return a modifiable copy of the set of zone IDs, not null" + {:arglists (quote ([]))} + (^java.util.Set [] (js-invoke java.time.ZoneId "getAvailableZoneIds"))) + +(defn of + {:arglists (quote (["java.lang.String"] + ["java.lang.String" "java.util.Map"]))} + (^js/JSJoda.ZoneId [^java.lang.String zone-id] + (js-invoke java.time.ZoneId "of" zone-id)) + (^js/JSJoda.ZoneId [^java.lang.String zone-id ^java.util.Map alias-map] + (js-invoke java.time.ZoneId "of" zone-id alias-map))) + +(defn of-offset + "Obtains an instance of {@code ZoneId} wrapping an offset. + + If the prefix is \"GMT\", \"UTC\", or \"UT\" a {@code ZoneId} + with the prefix and the non-zero offset is returned. + If the prefix is empty {@code \"\"} the {@code ZoneOffset} is returned. + + @param prefix the time-zone ID, not null + @param offset the offset, not null + @return the zone ID, not null + @throws IllegalArgumentException if the prefix is not one of + \"GMT\", \"UTC\", or \"UT\", or \"\"" + {:arglists (quote (["java.lang.String" "java.time.ZoneOffset"]))} + (^js/JSJoda.ZoneId [^java.lang.String prefix ^js/JSJoda.ZoneOffset offset] + (js-invoke java.time.ZoneId "ofOffset" prefix offset))) + +(defn to-string + "Outputs this zone as a {@code String}, using the ID. + + @return a string representation of this time-zone ID, not null" + {:arglists (quote (["java.time.ZoneId"]))} + (^java.lang.String [^js/JSJoda.ZoneId this] (.toString this))) + +(defn get-display-name + "Gets the textual representation of the zone, such as 'British Time' or + '+02:00'. + + This returns the textual name used to identify the time-zone ID, + suitable for presentation to the user. + The parameters control the style of the returned text and the locale. + + If no textual mapping is found then the {@link #getId() full ID} is returned. + + @param style the length of the text required, not null + @param locale the locale to use, not null + @return the text value of the zone, not null" + {:arglists (quote (["java.time.ZoneId" "java.time.format.TextStyle" + "java.util.Locale"]))} + (^java.lang.String + [^js/JSJoda.ZoneId this ^js/JSJoda.TextStyle style ^java.util.Locale locale] + (.displayName this style locale))) + +(defn get-rules + "Gets the time-zone rules for this ID allowing calculations to be performed. + + The rules provide the functionality associated with a time-zone, + such as finding the offset for a given instant or local date-time. + + A time-zone can be invalid if it is deserialized in a Java Runtime which + does not have the same rules loaded as the Java Runtime that stored it. + In this case, calling this method will throw a {@code ZoneRulesException}. + + The rules are supplied by {@link ZoneRulesProvider}. An advanced provider may + support dynamic updates to the rules without restarting the Java Runtime. + If so, then the result of this method may change over time. + Each individual call will be still remain thread-safe. + + {@link ZoneOffset} will always return a set of rules where the offset never changes. + + @return the rules, not null + @throws ZoneRulesException if no rules are available for this ID" + {:arglists (quote (["java.time.ZoneId"]))} + (^js/JSJoda.ZoneRules [^js/JSJoda.ZoneId this] (.rules this))) + +(defn get-id + "Gets the unique time-zone ID. + + This ID uniquely defines this object. + The format of an offset based ID is defined by {@link ZoneOffset#getId()}. + + @return the time-zone unique ID, not null" + {:arglists (quote (["java.time.ZoneId"]))} + (^java.lang.String [^js/JSJoda.ZoneId this] (.id this))) + +(defn normalized + "Normalizes the time-zone ID, returning a {@code ZoneOffset} where possible. + + The returns a normalized {@code ZoneId} that can be used in place of this ID. + The result will have {@code ZoneRules} equivalent to those returned by this object, + however the ID returned by {@code getId()} may be different. + + The normalization checks if the rules of this {@code ZoneId} have a fixed offset. + If they do, then the {@code ZoneOffset} equal to that offset is returned. + Otherwise {@code this} is returned. + + @return the time-zone unique ID, not null" + {:arglists (quote (["java.time.ZoneId"]))} + (^js/JSJoda.ZoneId [^js/JSJoda.ZoneId this] (.normalized this))) + +(defn system-default + "Gets the system default time-zone. + + This queries {@link TimeZone#getDefault()} to find the default time-zone + and converts it to a {@code ZoneId}. If the system default time-zone is changed, + then the result of this method will also change. + + @return the zone ID, not null + @throws DateTimeException if the converted zone ID has an invalid format + @throws ZoneRulesException if the converted zone region ID cannot be found" + {:arglists (quote ([]))} + (^js/JSJoda.ZoneId [] (js-invoke java.time.ZoneId "systemDefault"))) + +(defn from + "Obtains an instance of {@code ZoneId} from a temporal object. + + This obtains a zone based on the specified temporal. + A {@code TemporalAccessor} represents an arbitrary set of date and time information, + which this factory converts to an instance of {@code ZoneId}. + + A {@code TemporalAccessor} represents some form of date and time information. + This factory converts the arbitrary temporal object to an instance of {@code ZoneId}. + + The conversion will try to obtain the zone in a way that favours region-based + zones over offset-based zones using {@link TemporalQueries#zone()}. + + This method matches the signature of the functional interface {@link TemporalQuery} + allowing it to be used as a query via method reference, {@code ZoneId::from}. + + @param temporal the temporal object to convert, not null + @return the zone ID, not null + @throws DateTimeException if unable to convert to a {@code ZoneId}" + {:arglists (quote (["java.time.temporal.TemporalAccessor"]))} + (^js/JSJoda.ZoneId [^js/JSJoda.TemporalAccessor temporal] + (js-invoke java.time.ZoneId "from" temporal))) + +(defn hash-code + "A hash code for this time-zone ID. + + @return a suitable hash code" + {:arglists (quote (["java.time.ZoneId"]))} + (^int [^js/JSJoda.ZoneId this] (.hashCode this))) + +(defn equals + "Checks if this time-zone ID is equal to another time-zone ID. + + The comparison is based on the ID. + + @param obj the object to check, null returns false + @return true if this is equal to the other time-zone ID" + {:arglists (quote (["java.time.ZoneId" "java.lang.Object"]))} + (^boolean [^js/JSJoda.ZoneId this ^java.lang.Object obj] (.equals this obj))) diff --git a/src/cljc/java_time/zone_offset.clj b/src/cljc/java_time/zone_offset.clj index 1a84b03..90a6316 100644 --- a/src/cljc/java_time/zone_offset.clj +++ b/src/cljc/java_time/zone_offset.clj @@ -1,28 +1,412 @@ -(ns cljc.java-time.zone-offset (:refer-clojure :exclude [abs get range format min max next name resolve short]) (:require [cljc.java-time.extn.calendar-awareness]) (:import [java.time ZoneOffset])) -(def max java.time.ZoneOffset/MAX) -(def min java.time.ZoneOffset/MIN) -(def utc java.time.ZoneOffset/UTC) -(clojure.core/defn get-available-zone-ids {:arglists (quote ([]))} (^java.util.Set [] (java.time.ZoneOffset/getAvailableZoneIds))) -(clojure.core/defn range {:arglists (quote (["java.time.ZoneOffset" "java.time.temporal.TemporalField"]))} (^java.time.temporal.ValueRange [^java.time.ZoneOffset this15404 ^java.time.temporal.TemporalField java-time-temporal-TemporalField15405] (.range this15404 java-time-temporal-TemporalField15405))) -(clojure.core/defn of-total-seconds {:arglists (quote (["int"]))} (^java.time.ZoneOffset [^java.lang.Integer int15406] (java.time.ZoneOffset/ofTotalSeconds int15406))) -(clojure.core/defn of {:arglists (quote (["java.lang.String"] ["java.lang.String" "java.util.Map"] ["java.lang.String"]))} (^java.lang.Object [G__15408] (clojure.core/cond (clojure.core/and (clojure.core/instance? java.lang.String G__15408)) (clojure.core/let [G__15408 ^"java.lang.String" G__15408] (java.time.ZoneOffset/of G__15408)) (clojure.core/and (clojure.core/instance? java.lang.String G__15408)) (clojure.core/let [G__15408 ^"java.lang.String" G__15408] (java.time.ZoneOffset/of G__15408)) :else (throw (java.lang.IllegalArgumentException. "no corresponding java.time method with these args")))) (^java.time.ZoneId [^java.lang.String java-lang-String15409 ^java.util.Map java-util-Map15410] (java.time.ZoneOffset/of java-lang-String15409 java-util-Map15410))) -(clojure.core/defn of-offset {:arglists (quote (["java.lang.String" "java.time.ZoneOffset"]))} (^java.time.ZoneId [^java.lang.String java-lang-String15411 ^java.time.ZoneOffset java-time-ZoneOffset15412] (java.time.ZoneOffset/ofOffset java-lang-String15411 java-time-ZoneOffset15412))) -(clojure.core/defn query {:arglists (quote (["java.time.ZoneOffset" "java.time.temporal.TemporalQuery"]))} (^java.lang.Object [^java.time.ZoneOffset this15413 ^java.time.temporal.TemporalQuery java-time-temporal-TemporalQuery15414] (.query this15413 java-time-temporal-TemporalQuery15414))) -(clojure.core/defn to-string {:arglists (quote (["java.time.ZoneOffset"]))} (^java.lang.String [^java.time.ZoneOffset this15415] (.toString this15415))) -(clojure.core/defn get-display-name {:arglists (quote (["java.time.ZoneOffset" "java.time.format.TextStyle" "java.util.Locale"]))} (^java.lang.String [^java.time.ZoneOffset this15416 ^java.time.format.TextStyle java-time-format-TextStyle15417 ^java.util.Locale java-util-Locale15418] (.getDisplayName this15416 java-time-format-TextStyle15417 java-util-Locale15418))) -(clojure.core/defn get-long {:arglists (quote (["java.time.ZoneOffset" "java.time.temporal.TemporalField"]))} (^long [^java.time.ZoneOffset this15419 ^java.time.temporal.TemporalField java-time-temporal-TemporalField15420] (.getLong this15419 java-time-temporal-TemporalField15420))) -(clojure.core/defn get-rules {:arglists (quote (["java.time.ZoneOffset"]))} (^java.time.zone.ZoneRules [^java.time.ZoneOffset this15421] (.getRules this15421))) -(clojure.core/defn of-hours {:arglists (quote (["int"]))} (^java.time.ZoneOffset [^java.lang.Integer int15422] (java.time.ZoneOffset/ofHours int15422))) -(clojure.core/defn get-id {:arglists (quote (["java.time.ZoneOffset"]))} (^java.lang.String [^java.time.ZoneOffset this15423] (.getId this15423))) -(clojure.core/defn normalized {:arglists (quote (["java.time.ZoneOffset"]))} (^java.time.ZoneId [^java.time.ZoneOffset this15424] (.normalized this15424))) -(clojure.core/defn system-default {:arglists (quote ([]))} (^java.time.ZoneId [] (java.time.ZoneOffset/systemDefault))) -(clojure.core/defn from {:arglists (quote (["java.time.temporal.TemporalAccessor"] ["java.time.temporal.TemporalAccessor"]))} (^java.lang.Object [G__15426] (clojure.core/cond (clojure.core/and (clojure.core/instance? java.time.temporal.TemporalAccessor G__15426)) (clojure.core/let [G__15426 ^"java.time.temporal.TemporalAccessor" G__15426] (java.time.ZoneOffset/from G__15426)) (clojure.core/and (clojure.core/instance? java.time.temporal.TemporalAccessor G__15426)) (clojure.core/let [G__15426 ^"java.time.temporal.TemporalAccessor" G__15426] (java.time.ZoneOffset/from G__15426)) :else (throw (java.lang.IllegalArgumentException. "no corresponding java.time method with these args"))))) -(clojure.core/defn of-hours-minutes-seconds {:arglists (quote (["int" "int" "int"]))} (^java.time.ZoneOffset [^java.lang.Integer int15427 ^java.lang.Integer int15428 ^java.lang.Integer int15429] (java.time.ZoneOffset/ofHoursMinutesSeconds int15427 int15428 int15429))) -(clojure.core/defn is-supported {:arglists (quote (["java.time.ZoneOffset" "java.time.temporal.TemporalField"]))} (^java.lang.Boolean [^java.time.ZoneOffset this15430 ^java.time.temporal.TemporalField java-time-temporal-TemporalField15431] (.isSupported this15430 java-time-temporal-TemporalField15431))) -(clojure.core/defn hash-code {:arglists (quote (["java.time.ZoneOffset"]))} (^java.lang.Integer [^java.time.ZoneOffset this15432] (.hashCode this15432))) -(clojure.core/defn get-total-seconds {:arglists (quote (["java.time.ZoneOffset"]))} (^java.lang.Integer [^java.time.ZoneOffset this15433] (.getTotalSeconds this15433))) -(clojure.core/defn adjust-into {:arglists (quote (["java.time.ZoneOffset" "java.time.temporal.Temporal"]))} (^java.time.temporal.Temporal [^java.time.ZoneOffset this15434 ^java.time.temporal.Temporal java-time-temporal-Temporal15435] (.adjustInto this15434 java-time-temporal-Temporal15435))) -(clojure.core/defn of-hours-minutes {:arglists (quote (["int" "int"]))} (^java.time.ZoneOffset [^java.lang.Integer int15436 ^java.lang.Integer int15437] (java.time.ZoneOffset/ofHoursMinutes int15436 int15437))) -(clojure.core/defn compare-to {:arglists (quote (["java.time.ZoneOffset" "java.time.ZoneOffset"]))} (^java.lang.Integer [^java.time.ZoneOffset this15438 ^java.time.ZoneOffset java-time-ZoneOffset15439] (.compareTo this15438 java-time-ZoneOffset15439))) -(clojure.core/defn get {:arglists (quote (["java.time.ZoneOffset" "java.time.temporal.TemporalField"]))} (^java.lang.Integer [^java.time.ZoneOffset this15440 ^java.time.temporal.TemporalField java-time-temporal-TemporalField15441] (.get this15440 java-time-temporal-TemporalField15441))) -(clojure.core/defn equals {:arglists (quote (["java.time.ZoneOffset" "java.lang.Object"]))} (^java.lang.Boolean [^java.time.ZoneOffset this15442 ^java.lang.Object java-lang-Object15443] (.equals this15442 java-lang-Object15443))) +(ns cljc.java-time.zone-offset + (:refer-clojure :exclude + [abs get range format min max next name resolve short]) + (:require [cljc.java-time.extn.calendar-awareness]) + (:import [java.time ZoneOffset])) + +(def max "Constant for the maximum supported offset." java.time.ZoneOffset/MAX) + +(def min "Constant for the maximum supported offset." java.time.ZoneOffset/MIN) + +(def utc + "The time-zone offset for UTC, with an ID of 'Z'." + java.time.ZoneOffset/UTC) + +(defn get-available-zone-ids + "Gets the set of available zone IDs. + + This set includes the string form of all available region-based IDs. + Offset-based zone IDs are not included in the returned set. + The ID can be passed to {@link #of(String)} to create a {@code ZoneId}. + + The set of zone IDs can increase over time, although in a typical application + the set of IDs is fixed. Each call to this method is thread-safe. + + @return a modifiable copy of the set of zone IDs, not null" + {:arglists (quote ([]))} + (^java.util.Set [] (java.time.ZoneOffset/getAvailableZoneIds))) + +(defn range + "Gets the range of valid values for the specified field. + + The range object expresses the minimum and maximum valid values for a field. + This offset is used to enhance the accuracy of the returned range. + If it is not possible to return the range, because the field is not supported + or for some other reason, an exception is thrown. + + If the field is a {@link ChronoField} then the query is implemented here. + The {@link #isSupported(TemporalField) supported fields} will return + appropriate range instances. + All other {@code ChronoField} instances will throw an {@code UnsupportedTemporalTypeException}. + + If the field is not a {@code ChronoField}, then the result of this method + is obtained by invoking {@code TemporalField.rangeRefinedBy(TemporalAccessor)} + passing {@code this} as the argument. + Whether the range can be obtained is determined by the field. + + @param field the field to query the range for, not null + @return the range of valid values for the field, not null + @throws DateTimeException if the range for the field cannot be obtained + @throws UnsupportedTemporalTypeException if the field is not supported" + {:arglists (quote (["java.time.ZoneOffset" + "java.time.temporal.TemporalField"]))} + (^java.time.temporal.ValueRange + [^java.time.ZoneOffset this ^java.time.temporal.TemporalField field] + (.range this field))) + +(defn of-total-seconds + "Obtains an instance of {@code ZoneOffset} specifying the total offset in seconds + + The offset must be in the range {@code -18:00} to {@code +18:00}, which corresponds to -64800 to +64800. + + @param totalSeconds the total time-zone offset in seconds, from -64800 to +64800 + @return the ZoneOffset, not null + @throws DateTimeException if the offset is not in the required range" + {:arglists (quote (["int"]))} + (^java.time.ZoneOffset [^java.lang.Integer total-seconds] + (java.time.ZoneOffset/ofTotalSeconds total-seconds))) + +(defn of + {:arglists (quote (["java.lang.String"] + ["java.lang.String"] + ["java.lang.String" "java.util.Map"]))} + (^java.lang.Object [arg0] + (cond (instance? java.lang.String arg0) (let [^java.lang.String zone-id arg0] + (java.time.ZoneOffset/of zone-id)) + (instance? java.lang.String arg0) + (let [^java.lang.String offset-id arg0] + (java.time.ZoneOffset/of offset-id)) + :else (throw (java.lang.IllegalArgumentException. + "no corresponding java.time method with these args")))) + (^java.time.ZoneId [^java.lang.String zone-id ^java.util.Map alias-map] + (java.time.ZoneOffset/of zone-id alias-map))) + +(defn of-offset + "Obtains an instance of {@code ZoneId} wrapping an offset. + + If the prefix is \"GMT\", \"UTC\", or \"UT\" a {@code ZoneId} + with the prefix and the non-zero offset is returned. + If the prefix is empty {@code \"\"} the {@code ZoneOffset} is returned. + + @param prefix the time-zone ID, not null + @param offset the offset, not null + @return the zone ID, not null + @throws IllegalArgumentException if the prefix is not one of + \"GMT\", \"UTC\", or \"UT\", or \"\"" + {:arglists (quote (["java.lang.String" "java.time.ZoneOffset"]))} + (^java.time.ZoneId [^java.lang.String prefix ^java.time.ZoneOffset offset] + (java.time.ZoneOffset/ofOffset prefix offset))) + +(defn query + "Queries this offset using the specified query. + + This queries this offset using the specified query strategy object. + The {@code TemporalQuery} object defines the logic to be used to + obtain the result. Read the documentation of the query to understand + what the result of this method will be. + + The result of this method is obtained by invoking the + {@link TemporalQuery#queryFrom(TemporalAccessor)} method on the + specified query passing {@code this} as the argument. + + @param the type of the result + @param query the query to invoke, not null + @return the query result, null may be returned (defined by the query) + @throws DateTimeException if unable to query (defined by the query) + @throws ArithmeticException if numeric overflow occurs (defined by the query)" + {:arglists (quote (["java.time.ZoneOffset" + "java.time.temporal.TemporalQuery"]))} + (^java.lang.Object + [^java.time.ZoneOffset this ^java.time.temporal.TemporalQuery query] + (.query this query))) + +(defn to-string + "Outputs this offset as a {@code String}, using the normalized ID. + + @return a string representation of this offset, not null" + {:arglists (quote (["java.time.ZoneOffset"]))} + (^java.lang.String [^java.time.ZoneOffset this] (.toString this))) + +(defn get-display-name + "Gets the textual representation of the zone, such as 'British Time' or + '+02:00'. + + This returns the textual name used to identify the time-zone ID, + suitable for presentation to the user. + The parameters control the style of the returned text and the locale. + + If no textual mapping is found then the {@link #getId() full ID} is returned. + + @param style the length of the text required, not null + @param locale the locale to use, not null + @return the text value of the zone, not null" + {:arglists (quote (["java.time.ZoneOffset" "java.time.format.TextStyle" + "java.util.Locale"]))} + (^java.lang.String + [^java.time.ZoneOffset this ^java.time.format.TextStyle style + ^java.util.Locale locale] + (.getDisplayName this style locale))) + +(defn get-long + "Gets the value of the specified field from this offset as a {@code long}. + + This queries this offset for the value of the specified field. + If it is not possible to return the value, because the field is not supported + or for some other reason, an exception is thrown. + + If the field is a {@link ChronoField} then the query is implemented here. + The {@code OFFSET_SECONDS} field returns the value of the offset. + All other {@code ChronoField} instances will throw an {@code UnsupportedTemporalTypeException}. + + If the field is not a {@code ChronoField}, then the result of this method + is obtained by invoking {@code TemporalField.getFrom(TemporalAccessor)} + passing {@code this} as the argument. Whether the value can be obtained, + and what the value represents, is determined by the field. + + @param field the field to get, not null + @return the value for the field + @throws DateTimeException if a value for the field cannot be obtained + @throws UnsupportedTemporalTypeException if the field is not supported + @throws ArithmeticException if numeric overflow occurs" + {:arglists (quote (["java.time.ZoneOffset" + "java.time.temporal.TemporalField"]))} + (^long [^java.time.ZoneOffset this ^java.time.temporal.TemporalField field] + (.getLong this field))) + +(defn get-rules + "Gets the associated time-zone rules. + + The rules will always return this offset when queried. + The implementation class is immutable, thread-safe and serializable. + + @return the rules, not null" + {:arglists (quote (["java.time.ZoneOffset"]))} + (^java.time.zone.ZoneRules [^java.time.ZoneOffset this] (.getRules this))) + +(defn of-hours + "Obtains an instance of {@code ZoneOffset} using an offset in hours. + + @param hours the time-zone offset in hours, from -18 to +18 + @return the zone-offset, not null + @throws DateTimeException if the offset is not in the required range" + {:arglists (quote (["int"]))} + (^java.time.ZoneOffset [^java.lang.Integer hours] + (java.time.ZoneOffset/ofHours hours))) + +(defn get-id + "Gets the normalized zone offset ID. + + The ID is minor variation to the standard ISO-8601 formatted string + for the offset. There are three formats: +
    +
  • {@code Z} - for UTC (ISO-8601) +
  • {@code +hh:mm} or {@code -hh:mm} - if the seconds are zero (ISO-8601) +
  • {@code +hh:mm:ss} or {@code -hh:mm:ss} - if the seconds are non-zero (not ISO-8601) +
+ + @return the zone offset ID, not null" + {:arglists (quote (["java.time.ZoneOffset"]))} + (^java.lang.String [^java.time.ZoneOffset this] (.getId this))) + +(defn normalized + "Normalizes the time-zone ID, returning a {@code ZoneOffset} where possible. + + The returns a normalized {@code ZoneId} that can be used in place of this ID. + The result will have {@code ZoneRules} equivalent to those returned by this object, + however the ID returned by {@code getId()} may be different. + + The normalization checks if the rules of this {@code ZoneId} have a fixed offset. + If they do, then the {@code ZoneOffset} equal to that offset is returned. + Otherwise {@code this} is returned. + + @return the time-zone unique ID, not null" + {:arglists (quote (["java.time.ZoneOffset"]))} + (^java.time.ZoneId [^java.time.ZoneOffset this] (.normalized this))) + +(defn system-default + "Gets the system default time-zone. + + This queries {@link TimeZone#getDefault()} to find the default time-zone + and converts it to a {@code ZoneId}. If the system default time-zone is changed, + then the result of this method will also change. + + @return the zone ID, not null + @throws DateTimeException if the converted zone ID has an invalid format + @throws ZoneRulesException if the converted zone region ID cannot be found" + {:arglists (quote ([]))} + (^java.time.ZoneId [] (java.time.ZoneOffset/systemDefault))) + +(defn from + {:arglists (quote (["java.time.temporal.TemporalAccessor"] + ["java.time.temporal.TemporalAccessor"]))} + (^java.lang.Object [arg0] + (cond (instance? java.time.temporal.TemporalAccessor arg0) + (let [^java.time.temporal.TemporalAccessor temporal arg0] + (java.time.ZoneOffset/from temporal)) + (instance? java.time.temporal.TemporalAccessor arg0) + (let [^java.time.temporal.TemporalAccessor temporal arg0] + (java.time.ZoneOffset/from temporal)) + :else (throw (java.lang.IllegalArgumentException. + "no corresponding java.time method with these args"))))) + +(defn of-hours-minutes-seconds + "Obtains an instance of {@code ZoneOffset} using an offset in + hours, minutes and seconds. + + The sign of the hours, minutes and seconds components must match. + Thus, if the hours is negative, the minutes and seconds must be negative or zero. + + @param hours the time-zone offset in hours, from -18 to +18 + @param minutes the time-zone offset in minutes, from 0 to ±59, sign matches hours and seconds + @param seconds the time-zone offset in seconds, from 0 to ±59, sign matches hours and minutes + @return the zone-offset, not null + @throws DateTimeException if the offset is not in the required range" + {:arglists (quote (["int" "int" "int"]))} + (^java.time.ZoneOffset + [^java.lang.Integer hours ^java.lang.Integer minutes + ^java.lang.Integer seconds] + (java.time.ZoneOffset/ofHoursMinutesSeconds hours minutes seconds))) + +(defn is-supported + "Checks if the specified field is supported. + + This checks if this offset can be queried for the specified field. + If false, then calling the {@link #range(TemporalField) range} and + {@link #get(TemporalField) get} methods will throw an exception. + + If the field is a {@link ChronoField} then the query is implemented here. + The {@code OFFSET_SECONDS} field returns true. + All other {@code ChronoField} instances will return false. + + If the field is not a {@code ChronoField}, then the result of this method + is obtained by invoking {@code TemporalField.isSupportedBy(TemporalAccessor)} + passing {@code this} as the argument. + Whether the field is supported is determined by the field. + + @param field the field to check, null returns false + @return true if the field is supported on this offset, false if not" + {:arglists (quote (["java.time.ZoneOffset" + "java.time.temporal.TemporalField"]))} + (^java.lang.Boolean + [^java.time.ZoneOffset this ^java.time.temporal.TemporalField field] + (.isSupported this field))) + +(defn hash-code + "A hash code for this offset. + + @return a suitable hash code" + {:arglists (quote (["java.time.ZoneOffset"]))} + (^java.lang.Integer [^java.time.ZoneOffset this] (.hashCode this))) + +(defn get-total-seconds + "Gets the total zone offset in seconds. + + This is the primary way to access the offset amount. + It returns the total of the hours, minutes and seconds fields as a + single offset that can be added to a time. + + @return the total zone offset amount in seconds" + {:arglists (quote (["java.time.ZoneOffset"]))} + (^java.lang.Integer [^java.time.ZoneOffset this] (.getTotalSeconds this))) + +(defn adjust-into + "Adjusts the specified temporal object to have the same offset as this object. + + This returns a temporal object of the same observable type as the input + with the offset changed to be the same as this. + + The adjustment is equivalent to using {@link Temporal#with(TemporalField, long)} + passing {@link ChronoField#OFFSET_SECONDS} as the field. + + In most cases, it is clearer to reverse the calling pattern by using + {@link Temporal#with(TemporalAdjuster)}: +
+   // these two lines are equivalent, but the second approach is recommended
+   temporal = thisOffset.adjustInto(temporal);
+   temporal = temporal.with(thisOffset);
+ 
+ + This instance is immutable and unaffected by this method call. + + @param temporal the target object to be adjusted, not null + @return the adjusted object, not null + @throws DateTimeException if unable to make the adjustment + @throws ArithmeticException if numeric overflow occurs" + {:arglists (quote (["java.time.ZoneOffset" "java.time.temporal.Temporal"]))} + (^java.time.temporal.Temporal + [^java.time.ZoneOffset this ^java.time.temporal.Temporal temporal] + (.adjustInto this temporal))) + +(defn of-hours-minutes + "Obtains an instance of {@code ZoneOffset} using an offset in + hours and minutes. + + The sign of the hours and minutes components must match. + Thus, if the hours is negative, the minutes must be negative or zero. + If the hours is zero, the minutes may be positive, negative or zero. + + @param hours the time-zone offset in hours, from -18 to +18 + @param minutes the time-zone offset in minutes, from 0 to ±59, sign matches hours + @return the zone-offset, not null + @throws DateTimeException if the offset is not in the required range" + {:arglists (quote (["int" "int"]))} + (^java.time.ZoneOffset [^java.lang.Integer hours ^java.lang.Integer minutes] + (java.time.ZoneOffset/ofHoursMinutes hours minutes))) + +(defn compare-to + "Compares this offset to another offset in descending order. + + The offsets are compared in the order that they occur for the same time + of day around the world. Thus, an offset of {@code +10:00} comes before an + offset of {@code +09:00} and so on down to {@code -18:00}. + + The comparison is \"consistent with equals\", as defined by {@link Comparable}. + + @param other the other date to compare to, not null + @return the comparator value, negative if less, positive if greater + @throws NullPointerException if {@code other} is null" + {:arglists (quote (["java.time.ZoneOffset" "java.time.ZoneOffset"]))} + (^java.lang.Integer [^java.time.ZoneOffset this ^java.time.ZoneOffset other] + (.compareTo this other))) + +(defn get + "Gets the value of the specified field from this offset as an {@code int}. + + This queries this offset for the value of the specified field. + The returned value will always be within the valid range of values for the field. + If it is not possible to return the value, because the field is not supported + or for some other reason, an exception is thrown. + + If the field is a {@link ChronoField} then the query is implemented here. + The {@code OFFSET_SECONDS} field returns the value of the offset. + All other {@code ChronoField} instances will throw an {@code UnsupportedTemporalTypeException}. + + If the field is not a {@code ChronoField}, then the result of this method + is obtained by invoking {@code TemporalField.getFrom(TemporalAccessor)} + passing {@code this} as the argument. Whether the value can be obtained, + and what the value represents, is determined by the field. + + @param field the field to get, not null + @return the value for the field + @throws DateTimeException if a value for the field cannot be obtained or + the value is outside the range of valid values for the field + @throws UnsupportedTemporalTypeException if the field is not supported or + the range of values exceeds an {@code int} + @throws ArithmeticException if numeric overflow occurs" + {:arglists (quote (["java.time.ZoneOffset" + "java.time.temporal.TemporalField"]))} + (^java.lang.Integer + [^java.time.ZoneOffset this ^java.time.temporal.TemporalField field] + (.get this field))) + +(defn equals + "Checks if this offset is equal to another offset. + + The comparison is based on the amount of the offset in seconds. + This is equivalent to a comparison by ID. + + @param obj the object to check, null returns false + @return true if this is equal to the other offset" + {:arglists (quote (["java.time.ZoneOffset" "java.lang.Object"]))} + (^java.lang.Boolean [^java.time.ZoneOffset this ^java.lang.Object obj] + (.equals this obj))) diff --git a/src/cljc/java_time/zone_offset.cljs b/src/cljc/java_time/zone_offset.cljs index 9d2039e..743d2cb 100644 --- a/src/cljc/java_time/zone_offset.cljs +++ b/src/cljc/java_time/zone_offset.cljs @@ -1,28 +1,400 @@ -(ns cljc.java-time.zone-offset (:refer-clojure :exclude [abs get range format min max next name resolve short]) (:require [cljc.java-time.extn.calendar-awareness] [goog.object] [java.time :refer [ZoneOffset]])) -(def max (goog.object/get java.time.ZoneOffset "MAX")) -(def min (goog.object/get java.time.ZoneOffset "MIN")) -(def utc (goog.object/get java.time.ZoneOffset "UTC")) -(clojure.core/defn get-available-zone-ids {:arglists (quote ([]))} (^java.util.Set [] (js-invoke java.time.ZoneOffset "getAvailableZoneIds"))) -(clojure.core/defn range {:arglists (quote (["java.time.ZoneOffset" "java.time.temporal.TemporalField"]))} (^js/JSJoda.ValueRange [^js/JSJoda.ZoneOffset this15444 ^js/JSJoda.TemporalField java-time-temporal-TemporalField15445] (.range this15444 java-time-temporal-TemporalField15445))) -(clojure.core/defn of-total-seconds {:arglists (quote (["int"]))} (^js/JSJoda.ZoneOffset [^int int15446] (js-invoke java.time.ZoneOffset "ofTotalSeconds" int15446))) -(clojure.core/defn of {:arglists (quote (["java.lang.String"] ["java.lang.String" "java.util.Map"] ["java.lang.String"]))} (^java.lang.Object [G__15448] (js-invoke java.time.ZoneOffset "of" G__15448)) (^js/JSJoda.ZoneId [^java.lang.String java-lang-String15449 ^java.util.Map java-util-Map15450] (js-invoke java.time.ZoneOffset "of" java-lang-String15449 java-util-Map15450))) -(clojure.core/defn of-offset {:arglists (quote (["java.lang.String" "java.time.ZoneOffset"]))} (^js/JSJoda.ZoneId [^java.lang.String java-lang-String15451 ^js/JSJoda.ZoneOffset java-time-ZoneOffset15452] (js-invoke java.time.ZoneOffset "ofOffset" java-lang-String15451 java-time-ZoneOffset15452))) -(clojure.core/defn query {:arglists (quote (["java.time.ZoneOffset" "java.time.temporal.TemporalQuery"]))} (^java.lang.Object [^js/JSJoda.ZoneOffset this15453 ^js/JSJoda.TemporalQuery java-time-temporal-TemporalQuery15454] (.query this15453 java-time-temporal-TemporalQuery15454))) -(clojure.core/defn to-string {:arglists (quote (["java.time.ZoneOffset"]))} (^java.lang.String [^js/JSJoda.ZoneOffset this15455] (.toString this15455))) -(clojure.core/defn get-display-name {:arglists (quote (["java.time.ZoneOffset" "java.time.format.TextStyle" "java.util.Locale"]))} (^java.lang.String [^js/JSJoda.ZoneOffset this15456 ^js/JSJoda.TextStyle java-time-format-TextStyle15457 ^java.util.Locale java-util-Locale15458] (.displayName this15456 java-time-format-TextStyle15457 java-util-Locale15458))) -(clojure.core/defn get-long {:arglists (quote (["java.time.ZoneOffset" "java.time.temporal.TemporalField"]))} (^long [^js/JSJoda.ZoneOffset this15459 ^js/JSJoda.TemporalField java-time-temporal-TemporalField15460] (.getLong this15459 java-time-temporal-TemporalField15460))) -(clojure.core/defn get-rules {:arglists (quote (["java.time.ZoneOffset"]))} (^js/JSJoda.ZoneRules [^js/JSJoda.ZoneOffset this15461] (.rules this15461))) -(clojure.core/defn of-hours {:arglists (quote (["int"]))} (^js/JSJoda.ZoneOffset [^int int15462] (js-invoke java.time.ZoneOffset "ofHours" int15462))) -(clojure.core/defn get-id {:arglists (quote (["java.time.ZoneOffset"]))} (^java.lang.String [^js/JSJoda.ZoneOffset this15463] (.id this15463))) -(clojure.core/defn normalized {:arglists (quote (["java.time.ZoneOffset"]))} (^js/JSJoda.ZoneId [^js/JSJoda.ZoneOffset this15464] (.normalized this15464))) -(clojure.core/defn system-default {:arglists (quote ([]))} (^js/JSJoda.ZoneId [] (js-invoke java.time.ZoneOffset "systemDefault"))) -(clojure.core/defn from {:arglists (quote (["java.time.temporal.TemporalAccessor"] ["java.time.temporal.TemporalAccessor"]))} (^java.lang.Object [G__15466] (js-invoke java.time.ZoneOffset "from" G__15466))) -(clojure.core/defn of-hours-minutes-seconds {:arglists (quote (["int" "int" "int"]))} (^js/JSJoda.ZoneOffset [^int int15467 ^int int15468 ^int int15469] (js-invoke java.time.ZoneOffset "ofHoursMinutesSeconds" int15467 int15468 int15469))) -(clojure.core/defn is-supported {:arglists (quote (["java.time.ZoneOffset" "java.time.temporal.TemporalField"]))} (^boolean [^js/JSJoda.ZoneOffset this15470 ^js/JSJoda.TemporalField java-time-temporal-TemporalField15471] (.isSupported this15470 java-time-temporal-TemporalField15471))) -(clojure.core/defn hash-code {:arglists (quote (["java.time.ZoneOffset"]))} (^int [^js/JSJoda.ZoneOffset this15472] (.hashCode this15472))) -(clojure.core/defn get-total-seconds {:arglists (quote (["java.time.ZoneOffset"]))} (^int [^js/JSJoda.ZoneOffset this15473] (.totalSeconds this15473))) -(clojure.core/defn adjust-into {:arglists (quote (["java.time.ZoneOffset" "java.time.temporal.Temporal"]))} (^js/JSJoda.Temporal [^js/JSJoda.ZoneOffset this15474 ^js/JSJoda.Temporal java-time-temporal-Temporal15475] (.adjustInto this15474 java-time-temporal-Temporal15475))) -(clojure.core/defn of-hours-minutes {:arglists (quote (["int" "int"]))} (^js/JSJoda.ZoneOffset [^int int15476 ^int int15477] (js-invoke java.time.ZoneOffset "ofHoursMinutes" int15476 int15477))) -(clojure.core/defn compare-to {:arglists (quote (["java.time.ZoneOffset" "java.time.ZoneOffset"]))} (^int [^js/JSJoda.ZoneOffset this15478 ^js/JSJoda.ZoneOffset java-time-ZoneOffset15479] (.compareTo this15478 java-time-ZoneOffset15479))) -(clojure.core/defn get {:arglists (quote (["java.time.ZoneOffset" "java.time.temporal.TemporalField"]))} (^int [^js/JSJoda.ZoneOffset this15480 ^js/JSJoda.TemporalField java-time-temporal-TemporalField15481] (.get this15480 java-time-temporal-TemporalField15481))) -(clojure.core/defn equals {:arglists (quote (["java.time.ZoneOffset" "java.lang.Object"]))} (^boolean [^js/JSJoda.ZoneOffset this15482 ^java.lang.Object java-lang-Object15483] (.equals this15482 java-lang-Object15483))) +(ns cljc.java-time.zone-offset + (:refer-clojure :exclude + [abs get range format min max next name resolve short]) + (:require [cljc.java-time.extn.calendar-awareness] + [goog.object] + [java.time :refer [ZoneOffset]])) + +(def max + "Constant for the maximum supported offset." + (goog.object/get java.time.ZoneOffset "MAX")) + +(def min + "Constant for the maximum supported offset." + (goog.object/get java.time.ZoneOffset "MIN")) + +(def utc + "The time-zone offset for UTC, with an ID of 'Z'." + (goog.object/get java.time.ZoneOffset "UTC")) + +(defn get-available-zone-ids + "Gets the set of available zone IDs. + + This set includes the string form of all available region-based IDs. + Offset-based zone IDs are not included in the returned set. + The ID can be passed to {@link #of(String)} to create a {@code ZoneId}. + + The set of zone IDs can increase over time, although in a typical application + the set of IDs is fixed. Each call to this method is thread-safe. + + @return a modifiable copy of the set of zone IDs, not null" + {:arglists (quote ([]))} + (^java.util.Set [] (js-invoke java.time.ZoneOffset "getAvailableZoneIds"))) + +(defn range + "Gets the range of valid values for the specified field. + + The range object expresses the minimum and maximum valid values for a field. + This offset is used to enhance the accuracy of the returned range. + If it is not possible to return the range, because the field is not supported + or for some other reason, an exception is thrown. + + If the field is a {@link ChronoField} then the query is implemented here. + The {@link #isSupported(TemporalField) supported fields} will return + appropriate range instances. + All other {@code ChronoField} instances will throw an {@code UnsupportedTemporalTypeException}. + + If the field is not a {@code ChronoField}, then the result of this method + is obtained by invoking {@code TemporalField.rangeRefinedBy(TemporalAccessor)} + passing {@code this} as the argument. + Whether the range can be obtained is determined by the field. + + @param field the field to query the range for, not null + @return the range of valid values for the field, not null + @throws DateTimeException if the range for the field cannot be obtained + @throws UnsupportedTemporalTypeException if the field is not supported" + {:arglists (quote (["java.time.ZoneOffset" + "java.time.temporal.TemporalField"]))} + (^js/JSJoda.ValueRange + [^js/JSJoda.ZoneOffset this ^js/JSJoda.TemporalField field] + (.range this field))) + +(defn of-total-seconds + "Obtains an instance of {@code ZoneOffset} specifying the total offset in seconds + + The offset must be in the range {@code -18:00} to {@code +18:00}, which corresponds to -64800 to +64800. + + @param totalSeconds the total time-zone offset in seconds, from -64800 to +64800 + @return the ZoneOffset, not null + @throws DateTimeException if the offset is not in the required range" + {:arglists (quote (["int"]))} + (^js/JSJoda.ZoneOffset [^int total-seconds] + (js-invoke java.time.ZoneOffset "ofTotalSeconds" total-seconds))) + +(defn of + {:arglists (quote (["java.lang.String"] + ["java.lang.String"] + ["java.lang.String" "java.util.Map"]))} + (^java.lang.Object [arg0] (js-invoke java.time.ZoneOffset "of" arg0)) + (^js/JSJoda.ZoneId [^java.lang.String zone-id ^java.util.Map alias-map] + (js-invoke java.time.ZoneOffset "of" zone-id alias-map))) + +(defn of-offset + "Obtains an instance of {@code ZoneId} wrapping an offset. + + If the prefix is \"GMT\", \"UTC\", or \"UT\" a {@code ZoneId} + with the prefix and the non-zero offset is returned. + If the prefix is empty {@code \"\"} the {@code ZoneOffset} is returned. + + @param prefix the time-zone ID, not null + @param offset the offset, not null + @return the zone ID, not null + @throws IllegalArgumentException if the prefix is not one of + \"GMT\", \"UTC\", or \"UT\", or \"\"" + {:arglists (quote (["java.lang.String" "java.time.ZoneOffset"]))} + (^js/JSJoda.ZoneId [^java.lang.String prefix ^js/JSJoda.ZoneOffset offset] + (js-invoke java.time.ZoneOffset "ofOffset" prefix offset))) + +(defn query + "Queries this offset using the specified query. + + This queries this offset using the specified query strategy object. + The {@code TemporalQuery} object defines the logic to be used to + obtain the result. Read the documentation of the query to understand + what the result of this method will be. + + The result of this method is obtained by invoking the + {@link TemporalQuery#queryFrom(TemporalAccessor)} method on the + specified query passing {@code this} as the argument. + + @param the type of the result + @param query the query to invoke, not null + @return the query result, null may be returned (defined by the query) + @throws DateTimeException if unable to query (defined by the query) + @throws ArithmeticException if numeric overflow occurs (defined by the query)" + {:arglists (quote (["java.time.ZoneOffset" + "java.time.temporal.TemporalQuery"]))} + (^java.lang.Object [^js/JSJoda.ZoneOffset this ^js/JSJoda.TemporalQuery query] + (.query this query))) + +(defn to-string + "Outputs this offset as a {@code String}, using the normalized ID. + + @return a string representation of this offset, not null" + {:arglists (quote (["java.time.ZoneOffset"]))} + (^java.lang.String [^js/JSJoda.ZoneOffset this] (.toString this))) + +(defn get-display-name + "Gets the textual representation of the zone, such as 'British Time' or + '+02:00'. + + This returns the textual name used to identify the time-zone ID, + suitable for presentation to the user. + The parameters control the style of the returned text and the locale. + + If no textual mapping is found then the {@link #getId() full ID} is returned. + + @param style the length of the text required, not null + @param locale the locale to use, not null + @return the text value of the zone, not null" + {:arglists (quote (["java.time.ZoneOffset" "java.time.format.TextStyle" + "java.util.Locale"]))} + (^java.lang.String + [^js/JSJoda.ZoneOffset this ^js/JSJoda.TextStyle style + ^java.util.Locale locale] + (.displayName this style locale))) + +(defn get-long + "Gets the value of the specified field from this offset as a {@code long}. + + This queries this offset for the value of the specified field. + If it is not possible to return the value, because the field is not supported + or for some other reason, an exception is thrown. + + If the field is a {@link ChronoField} then the query is implemented here. + The {@code OFFSET_SECONDS} field returns the value of the offset. + All other {@code ChronoField} instances will throw an {@code UnsupportedTemporalTypeException}. + + If the field is not a {@code ChronoField}, then the result of this method + is obtained by invoking {@code TemporalField.getFrom(TemporalAccessor)} + passing {@code this} as the argument. Whether the value can be obtained, + and what the value represents, is determined by the field. + + @param field the field to get, not null + @return the value for the field + @throws DateTimeException if a value for the field cannot be obtained + @throws UnsupportedTemporalTypeException if the field is not supported + @throws ArithmeticException if numeric overflow occurs" + {:arglists (quote (["java.time.ZoneOffset" + "java.time.temporal.TemporalField"]))} + (^long [^js/JSJoda.ZoneOffset this ^js/JSJoda.TemporalField field] + (.getLong this field))) + +(defn get-rules + "Gets the associated time-zone rules. + + The rules will always return this offset when queried. + The implementation class is immutable, thread-safe and serializable. + + @return the rules, not null" + {:arglists (quote (["java.time.ZoneOffset"]))} + (^js/JSJoda.ZoneRules [^js/JSJoda.ZoneOffset this] (.rules this))) + +(defn of-hours + "Obtains an instance of {@code ZoneOffset} using an offset in hours. + + @param hours the time-zone offset in hours, from -18 to +18 + @return the zone-offset, not null + @throws DateTimeException if the offset is not in the required range" + {:arglists (quote (["int"]))} + (^js/JSJoda.ZoneOffset [^int hours] + (js-invoke java.time.ZoneOffset "ofHours" hours))) + +(defn get-id + "Gets the normalized zone offset ID. + + The ID is minor variation to the standard ISO-8601 formatted string + for the offset. There are three formats: +
    +
  • {@code Z} - for UTC (ISO-8601) +
  • {@code +hh:mm} or {@code -hh:mm} - if the seconds are zero (ISO-8601) +
  • {@code +hh:mm:ss} or {@code -hh:mm:ss} - if the seconds are non-zero (not ISO-8601) +
+ + @return the zone offset ID, not null" + {:arglists (quote (["java.time.ZoneOffset"]))} + (^java.lang.String [^js/JSJoda.ZoneOffset this] (.id this))) + +(defn normalized + "Normalizes the time-zone ID, returning a {@code ZoneOffset} where possible. + + The returns a normalized {@code ZoneId} that can be used in place of this ID. + The result will have {@code ZoneRules} equivalent to those returned by this object, + however the ID returned by {@code getId()} may be different. + + The normalization checks if the rules of this {@code ZoneId} have a fixed offset. + If they do, then the {@code ZoneOffset} equal to that offset is returned. + Otherwise {@code this} is returned. + + @return the time-zone unique ID, not null" + {:arglists (quote (["java.time.ZoneOffset"]))} + (^js/JSJoda.ZoneId [^js/JSJoda.ZoneOffset this] (.normalized this))) + +(defn system-default + "Gets the system default time-zone. + + This queries {@link TimeZone#getDefault()} to find the default time-zone + and converts it to a {@code ZoneId}. If the system default time-zone is changed, + then the result of this method will also change. + + @return the zone ID, not null + @throws DateTimeException if the converted zone ID has an invalid format + @throws ZoneRulesException if the converted zone region ID cannot be found" + {:arglists (quote ([]))} + (^js/JSJoda.ZoneId [] (js-invoke java.time.ZoneOffset "systemDefault"))) + +(defn from + {:arglists (quote (["java.time.temporal.TemporalAccessor"] + ["java.time.temporal.TemporalAccessor"]))} + (^java.lang.Object [arg0] (js-invoke java.time.ZoneOffset "from" arg0))) + +(defn of-hours-minutes-seconds + "Obtains an instance of {@code ZoneOffset} using an offset in + hours, minutes and seconds. + + The sign of the hours, minutes and seconds components must match. + Thus, if the hours is negative, the minutes and seconds must be negative or zero. + + @param hours the time-zone offset in hours, from -18 to +18 + @param minutes the time-zone offset in minutes, from 0 to ±59, sign matches hours and seconds + @param seconds the time-zone offset in seconds, from 0 to ±59, sign matches hours and minutes + @return the zone-offset, not null + @throws DateTimeException if the offset is not in the required range" + {:arglists (quote (["int" "int" "int"]))} + (^js/JSJoda.ZoneOffset [^int hours ^int minutes ^int seconds] + (js-invoke java.time.ZoneOffset + "ofHoursMinutesSeconds" + hours + minutes + seconds))) + +(defn is-supported + "Checks if the specified field is supported. + + This checks if this offset can be queried for the specified field. + If false, then calling the {@link #range(TemporalField) range} and + {@link #get(TemporalField) get} methods will throw an exception. + + If the field is a {@link ChronoField} then the query is implemented here. + The {@code OFFSET_SECONDS} field returns true. + All other {@code ChronoField} instances will return false. + + If the field is not a {@code ChronoField}, then the result of this method + is obtained by invoking {@code TemporalField.isSupportedBy(TemporalAccessor)} + passing {@code this} as the argument. + Whether the field is supported is determined by the field. + + @param field the field to check, null returns false + @return true if the field is supported on this offset, false if not" + {:arglists (quote (["java.time.ZoneOffset" + "java.time.temporal.TemporalField"]))} + (^boolean [^js/JSJoda.ZoneOffset this ^js/JSJoda.TemporalField field] + (.isSupported this field))) + +(defn hash-code + "A hash code for this offset. + + @return a suitable hash code" + {:arglists (quote (["java.time.ZoneOffset"]))} + (^int [^js/JSJoda.ZoneOffset this] (.hashCode this))) + +(defn get-total-seconds + "Gets the total zone offset in seconds. + + This is the primary way to access the offset amount. + It returns the total of the hours, minutes and seconds fields as a + single offset that can be added to a time. + + @return the total zone offset amount in seconds" + {:arglists (quote (["java.time.ZoneOffset"]))} + (^int [^js/JSJoda.ZoneOffset this] (.totalSeconds this))) + +(defn adjust-into + "Adjusts the specified temporal object to have the same offset as this object. + + This returns a temporal object of the same observable type as the input + with the offset changed to be the same as this. + + The adjustment is equivalent to using {@link Temporal#with(TemporalField, long)} + passing {@link ChronoField#OFFSET_SECONDS} as the field. + + In most cases, it is clearer to reverse the calling pattern by using + {@link Temporal#with(TemporalAdjuster)}: +
+   // these two lines are equivalent, but the second approach is recommended
+   temporal = thisOffset.adjustInto(temporal);
+   temporal = temporal.with(thisOffset);
+ 
+ + This instance is immutable and unaffected by this method call. + + @param temporal the target object to be adjusted, not null + @return the adjusted object, not null + @throws DateTimeException if unable to make the adjustment + @throws ArithmeticException if numeric overflow occurs" + {:arglists (quote (["java.time.ZoneOffset" "java.time.temporal.Temporal"]))} + (^js/JSJoda.Temporal [^js/JSJoda.ZoneOffset this ^js/JSJoda.Temporal temporal] + (.adjustInto this temporal))) + +(defn of-hours-minutes + "Obtains an instance of {@code ZoneOffset} using an offset in + hours and minutes. + + The sign of the hours and minutes components must match. + Thus, if the hours is negative, the minutes must be negative or zero. + If the hours is zero, the minutes may be positive, negative or zero. + + @param hours the time-zone offset in hours, from -18 to +18 + @param minutes the time-zone offset in minutes, from 0 to ±59, sign matches hours + @return the zone-offset, not null + @throws DateTimeException if the offset is not in the required range" + {:arglists (quote (["int" "int"]))} + (^js/JSJoda.ZoneOffset [^int hours ^int minutes] + (js-invoke java.time.ZoneOffset "ofHoursMinutes" hours minutes))) + +(defn compare-to + "Compares this offset to another offset in descending order. + + The offsets are compared in the order that they occur for the same time + of day around the world. Thus, an offset of {@code +10:00} comes before an + offset of {@code +09:00} and so on down to {@code -18:00}. + + The comparison is \"consistent with equals\", as defined by {@link Comparable}. + + @param other the other date to compare to, not null + @return the comparator value, negative if less, positive if greater + @throws NullPointerException if {@code other} is null" + {:arglists (quote (["java.time.ZoneOffset" "java.time.ZoneOffset"]))} + (^int [^js/JSJoda.ZoneOffset this ^js/JSJoda.ZoneOffset other] + (.compareTo this other))) + +(defn get + "Gets the value of the specified field from this offset as an {@code int}. + + This queries this offset for the value of the specified field. + The returned value will always be within the valid range of values for the field. + If it is not possible to return the value, because the field is not supported + or for some other reason, an exception is thrown. + + If the field is a {@link ChronoField} then the query is implemented here. + The {@code OFFSET_SECONDS} field returns the value of the offset. + All other {@code ChronoField} instances will throw an {@code UnsupportedTemporalTypeException}. + + If the field is not a {@code ChronoField}, then the result of this method + is obtained by invoking {@code TemporalField.getFrom(TemporalAccessor)} + passing {@code this} as the argument. Whether the value can be obtained, + and what the value represents, is determined by the field. + + @param field the field to get, not null + @return the value for the field + @throws DateTimeException if a value for the field cannot be obtained or + the value is outside the range of valid values for the field + @throws UnsupportedTemporalTypeException if the field is not supported or + the range of values exceeds an {@code int} + @throws ArithmeticException if numeric overflow occurs" + {:arglists (quote (["java.time.ZoneOffset" + "java.time.temporal.TemporalField"]))} + (^int [^js/JSJoda.ZoneOffset this ^js/JSJoda.TemporalField field] + (.get this field))) + +(defn equals + "Checks if this offset is equal to another offset. + + The comparison is based on the amount of the offset in seconds. + This is equivalent to a comparison by ID. + + @param obj the object to check, null returns false + @return true if this is equal to the other offset" + {:arglists (quote (["java.time.ZoneOffset" "java.lang.Object"]))} + (^boolean [^js/JSJoda.ZoneOffset this ^java.lang.Object obj] + (.equals this obj))) diff --git a/src/cljc/java_time/zoned_date_time.clj b/src/cljc/java_time/zoned_date_time.clj index a6d87c0..fdc2662 100644 --- a/src/cljc/java_time/zoned_date_time.clj +++ b/src/cljc/java_time/zoned_date_time.clj @@ -1,74 +1,1328 @@ -(ns cljc.java-time.zoned-date-time (:refer-clojure :exclude [abs get range format min max next name resolve short]) (:require [cljc.java-time.extn.calendar-awareness]) (:import [java.time ZonedDateTime])) -(clojure.core/defn minus-minutes {:arglists (quote (["java.time.ZonedDateTime" "long"]))} (^java.time.ZonedDateTime [^java.time.ZonedDateTime this13564 ^long long13565] (.minusMinutes this13564 long13565))) -(clojure.core/defn truncated-to {:arglists (quote (["java.time.ZonedDateTime" "java.time.temporal.TemporalUnit"]))} (^java.time.ZonedDateTime [^java.time.ZonedDateTime this13566 ^java.time.temporal.ChronoUnit java-time-temporal-TemporalUnit13567] (.truncatedTo this13566 java-time-temporal-TemporalUnit13567))) -(clojure.core/defn minus-weeks {:arglists (quote (["java.time.ZonedDateTime" "long"]))} (^java.time.ZonedDateTime [^java.time.ZonedDateTime this13568 ^long long13569] (.minusWeeks this13568 long13569))) -(clojure.core/defn to-instant {:arglists (quote (["java.time.ZonedDateTime"]))} (^java.time.Instant [^java.time.ZonedDateTime this13570] (.toInstant this13570))) -(clojure.core/defn plus-weeks {:arglists (quote (["java.time.ZonedDateTime" "long"]))} (^java.time.ZonedDateTime [^java.time.ZonedDateTime this13571 ^long long13572] (.plusWeeks this13571 long13572))) -(clojure.core/defn range {:arglists (quote (["java.time.ZonedDateTime" "java.time.temporal.TemporalField"]))} (^java.time.temporal.ValueRange [^java.time.ZonedDateTime this13573 ^java.time.temporal.TemporalField java-time-temporal-TemporalField13574] (.range this13573 java-time-temporal-TemporalField13574))) -(clojure.core/defn with-earlier-offset-at-overlap {:arglists (quote (["java.time.ZonedDateTime"]))} (^java.time.ZonedDateTime [^java.time.ZonedDateTime this13575] (.withEarlierOffsetAtOverlap this13575))) -(clojure.core/defn get-hour {:arglists (quote (["java.time.ZonedDateTime"]))} (^java.lang.Integer [^java.time.ZonedDateTime this13576] (.getHour this13576))) -(clojure.core/defn minus-hours {:arglists (quote (["java.time.ZonedDateTime" "long"]))} (^java.time.ZonedDateTime [^java.time.ZonedDateTime this13577 ^long long13578] (.minusHours this13577 long13578))) -(clojure.core/defn of {:arglists (quote (["int" "int" "int" "int" "int" "int" "int" "java.time.ZoneId"] ["java.time.LocalDate" "java.time.LocalTime" "java.time.ZoneId"] ["java.time.LocalDateTime" "java.time.ZoneId"]))} (^java.time.ZonedDateTime [^java.lang.Integer int13579 ^java.lang.Integer int13580 ^java.lang.Integer int13581 ^java.lang.Integer int13582 ^java.lang.Integer int13583 ^java.lang.Integer int13584 ^java.lang.Integer int13585 ^java.time.ZoneId java-time-ZoneId13586] (java.time.ZonedDateTime/of int13579 int13580 int13581 int13582 int13583 int13584 int13585 java-time-ZoneId13586)) (^java.time.ZonedDateTime [^java.time.LocalDate java-time-LocalDate13587 ^java.time.LocalTime java-time-LocalTime13588 ^java.time.ZoneId java-time-ZoneId13589] (java.time.ZonedDateTime/of java-time-LocalDate13587 java-time-LocalTime13588 java-time-ZoneId13589)) (^java.time.ZonedDateTime [^java.time.LocalDateTime java-time-LocalDateTime13590 ^java.time.ZoneId java-time-ZoneId13591] (java.time.ZonedDateTime/of java-time-LocalDateTime13590 java-time-ZoneId13591))) -(clojure.core/defn with-month {:arglists (quote (["java.time.ZonedDateTime" "int"]))} (^java.time.ZonedDateTime [^java.time.ZonedDateTime this13592 ^java.lang.Integer int13593] (.withMonth this13592 int13593))) -(clojure.core/defn is-equal {:arglists (quote (["java.time.ZonedDateTime" "java.time.chrono.ChronoZonedDateTime"]))} (^java.lang.Boolean [^java.time.ZonedDateTime this13594 ^java.time.chrono.ChronoZonedDateTime java-time-chrono-ChronoZonedDateTime13595] (.isEqual this13594 java-time-chrono-ChronoZonedDateTime13595))) -(clojure.core/defn get-nano {:arglists (quote (["java.time.ZonedDateTime"]))} (^java.lang.Integer [^java.time.ZonedDateTime this13596] (.getNano this13596))) -(clojure.core/defn of-local {:arglists (quote (["java.time.LocalDateTime" "java.time.ZoneId" "java.time.ZoneOffset"]))} (^java.time.ZonedDateTime [^java.time.LocalDateTime java-time-LocalDateTime13597 ^java.time.ZoneId java-time-ZoneId13598 ^java.time.ZoneOffset java-time-ZoneOffset13599] (java.time.ZonedDateTime/ofLocal java-time-LocalDateTime13597 java-time-ZoneId13598 java-time-ZoneOffset13599))) -(clojure.core/defn get-year {:arglists (quote (["java.time.ZonedDateTime"]))} (^java.lang.Integer [^java.time.ZonedDateTime this13600] (.getYear this13600))) -(clojure.core/defn minus-seconds {:arglists (quote (["java.time.ZonedDateTime" "long"]))} (^java.time.ZonedDateTime [^java.time.ZonedDateTime this13601 ^long long13602] (.minusSeconds this13601 long13602))) -(clojure.core/defn get-second {:arglists (quote (["java.time.ZonedDateTime"]))} (^java.lang.Integer [^java.time.ZonedDateTime this13603] (.getSecond this13603))) -(clojure.core/defn plus-nanos {:arglists (quote (["java.time.ZonedDateTime" "long"]))} (^java.time.ZonedDateTime [^java.time.ZonedDateTime this13604 ^long long13605] (.plusNanos this13604 long13605))) -(clojure.core/defn get-day-of-year {:arglists (quote (["java.time.ZonedDateTime"]))} (^java.lang.Integer [^java.time.ZonedDateTime this13606] (.getDayOfYear this13606))) -(clojure.core/defn plus {:arglists (quote (["java.time.ZonedDateTime" "java.time.temporal.TemporalAmount"] ["java.time.ZonedDateTime" "long" "java.time.temporal.TemporalUnit"]))} (^java.time.ZonedDateTime [^java.time.ZonedDateTime this13607 ^java.time.temporal.TemporalAmount java-time-temporal-TemporalAmount13608] (.plus this13607 java-time-temporal-TemporalAmount13608)) (^java.time.ZonedDateTime [^java.time.ZonedDateTime this13609 ^long long13610 ^java.time.temporal.ChronoUnit java-time-temporal-TemporalUnit13611] (.plus this13609 long13610 java-time-temporal-TemporalUnit13611))) -(clojure.core/defn with-hour {:arglists (quote (["java.time.ZonedDateTime" "int"]))} (^java.time.ZonedDateTime [^java.time.ZonedDateTime this13612 ^java.lang.Integer int13613] (.withHour this13612 int13613))) -(clojure.core/defn with-minute {:arglists (quote (["java.time.ZonedDateTime" "int"]))} (^java.time.ZonedDateTime [^java.time.ZonedDateTime this13614 ^java.lang.Integer int13615] (.withMinute this13614 int13615))) -(clojure.core/defn plus-minutes {:arglists (quote (["java.time.ZonedDateTime" "long"]))} (^java.time.ZonedDateTime [^java.time.ZonedDateTime this13616 ^long long13617] (.plusMinutes this13616 long13617))) -(clojure.core/defn query {:arglists (quote (["java.time.ZonedDateTime" "java.time.temporal.TemporalQuery"]))} (^java.lang.Object [^java.time.ZonedDateTime this13618 ^java.time.temporal.TemporalQuery java-time-temporal-TemporalQuery13619] (.query this13618 java-time-temporal-TemporalQuery13619))) -(clojure.core/defn get-day-of-week {:arglists (quote (["java.time.ZonedDateTime"]))} (^java.time.DayOfWeek [^java.time.ZonedDateTime this13620] (.getDayOfWeek this13620))) -(clojure.core/defn to-string {:arglists (quote (["java.time.ZonedDateTime"]))} (^java.lang.String [^java.time.ZonedDateTime this13621] (.toString this13621))) -(clojure.core/defn plus-months {:arglists (quote (["java.time.ZonedDateTime" "long"]))} (^java.time.ZonedDateTime [^java.time.ZonedDateTime this13622 ^long long13623] (.plusMonths this13622 long13623))) -(clojure.core/defn is-before {:arglists (quote (["java.time.ZonedDateTime" "java.time.chrono.ChronoZonedDateTime"]))} (^java.lang.Boolean [^java.time.ZonedDateTime this13624 ^java.time.chrono.ChronoZonedDateTime java-time-chrono-ChronoZonedDateTime13625] (.isBefore this13624 java-time-chrono-ChronoZonedDateTime13625))) -(clojure.core/defn minus-months {:arglists (quote (["java.time.ZonedDateTime" "long"]))} (^java.time.ZonedDateTime [^java.time.ZonedDateTime this13626 ^long long13627] (.minusMonths this13626 long13627))) -(clojure.core/defn minus {:arglists (quote (["java.time.ZonedDateTime" "long" "java.time.temporal.TemporalUnit"] ["java.time.ZonedDateTime" "java.time.temporal.TemporalAmount"]))} (^java.time.ZonedDateTime [^java.time.ZonedDateTime this13628 ^long long13629 ^java.time.temporal.ChronoUnit java-time-temporal-TemporalUnit13630] (.minus this13628 long13629 java-time-temporal-TemporalUnit13630)) (^java.time.ZonedDateTime [^java.time.ZonedDateTime this13631 ^java.time.temporal.TemporalAmount java-time-temporal-TemporalAmount13632] (.minus this13631 java-time-temporal-TemporalAmount13632))) -(clojure.core/defn with-fixed-offset-zone {:arglists (quote (["java.time.ZonedDateTime"]))} (^java.time.ZonedDateTime [^java.time.ZonedDateTime this13633] (.withFixedOffsetZone this13633))) -(clojure.core/defn plus-hours {:arglists (quote (["java.time.ZonedDateTime" "long"]))} (^java.time.ZonedDateTime [^java.time.ZonedDateTime this13634 ^long long13635] (.plusHours this13634 long13635))) -(clojure.core/defn with-zone-same-local {:arglists (quote (["java.time.ZonedDateTime" "java.time.ZoneId"]))} (^java.time.ZonedDateTime [^java.time.ZonedDateTime this13636 ^java.time.ZoneId java-time-ZoneId13637] (.withZoneSameLocal this13636 java-time-ZoneId13637))) -(clojure.core/defn with-zone-same-instant {:arglists (quote (["java.time.ZonedDateTime" "java.time.ZoneId"]))} (^java.time.ZonedDateTime [^java.time.ZonedDateTime this13638 ^java.time.ZoneId java-time-ZoneId13639] (.withZoneSameInstant this13638 java-time-ZoneId13639))) -(clojure.core/defn plus-days {:arglists (quote (["java.time.ZonedDateTime" "long"]))} (^java.time.ZonedDateTime [^java.time.ZonedDateTime this13640 ^long long13641] (.plusDays this13640 long13641))) -(clojure.core/defn to-local-time {:arglists (quote (["java.time.ZonedDateTime"]))} (^java.time.LocalTime [^java.time.ZonedDateTime this13642] (.toLocalTime this13642))) -(clojure.core/defn get-long {:arglists (quote (["java.time.ZonedDateTime" "java.time.temporal.TemporalField"]))} (^long [^java.time.ZonedDateTime this13643 ^java.time.temporal.TemporalField java-time-temporal-TemporalField13644] (.getLong this13643 java-time-temporal-TemporalField13644))) -(clojure.core/defn get-offset {:arglists (quote (["java.time.ZonedDateTime"]))} (^java.time.ZoneOffset [^java.time.ZonedDateTime this13645] (.getOffset this13645))) -(clojure.core/defn with-year {:arglists (quote (["java.time.ZonedDateTime" "int"]))} (^java.time.ZonedDateTime [^java.time.ZonedDateTime this13646 ^java.lang.Integer int13647] (.withYear this13646 int13647))) -(clojure.core/defn with-nano {:arglists (quote (["java.time.ZonedDateTime" "int"]))} (^java.time.ZonedDateTime [^java.time.ZonedDateTime this13648 ^java.lang.Integer int13649] (.withNano this13648 int13649))) -(clojure.core/defn to-epoch-second {:arglists (quote (["java.time.ZonedDateTime"]))} (^long [^java.time.ZonedDateTime this13650] (.toEpochSecond this13650))) -(clojure.core/defn to-offset-date-time {:arglists (quote (["java.time.ZonedDateTime"]))} (^java.time.OffsetDateTime [^java.time.ZonedDateTime this13651] (.toOffsetDateTime this13651))) -(clojure.core/defn with-later-offset-at-overlap {:arglists (quote (["java.time.ZonedDateTime"]))} (^java.time.ZonedDateTime [^java.time.ZonedDateTime this13652] (.withLaterOffsetAtOverlap this13652))) -(clojure.core/defn until {:arglists (quote (["java.time.ZonedDateTime" "java.time.temporal.Temporal" "java.time.temporal.TemporalUnit"]))} (^long [^java.time.ZonedDateTime this13653 ^java.time.temporal.Temporal java-time-temporal-Temporal13654 ^java.time.temporal.ChronoUnit java-time-temporal-TemporalUnit13655] (.until this13653 java-time-temporal-Temporal13654 java-time-temporal-TemporalUnit13655))) -(clojure.core/defn get-zone {:arglists (quote (["java.time.ZonedDateTime"]))} (^java.time.ZoneId [^java.time.ZonedDateTime this13656] (.getZone this13656))) -(clojure.core/defn with-day-of-month {:arglists (quote (["java.time.ZonedDateTime" "int"]))} (^java.time.ZonedDateTime [^java.time.ZonedDateTime this13657 ^java.lang.Integer int13658] (.withDayOfMonth this13657 int13658))) -(clojure.core/defn get-day-of-month {:arglists (quote (["java.time.ZonedDateTime"]))} (^java.lang.Integer [^java.time.ZonedDateTime this13659] (.getDayOfMonth this13659))) -(clojure.core/defn from {:arglists (quote (["java.time.temporal.TemporalAccessor"]))} (^java.time.ZonedDateTime [^java.time.temporal.TemporalAccessor java-time-temporal-TemporalAccessor13660] (java.time.ZonedDateTime/from java-time-temporal-TemporalAccessor13660))) -(clojure.core/defn is-after {:arglists (quote (["java.time.ZonedDateTime" "java.time.chrono.ChronoZonedDateTime"]))} (^java.lang.Boolean [^java.time.ZonedDateTime this13661 ^java.time.chrono.ChronoZonedDateTime java-time-chrono-ChronoZonedDateTime13662] (.isAfter this13661 java-time-chrono-ChronoZonedDateTime13662))) -(clojure.core/defn minus-nanos {:arglists (quote (["java.time.ZonedDateTime" "long"]))} (^java.time.ZonedDateTime [^java.time.ZonedDateTime this13663 ^long long13664] (.minusNanos this13663 long13664))) -(clojure.core/defn is-supported {:arglists (quote (["java.time.ZonedDateTime" "java.time.temporal.TemporalField"] ["java.time.ZonedDateTime" "java.time.temporal.TemporalUnit"]))} (^java.lang.Boolean [this13665 G__13666] (clojure.core/cond (clojure.core/and (clojure.core/instance? java.time.temporal.TemporalField G__13666)) (clojure.core/let [G__13666 ^"java.time.temporal.TemporalField" G__13666] (.isSupported ^java.time.ZonedDateTime this13665 G__13666)) (clojure.core/and (clojure.core/instance? java.time.temporal.ChronoUnit G__13666)) (clojure.core/let [G__13666 ^"java.time.temporal.ChronoUnit" G__13666] (.isSupported ^java.time.ZonedDateTime this13665 G__13666)) :else (throw (java.lang.IllegalArgumentException. "no corresponding java.time method with these args"))))) -(clojure.core/defn minus-years {:arglists (quote (["java.time.ZonedDateTime" "long"]))} (^java.time.ZonedDateTime [^java.time.ZonedDateTime this13667 ^long long13668] (.minusYears this13667 long13668))) -(clojure.core/defn get-chronology {:arglists (quote (["java.time.ZonedDateTime"]))} (^java.time.chrono.Chronology [^java.time.ZonedDateTime this13669] (.getChronology this13669))) -(clojure.core/defn parse {:arglists (quote (["java.lang.CharSequence"] ["java.lang.CharSequence" "java.time.format.DateTimeFormatter"]))} (^java.time.ZonedDateTime [^java.lang.CharSequence java-lang-CharSequence13670] (java.time.ZonedDateTime/parse java-lang-CharSequence13670)) (^java.time.ZonedDateTime [^java.lang.CharSequence java-lang-CharSequence13671 ^java.time.format.DateTimeFormatter java-time-format-DateTimeFormatter13672] (java.time.ZonedDateTime/parse java-lang-CharSequence13671 java-time-format-DateTimeFormatter13672))) -(clojure.core/defn with-second {:arglists (quote (["java.time.ZonedDateTime" "int"]))} (^java.time.ZonedDateTime [^java.time.ZonedDateTime this13673 ^java.lang.Integer int13674] (.withSecond this13673 int13674))) -(clojure.core/defn to-local-date {:arglists (quote (["java.time.ZonedDateTime"]))} (^java.time.LocalDate [^java.time.ZonedDateTime this13675] (.toLocalDate this13675))) -(clojure.core/defn get-minute {:arglists (quote (["java.time.ZonedDateTime"]))} (^java.lang.Integer [^java.time.ZonedDateTime this13676] (.getMinute this13676))) -(clojure.core/defn hash-code {:arglists (quote (["java.time.ZonedDateTime"]))} (^java.lang.Integer [^java.time.ZonedDateTime this13677] (.hashCode this13677))) -(clojure.core/defn with {:arglists (quote (["java.time.ZonedDateTime" "java.time.temporal.TemporalField" "long"] ["java.time.ZonedDateTime" "java.time.temporal.TemporalAdjuster"]))} (^java.time.ZonedDateTime [^java.time.ZonedDateTime this13678 ^java.time.temporal.TemporalField java-time-temporal-TemporalField13679 ^long long13680] (.with this13678 java-time-temporal-TemporalField13679 long13680)) (^java.time.ZonedDateTime [^java.time.ZonedDateTime this13681 ^java.time.temporal.TemporalAdjuster java-time-temporal-TemporalAdjuster13682] (.with this13681 java-time-temporal-TemporalAdjuster13682))) -(clojure.core/defn now {:arglists (quote ([] ["java.time.Clock"] ["java.time.ZoneId"]))} (^java.time.ZonedDateTime [] (java.time.ZonedDateTime/now)) (^java.time.ZonedDateTime [G__13684] (clojure.core/cond (clojure.core/and (clojure.core/instance? java.time.Clock G__13684)) (clojure.core/let [G__13684 ^"java.time.Clock" G__13684] (java.time.ZonedDateTime/now G__13684)) (clojure.core/and (clojure.core/instance? java.time.ZoneId G__13684)) (clojure.core/let [G__13684 ^"java.time.ZoneId" G__13684] (java.time.ZonedDateTime/now G__13684)) :else (throw (java.lang.IllegalArgumentException. "no corresponding java.time method with these args"))))) -(clojure.core/defn to-local-date-time {:arglists (quote (["java.time.ZonedDateTime"]))} (^java.time.LocalDateTime [^java.time.ZonedDateTime this13685] (.toLocalDateTime this13685))) -(clojure.core/defn get-month-value {:arglists (quote (["java.time.ZonedDateTime"]))} (^java.lang.Integer [^java.time.ZonedDateTime this13686] (.getMonthValue this13686))) -(clojure.core/defn with-day-of-year {:arglists (quote (["java.time.ZonedDateTime" "int"]))} (^java.time.ZonedDateTime [^java.time.ZonedDateTime this13687 ^java.lang.Integer int13688] (.withDayOfYear this13687 int13688))) -(clojure.core/defn compare-to {:arglists (quote (["java.time.ZonedDateTime" "java.time.chrono.ChronoZonedDateTime"]))} (^java.lang.Integer [^java.time.ZonedDateTime this13689 ^java.time.chrono.ChronoZonedDateTime java-time-chrono-ChronoZonedDateTime13690] (.compareTo this13689 java-time-chrono-ChronoZonedDateTime13690))) -(clojure.core/defn of-strict {:arglists (quote (["java.time.LocalDateTime" "java.time.ZoneOffset" "java.time.ZoneId"]))} (^java.time.ZonedDateTime [^java.time.LocalDateTime java-time-LocalDateTime13691 ^java.time.ZoneOffset java-time-ZoneOffset13692 ^java.time.ZoneId java-time-ZoneId13693] (java.time.ZonedDateTime/ofStrict java-time-LocalDateTime13691 java-time-ZoneOffset13692 java-time-ZoneId13693))) -(clojure.core/defn get-month {:arglists (quote (["java.time.ZonedDateTime"]))} (^java.time.Month [^java.time.ZonedDateTime this13694] (.getMonth this13694))) -(clojure.core/defn of-instant {:arglists (quote (["java.time.Instant" "java.time.ZoneId"] ["java.time.LocalDateTime" "java.time.ZoneOffset" "java.time.ZoneId"]))} (^java.time.ZonedDateTime [^java.time.Instant java-time-Instant13695 ^java.time.ZoneId java-time-ZoneId13696] (java.time.ZonedDateTime/ofInstant java-time-Instant13695 java-time-ZoneId13696)) (^java.time.ZonedDateTime [^java.time.LocalDateTime java-time-LocalDateTime13697 ^java.time.ZoneOffset java-time-ZoneOffset13698 ^java.time.ZoneId java-time-ZoneId13699] (java.time.ZonedDateTime/ofInstant java-time-LocalDateTime13697 java-time-ZoneOffset13698 java-time-ZoneId13699))) -(clojure.core/defn plus-seconds {:arglists (quote (["java.time.ZonedDateTime" "long"]))} (^java.time.ZonedDateTime [^java.time.ZonedDateTime this13700 ^long long13701] (.plusSeconds this13700 long13701))) -(clojure.core/defn get {:arglists (quote (["java.time.ZonedDateTime" "java.time.temporal.TemporalField"]))} (^java.lang.Integer [^java.time.ZonedDateTime this13702 ^java.time.temporal.TemporalField java-time-temporal-TemporalField13703] (.get this13702 java-time-temporal-TemporalField13703))) -(clojure.core/defn equals {:arglists (quote (["java.time.ZonedDateTime" "java.lang.Object"]))} (^java.lang.Boolean [^java.time.ZonedDateTime this13704 ^java.lang.Object java-lang-Object13705] (.equals this13704 java-lang-Object13705))) -(clojure.core/defn format {:arglists (quote (["java.time.ZonedDateTime" "java.time.format.DateTimeFormatter"]))} (^java.lang.String [^java.time.ZonedDateTime this13706 ^java.time.format.DateTimeFormatter java-time-format-DateTimeFormatter13707] (.format this13706 java-time-format-DateTimeFormatter13707))) -(clojure.core/defn plus-years {:arglists (quote (["java.time.ZonedDateTime" "long"]))} (^java.time.ZonedDateTime [^java.time.ZonedDateTime this13708 ^long long13709] (.plusYears this13708 long13709))) -(clojure.core/defn minus-days {:arglists (quote (["java.time.ZonedDateTime" "long"]))} (^java.time.ZonedDateTime [^java.time.ZonedDateTime this13710 ^long long13711] (.minusDays this13710 long13711))) +(ns cljc.java-time.zoned-date-time + (:refer-clojure :exclude + [abs get range format min max next name resolve short]) + (:require [cljc.java-time.extn.calendar-awareness]) + (:import [java.time ZonedDateTime])) + +(defn minus-minutes + "Returns a copy of this {@code ZonedDateTime} with the specified number of minutes subtracted. + + This operates on the instant time-line, such that subtracting one minute will + always be a duration of one minute earlier. + This may cause the local date-time to change by an amount other than one minute. + Note that this is a different approach to that used by days, months and years. + + This instance is immutable and unaffected by this method call. + + @param minutes the minutes to subtract, may be negative + @return a {@code ZonedDateTime} based on this date-time with the minutes subtracted, not null + @throws DateTimeException if the result exceeds the supported date range" + {:arglists (quote (["java.time.ZonedDateTime" "long"]))} + (^java.time.ZonedDateTime [^java.time.ZonedDateTime this ^long minutes] + (.minusMinutes this minutes))) + +(defn truncated-to + "Returns a copy of this {@code ZonedDateTime} with the time truncated. + + Truncation returns a copy of the original date-time with fields + smaller than the specified unit set to zero. + For example, truncating with the {@link ChronoUnit#MINUTES minutes} unit + will set the second-of-minute and nano-of-second field to zero. + + The unit must have a {@linkplain TemporalUnit#getDuration() duration} + that divides into the length of a standard day without remainder. + This includes all supplied time units on {@link ChronoUnit} and + {@link ChronoUnit#DAYS DAYS}. Other units throw an exception. + + This operates on the local time-line, + {@link LocalDateTime#truncatedTo(TemporalUnit) truncating} + the underlying local date-time. This is then converted back to a + {@code ZonedDateTime}, using the zone ID to obtain the offset. + + When converting back to {@code ZonedDateTime}, if the local date-time is in an overlap, + then the offset will be retained if possible, otherwise the earlier offset will be used. + If in a gap, the local date-time will be adjusted forward by the length of the gap. + + This instance is immutable and unaffected by this method call. + + @param unit the unit to truncate to, not null + @return a {@code ZonedDateTime} based on this date-time with the time truncated, not null + @throws DateTimeException if unable to truncate + @throws UnsupportedTemporalTypeException if the unit is not supported" + {:arglists (quote (["java.time.ZonedDateTime" + "java.time.temporal.TemporalUnit"]))} + (^java.time.ZonedDateTime + [^java.time.ZonedDateTime this ^java.time.temporal.ChronoUnit unit] + (.truncatedTo this unit))) + +(defn minus-weeks + "Returns a copy of this {@code ZonedDateTime} with the specified number of weeks subtracted. + + This operates on the local time-line, + {@link LocalDateTime#minusWeeks(long) subtracting weeks} to the local date-time. + This is then converted back to a {@code ZonedDateTime}, using the zone ID + to obtain the offset. + + When converting back to {@code ZonedDateTime}, if the local date-time is in an overlap, + then the offset will be retained if possible, otherwise the earlier offset will be used. + If in a gap, the local date-time will be adjusted forward by the length of the gap. + + This instance is immutable and unaffected by this method call. + + @param weeks the weeks to subtract, may be negative + @return a {@code ZonedDateTime} based on this date-time with the weeks subtracted, not null + @throws DateTimeException if the result exceeds the supported date range" + {:arglists (quote (["java.time.ZonedDateTime" "long"]))} + (^java.time.ZonedDateTime [^java.time.ZonedDateTime this ^long weeks] + (.minusWeeks this weeks))) + +(defn to-instant + "Converts this date-time to an {@code Instant}. + + This returns an {@code Instant} representing the same point on the + time-line as this date-time. The calculation combines the + {@linkplain #toLocalDateTime() local date-time} and + {@linkplain #getOffset() offset}. + + @return an {@code Instant} representing the same instant, not null" + {:arglists (quote (["java.time.ZonedDateTime"]))} + (^java.time.Instant [^java.time.ZonedDateTime this] (.toInstant this))) + +(defn plus-weeks + "Returns a copy of this {@code ZonedDateTime} with the specified number of weeks added. + + This operates on the local time-line, + {@link LocalDateTime#plusWeeks(long) adding weeks} to the local date-time. + This is then converted back to a {@code ZonedDateTime}, using the zone ID + to obtain the offset. + + When converting back to {@code ZonedDateTime}, if the local date-time is in an overlap, + then the offset will be retained if possible, otherwise the earlier offset will be used. + If in a gap, the local date-time will be adjusted forward by the length of the gap. + + This instance is immutable and unaffected by this method call. + + @param weeks the weeks to add, may be negative + @return a {@code ZonedDateTime} based on this date-time with the weeks added, not null + @throws DateTimeException if the result exceeds the supported date range" + {:arglists (quote (["java.time.ZonedDateTime" "long"]))} + (^java.time.ZonedDateTime [^java.time.ZonedDateTime this ^long weeks] + (.plusWeeks this weeks))) + +(defn range + "Gets the range of valid values for the specified field. + + The range object expresses the minimum and maximum valid values for a field. + This date-time is used to enhance the accuracy of the returned range. + If it is not possible to return the range, because the field is not supported + or for some other reason, an exception is thrown. + + If the field is a {@link ChronoField} then the query is implemented here. + The {@link #isSupported(TemporalField) supported fields} will return + appropriate range instances. + All other {@code ChronoField} instances will throw an {@code UnsupportedTemporalTypeException}. + + If the field is not a {@code ChronoField}, then the result of this method + is obtained by invoking {@code TemporalField.rangeRefinedBy(TemporalAccessor)} + passing {@code this} as the argument. + Whether the range can be obtained is determined by the field. + + @param field the field to query the range for, not null + @return the range of valid values for the field, not null + @throws DateTimeException if the range for the field cannot be obtained + @throws UnsupportedTemporalTypeException if the field is not supported" + {:arglists (quote (["java.time.ZonedDateTime" + "java.time.temporal.TemporalField"]))} + (^java.time.temporal.ValueRange + [^java.time.ZonedDateTime this ^java.time.temporal.TemporalField field] + (.range this field))) + +(defn with-earlier-offset-at-overlap + "Returns a copy of this date-time changing the zone offset to the + earlier of the two valid offsets at a local time-line overlap. + + This method only has any effect when the local time-line overlaps, such as + at an autumn daylight savings cutover. In this scenario, there are two + valid offsets for the local date-time. Calling this method will return + a zoned date-time with the earlier of the two selected. + + If this method is called when it is not an overlap, {@code this} + is returned. + + This instance is immutable and unaffected by this method call. + + @return a {@code ZonedDateTime} based on this date-time with the earlier offset, not null" + {:arglists (quote (["java.time.ZonedDateTime"]))} + (^java.time.ZonedDateTime [^java.time.ZonedDateTime this] + (.withEarlierOffsetAtOverlap this))) + +(defn get-hour + "Gets the hour-of-day field. + + @return the hour-of-day, from 0 to 23" + {:arglists (quote (["java.time.ZonedDateTime"]))} + (^java.lang.Integer [^java.time.ZonedDateTime this] (.getHour this))) + +(defn minus-hours + "Returns a copy of this {@code ZonedDateTime} with the specified number of hours subtracted. + + This operates on the instant time-line, such that subtracting one hour will + always be a duration of one hour earlier. + This may cause the local date-time to change by an amount other than one hour. + Note that this is a different approach to that used by days, months and years, + thus subtracting one day is not the same as adding 24 hours. + + For example, consider a time-zone where the spring DST cutover means that the + local times 01:00 to 01:59 occur twice changing from offset +02:00 to +01:00. +
    +
  • Subtracting one hour from 02:30+01:00 will result in 01:30+02:00 +
  • Subtracting one hour from 01:30+01:00 will result in 01:30+02:00 +
  • Subtracting one hour from 01:30+02:00 will result in 00:30+01:00 +
  • Subtracting three hours from 02:30+01:00 will result in 00:30+02:00 +
+ + This instance is immutable and unaffected by this method call. + + @param hours the hours to subtract, may be negative + @return a {@code ZonedDateTime} based on this date-time with the hours subtracted, not null + @throws DateTimeException if the result exceeds the supported date range" + {:arglists (quote (["java.time.ZonedDateTime" "long"]))} + (^java.time.ZonedDateTime [^java.time.ZonedDateTime this ^long hours] + (.minusHours this hours))) + +(defn of + {:arglists + (quote (["java.time.LocalDateTime" "java.time.ZoneId"] + ["java.time.LocalDate" "java.time.LocalTime" "java.time.ZoneId"] + ["int" "int" "int" "int" "int" "int" "int" "java.time.ZoneId"]))} + (^java.time.ZonedDateTime + [^java.time.LocalDateTime local-date-time ^java.time.ZoneId zone] + (java.time.ZonedDateTime/of local-date-time zone)) + (^java.time.ZonedDateTime + [^java.time.LocalDate date ^java.time.LocalTime time ^java.time.ZoneId zone] + (java.time.ZonedDateTime/of date time zone)) + (^java.time.ZonedDateTime + [^java.lang.Integer year ^java.lang.Integer month + ^java.lang.Integer day-of-month ^java.lang.Integer hour + ^java.lang.Integer minute ^java.lang.Integer second + ^java.lang.Integer nano-of-second ^java.time.ZoneId zone] + (java.time.ZonedDateTime/of year + month + day-of-month + hour + minute + second + nano-of-second + zone))) + +(defn with-month + "Returns a copy of this {@code ZonedDateTime} with the month-of-year altered. + + This operates on the local time-line, + {@link LocalDateTime#withMonth(int) changing the month} of the local date-time. + This is then converted back to a {@code ZonedDateTime}, using the zone ID + to obtain the offset. + + When converting back to {@code ZonedDateTime}, if the local date-time is in an overlap, + then the offset will be retained if possible, otherwise the earlier offset will be used. + If in a gap, the local date-time will be adjusted forward by the length of the gap. + + This instance is immutable and unaffected by this method call. + + @param month the month-of-year to set in the result, from 1 (January) to 12 (December) + @return a {@code ZonedDateTime} based on this date-time with the requested month, not null + @throws DateTimeException if the month-of-year value is invalid" + {:arglists (quote (["java.time.ZonedDateTime" "int"]))} + (^java.time.ZonedDateTime + [^java.time.ZonedDateTime this ^java.lang.Integer month] + (.withMonth this month))) + +(defn is-equal + "Checks if the instant of this date-time is equal to that of the specified date-time. + + This method differs from the comparison in {@link #compareTo} and {@link #equals} + in that it only compares the instant of the date-time. This is equivalent to using + {@code dateTime1.toInstant().equals(dateTime2.toInstant());}. + + This default implementation performs the comparison based on the epoch-second + and nano-of-second. + + @param other the other date-time to compare to, not null + @return true if the instant equals the instant of the specified date-time" + {:arglists (quote (["java.time.ZonedDateTime" + "java.time.chrono.ChronoZonedDateTime"]))} + (^java.lang.Boolean + [^java.time.ZonedDateTime this ^java.time.chrono.ChronoZonedDateTime other] + (.isEqual this other))) + +(defn get-nano + "Gets the nano-of-second field. + + @return the nano-of-second, from 0 to 999,999,999" + {:arglists (quote (["java.time.ZonedDateTime"]))} + (^java.lang.Integer [^java.time.ZonedDateTime this] (.getNano this))) + +(defn of-local + "Obtains an instance of {@code ZonedDateTime} from a local date-time + using the preferred offset if possible. + + The local date-time is resolved to a single instant on the time-line. + This is achieved by finding a valid offset from UTC/Greenwich for the local + date-time as defined by the {@link ZoneRules rules} of the zone ID. + + In most cases, there is only one valid offset for a local date-time. + In the case of an overlap, where clocks are set back, there are two valid offsets. + If the preferred offset is one of the valid offsets then it is used. + Otherwise the earlier valid offset is used, typically corresponding to \"summer\". + + In the case of a gap, where clocks jump forward, there is no valid offset. + Instead, the local date-time is adjusted to be later by the length of the gap. + For a typical one hour daylight savings change, the local date-time will be + moved one hour later into the offset typically corresponding to \"summer\". + + @param localDateTime the local date-time, not null + @param zone the time-zone, not null + @param preferredOffset the zone offset, null if no preference + @return the zoned date-time, not null" + {:arglists (quote (["java.time.LocalDateTime" "java.time.ZoneId" + "java.time.ZoneOffset"]))} + (^java.time.ZonedDateTime + [^java.time.LocalDateTime local-date-time ^java.time.ZoneId zone + ^java.time.ZoneOffset preferred-offset] + (java.time.ZonedDateTime/ofLocal local-date-time zone preferred-offset))) + +(defn get-year + "Gets the year field. + + This method returns the primitive {@code int} value for the year. + + The year returned by this method is proleptic as per {@code get(YEAR)}. + To obtain the year-of-era, use {@code get(YEAR_OF_ERA)}. + + @return the year, from MIN_YEAR to MAX_YEAR" + {:arglists (quote (["java.time.ZonedDateTime"]))} + (^java.lang.Integer [^java.time.ZonedDateTime this] (.getYear this))) + +(defn minus-seconds + "Returns a copy of this {@code ZonedDateTime} with the specified number of seconds subtracted. + + This operates on the instant time-line, such that subtracting one second will + always be a duration of one second earlier. + This may cause the local date-time to change by an amount other than one second. + Note that this is a different approach to that used by days, months and years. + + This instance is immutable and unaffected by this method call. + + @param seconds the seconds to subtract, may be negative + @return a {@code ZonedDateTime} based on this date-time with the seconds subtracted, not null + @throws DateTimeException if the result exceeds the supported date range" + {:arglists (quote (["java.time.ZonedDateTime" "long"]))} + (^java.time.ZonedDateTime [^java.time.ZonedDateTime this ^long seconds] + (.minusSeconds this seconds))) + +(defn get-second + "Gets the second-of-minute field. + + @return the second-of-minute, from 0 to 59" + {:arglists (quote (["java.time.ZonedDateTime"]))} + (^java.lang.Integer [^java.time.ZonedDateTime this] (.getSecond this))) + +(defn plus-nanos + "Returns a copy of this {@code ZonedDateTime} with the specified number of nanoseconds added. + + This operates on the instant time-line, such that adding one nano will + always be a duration of one nano later. + This may cause the local date-time to change by an amount other than one nano. + Note that this is a different approach to that used by days, months and years. + + This instance is immutable and unaffected by this method call. + + @param nanos the nanos to add, may be negative + @return a {@code ZonedDateTime} based on this date-time with the nanoseconds added, not null + @throws DateTimeException if the result exceeds the supported date range" + {:arglists (quote (["java.time.ZonedDateTime" "long"]))} + (^java.time.ZonedDateTime [^java.time.ZonedDateTime this ^long nanos] + (.plusNanos this nanos))) + +(defn get-day-of-year + "Gets the day-of-year field. + + This method returns the primitive {@code int} value for the day-of-year. + + @return the day-of-year, from 1 to 365, or 366 in a leap year" + {:arglists (quote (["java.time.ZonedDateTime"]))} + (^java.lang.Integer [^java.time.ZonedDateTime this] (.getDayOfYear this))) + +(defn plus + {:arglists (quote (["java.time.ZonedDateTime" + "java.time.temporal.TemporalAmount"] + ["java.time.ZonedDateTime" "long" + "java.time.temporal.TemporalUnit"]))} + (^java.time.ZonedDateTime + [^java.time.ZonedDateTime this + ^java.time.temporal.TemporalAmount amount-to-add] + (.plus this amount-to-add)) + (^java.time.ZonedDateTime + [^java.time.ZonedDateTime this ^long amount-to-add + ^java.time.temporal.ChronoUnit unit] + (.plus this amount-to-add unit))) + +(defn with-hour + "Returns a copy of this {@code ZonedDateTime} with the hour-of-day altered. + + This operates on the local time-line, + {@linkplain LocalDateTime#withHour(int) changing the time} of the local date-time. + This is then converted back to a {@code ZonedDateTime}, using the zone ID + to obtain the offset. + + When converting back to {@code ZonedDateTime}, if the local date-time is in an overlap, + then the offset will be retained if possible, otherwise the earlier offset will be used. + If in a gap, the local date-time will be adjusted forward by the length of the gap. + + This instance is immutable and unaffected by this method call. + + @param hour the hour-of-day to set in the result, from 0 to 23 + @return a {@code ZonedDateTime} based on this date-time with the requested hour, not null + @throws DateTimeException if the hour value is invalid" + {:arglists (quote (["java.time.ZonedDateTime" "int"]))} + (^java.time.ZonedDateTime + [^java.time.ZonedDateTime this ^java.lang.Integer hour] + (.withHour this hour))) + +(defn with-minute + "Returns a copy of this {@code ZonedDateTime} with the minute-of-hour altered. + + This operates on the local time-line, + {@linkplain LocalDateTime#withMinute(int) changing the time} of the local date-time. + This is then converted back to a {@code ZonedDateTime}, using the zone ID + to obtain the offset. + + When converting back to {@code ZonedDateTime}, if the local date-time is in an overlap, + then the offset will be retained if possible, otherwise the earlier offset will be used. + If in a gap, the local date-time will be adjusted forward by the length of the gap. + + This instance is immutable and unaffected by this method call. + + @param minute the minute-of-hour to set in the result, from 0 to 59 + @return a {@code ZonedDateTime} based on this date-time with the requested minute, not null + @throws DateTimeException if the minute value is invalid" + {:arglists (quote (["java.time.ZonedDateTime" "int"]))} + (^java.time.ZonedDateTime + [^java.time.ZonedDateTime this ^java.lang.Integer minute] + (.withMinute this minute))) + +(defn plus-minutes + "Returns a copy of this {@code ZonedDateTime} with the specified number of minutes added. + + This operates on the instant time-line, such that adding one minute will + always be a duration of one minute later. + This may cause the local date-time to change by an amount other than one minute. + Note that this is a different approach to that used by days, months and years. + + This instance is immutable and unaffected by this method call. + + @param minutes the minutes to add, may be negative + @return a {@code ZonedDateTime} based on this date-time with the minutes added, not null + @throws DateTimeException if the result exceeds the supported date range" + {:arglists (quote (["java.time.ZonedDateTime" "long"]))} + (^java.time.ZonedDateTime [^java.time.ZonedDateTime this ^long minutes] + (.plusMinutes this minutes))) + +(defn query + "Queries this date-time using the specified query. + + This queries this date-time using the specified query strategy object. + The {@code TemporalQuery} object defines the logic to be used to + obtain the result. Read the documentation of the query to understand + what the result of this method will be. + + The result of this method is obtained by invoking the + {@link TemporalQuery#queryFrom(TemporalAccessor)} method on the + specified query passing {@code this} as the argument. + + @param the type of the result + @param query the query to invoke, not null + @return the query result, null may be returned (defined by the query) + @throws DateTimeException if unable to query (defined by the query) + @throws ArithmeticException if numeric overflow occurs (defined by the query)" + {:arglists (quote (["java.time.ZonedDateTime" + "java.time.temporal.TemporalQuery"]))} + (^java.lang.Object + [^java.time.ZonedDateTime this ^java.time.temporal.TemporalQuery query] + (.query this query))) + +(defn get-day-of-week + "Gets the day-of-week field, which is an enum {@code DayOfWeek}. + + This method returns the enum {@link DayOfWeek} for the day-of-week. + This avoids confusion as to what {@code int} values mean. + If you need access to the primitive {@code int} value then the enum + provides the {@link DayOfWeek#getValue() int value}. + + Additional information can be obtained from the {@code DayOfWeek}. + This includes textual names of the values. + + @return the day-of-week, not null" + {:arglists (quote (["java.time.ZonedDateTime"]))} + (^java.time.DayOfWeek [^java.time.ZonedDateTime this] (.getDayOfWeek this))) + +(defn to-string + "Outputs this date-time as a {@code String}, such as + {@code 2007-12-03T10:15:30+01:00[Europe/Paris]}. + + The format consists of the {@code LocalDateTime} followed by the {@code ZoneOffset}. + If the {@code ZoneId} is not the same as the offset, then the ID is output. + The output is compatible with ISO-8601 if the offset and ID are the same. + + @return a string representation of this date-time, not null" + {:arglists (quote (["java.time.ZonedDateTime"]))} + (^java.lang.String [^java.time.ZonedDateTime this] (.toString this))) + +(defn plus-months + "Returns a copy of this {@code ZonedDateTime} with the specified number of months added. + + This operates on the local time-line, + {@link LocalDateTime#plusMonths(long) adding months} to the local date-time. + This is then converted back to a {@code ZonedDateTime}, using the zone ID + to obtain the offset. + + When converting back to {@code ZonedDateTime}, if the local date-time is in an overlap, + then the offset will be retained if possible, otherwise the earlier offset will be used. + If in a gap, the local date-time will be adjusted forward by the length of the gap. + + This instance is immutable and unaffected by this method call. + + @param months the months to add, may be negative + @return a {@code ZonedDateTime} based on this date-time with the months added, not null + @throws DateTimeException if the result exceeds the supported date range" + {:arglists (quote (["java.time.ZonedDateTime" "long"]))} + (^java.time.ZonedDateTime [^java.time.ZonedDateTime this ^long months] + (.plusMonths this months))) + +(defn is-before + "Checks if the instant of this date-time is before that of the specified date-time. + + This method differs from the comparison in {@link #compareTo} in that it + only compares the instant of the date-time. This is equivalent to using + {@code dateTime1.toInstant().isBefore(dateTime2.toInstant());}. + + This default implementation performs the comparison based on the epoch-second + and nano-of-second. + + @param other the other date-time to compare to, not null + @return true if this point is before the specified date-time" + {:arglists (quote (["java.time.ZonedDateTime" + "java.time.chrono.ChronoZonedDateTime"]))} + (^java.lang.Boolean + [^java.time.ZonedDateTime this ^java.time.chrono.ChronoZonedDateTime other] + (.isBefore this other))) + +(defn minus-months + "Returns a copy of this {@code ZonedDateTime} with the specified number of months subtracted. + + This operates on the local time-line, + {@link LocalDateTime#minusMonths(long) subtracting months} to the local date-time. + This is then converted back to a {@code ZonedDateTime}, using the zone ID + to obtain the offset. + + When converting back to {@code ZonedDateTime}, if the local date-time is in an overlap, + then the offset will be retained if possible, otherwise the earlier offset will be used. + If in a gap, the local date-time will be adjusted forward by the length of the gap. + + This instance is immutable and unaffected by this method call. + + @param months the months to subtract, may be negative + @return a {@code ZonedDateTime} based on this date-time with the months subtracted, not null + @throws DateTimeException if the result exceeds the supported date range" + {:arglists (quote (["java.time.ZonedDateTime" "long"]))} + (^java.time.ZonedDateTime [^java.time.ZonedDateTime this ^long months] + (.minusMonths this months))) + +(defn minus + {:arglists (quote (["java.time.ZonedDateTime" + "java.time.temporal.TemporalAmount"] + ["java.time.ZonedDateTime" "long" + "java.time.temporal.TemporalUnit"]))} + (^java.time.ZonedDateTime + [^java.time.ZonedDateTime this + ^java.time.temporal.TemporalAmount amount-to-subtract] + (.minus this amount-to-subtract)) + (^java.time.ZonedDateTime + [^java.time.ZonedDateTime this ^long amount-to-subtract + ^java.time.temporal.ChronoUnit unit] + (.minus this amount-to-subtract unit))) + +(defn with-fixed-offset-zone + "Returns a copy of this date-time with the zone ID set to the offset. + + This returns a zoned date-time where the zone ID is the same as {@link #getOffset()}. + The local date-time, offset and instant of the result will be the same as in this date-time. + + Setting the date-time to a fixed single offset means that any future + calculations, such as addition or subtraction, have no complex edge cases + due to time-zone rules. + This might also be useful when sending a zoned date-time across a network, + as most protocols, such as ISO-8601, only handle offsets, + and not region-based zone IDs. + + This is equivalent to {@code ZonedDateTime.of(zdt.toLocalDateTime(), zdt.getOffset())}. + + @return a {@code ZonedDateTime} with the zone ID set to the offset, not null" + {:arglists (quote (["java.time.ZonedDateTime"]))} + (^java.time.ZonedDateTime [^java.time.ZonedDateTime this] + (.withFixedOffsetZone this))) + +(defn plus-hours + "Returns a copy of this {@code ZonedDateTime} with the specified number of hours added. + + This operates on the instant time-line, such that adding one hour will + always be a duration of one hour later. + This may cause the local date-time to change by an amount other than one hour. + Note that this is a different approach to that used by days, months and years, + thus adding one day is not the same as adding 24 hours. + + For example, consider a time-zone where the spring DST cutover means that the + local times 01:00 to 01:59 occur twice changing from offset +02:00 to +01:00. +
    +
  • Adding one hour to 00:30+02:00 will result in 01:30+02:00 +
  • Adding one hour to 01:30+02:00 will result in 01:30+01:00 +
  • Adding one hour to 01:30+01:00 will result in 02:30+01:00 +
  • Adding three hours to 00:30+02:00 will result in 02:30+01:00 +
+ + This instance is immutable and unaffected by this method call. + + @param hours the hours to add, may be negative + @return a {@code ZonedDateTime} based on this date-time with the hours added, not null + @throws DateTimeException if the result exceeds the supported date range" + {:arglists (quote (["java.time.ZonedDateTime" "long"]))} + (^java.time.ZonedDateTime [^java.time.ZonedDateTime this ^long hours] + (.plusHours this hours))) + +(defn with-zone-same-local + "Returns a copy of this date-time with a different time-zone, + retaining the local date-time if possible. + + This method changes the time-zone and retains the local date-time. + The local date-time is only changed if it is invalid for the new zone, + determined using the same approach as + {@link #ofLocal(LocalDateTime, ZoneId, ZoneOffset)}. + + To change the zone and adjust the local date-time, + use {@link #withZoneSameInstant(ZoneId)}. + + This instance is immutable and unaffected by this method call. + + @param zone the time-zone to change to, not null + @return a {@code ZonedDateTime} based on this date-time with the requested zone, not null" + {:arglists (quote (["java.time.ZonedDateTime" "java.time.ZoneId"]))} + (^java.time.ZonedDateTime + [^java.time.ZonedDateTime this ^java.time.ZoneId zone] + (.withZoneSameLocal this zone))) + +(defn with-zone-same-instant + "Returns a copy of this date-time with a different time-zone, + retaining the instant. + + This method changes the time-zone and retains the instant. + This normally results in a change to the local date-time. + + This method is based on retaining the same instant, thus gaps and overlaps + in the local time-line have no effect on the result. + + To change the offset while keeping the local time, + use {@link #withZoneSameLocal(ZoneId)}. + + @param zone the time-zone to change to, not null + @return a {@code ZonedDateTime} based on this date-time with the requested zone, not null + @throws DateTimeException if the result exceeds the supported date range" + {:arglists (quote (["java.time.ZonedDateTime" "java.time.ZoneId"]))} + (^java.time.ZonedDateTime + [^java.time.ZonedDateTime this ^java.time.ZoneId zone] + (.withZoneSameInstant this zone))) + +(defn plus-days + "Returns a copy of this {@code ZonedDateTime} with the specified number of days added. + + This operates on the local time-line, + {@link LocalDateTime#plusDays(long) adding days} to the local date-time. + This is then converted back to a {@code ZonedDateTime}, using the zone ID + to obtain the offset. + + When converting back to {@code ZonedDateTime}, if the local date-time is in an overlap, + then the offset will be retained if possible, otherwise the earlier offset will be used. + If in a gap, the local date-time will be adjusted forward by the length of the gap. + + This instance is immutable and unaffected by this method call. + + @param days the days to add, may be negative + @return a {@code ZonedDateTime} based on this date-time with the days added, not null + @throws DateTimeException if the result exceeds the supported date range" + {:arglists (quote (["java.time.ZonedDateTime" "long"]))} + (^java.time.ZonedDateTime [^java.time.ZonedDateTime this ^long days] + (.plusDays this days))) + +(defn to-local-time + "Gets the {@code LocalTime} part of this date-time. + + This returns a {@code LocalTime} with the same hour, minute, second and + nanosecond as this date-time. + + @return the time part of this date-time, not null" + {:arglists (quote (["java.time.ZonedDateTime"]))} + (^java.time.LocalTime [^java.time.ZonedDateTime this] (.toLocalTime this))) + +(defn get-long + "Gets the value of the specified field from this date-time as a {@code long}. + + This queries this date-time for the value of the specified field. + If it is not possible to return the value, because the field is not supported + or for some other reason, an exception is thrown. + + If the field is a {@link ChronoField} then the query is implemented here. + The {@link #isSupported(TemporalField) supported fields} will return valid + values based on this date-time. + All other {@code ChronoField} instances will throw an {@code UnsupportedTemporalTypeException}. + + If the field is not a {@code ChronoField}, then the result of this method + is obtained by invoking {@code TemporalField.getFrom(TemporalAccessor)} + passing {@code this} as the argument. Whether the value can be obtained, + and what the value represents, is determined by the field. + + @param field the field to get, not null + @return the value for the field + @throws DateTimeException if a value for the field cannot be obtained + @throws UnsupportedTemporalTypeException if the field is not supported + @throws ArithmeticException if numeric overflow occurs" + {:arglists (quote (["java.time.ZonedDateTime" + "java.time.temporal.TemporalField"]))} + (^long [^java.time.ZonedDateTime this ^java.time.temporal.TemporalField field] + (.getLong this field))) + +(defn get-offset + "Gets the zone offset, such as '+01:00'. + + This is the offset of the local date-time from UTC/Greenwich. + + @return the zone offset, not null" + {:arglists (quote (["java.time.ZonedDateTime"]))} + (^java.time.ZoneOffset [^java.time.ZonedDateTime this] (.getOffset this))) + +(defn with-year + "Returns a copy of this {@code ZonedDateTime} with the year altered. + + This operates on the local time-line, + {@link LocalDateTime#withYear(int) changing the year} of the local date-time. + This is then converted back to a {@code ZonedDateTime}, using the zone ID + to obtain the offset. + + When converting back to {@code ZonedDateTime}, if the local date-time is in an overlap, + then the offset will be retained if possible, otherwise the earlier offset will be used. + If in a gap, the local date-time will be adjusted forward by the length of the gap. + + This instance is immutable and unaffected by this method call. + + @param year the year to set in the result, from MIN_YEAR to MAX_YEAR + @return a {@code ZonedDateTime} based on this date-time with the requested year, not null + @throws DateTimeException if the year value is invalid" + {:arglists (quote (["java.time.ZonedDateTime" "int"]))} + (^java.time.ZonedDateTime + [^java.time.ZonedDateTime this ^java.lang.Integer year] + (.withYear this year))) + +(defn with-nano + "Returns a copy of this {@code ZonedDateTime} with the nano-of-second altered. + + This operates on the local time-line, + {@linkplain LocalDateTime#withNano(int) changing the time} of the local date-time. + This is then converted back to a {@code ZonedDateTime}, using the zone ID + to obtain the offset. + + When converting back to {@code ZonedDateTime}, if the local date-time is in an overlap, + then the offset will be retained if possible, otherwise the earlier offset will be used. + If in a gap, the local date-time will be adjusted forward by the length of the gap. + + This instance is immutable and unaffected by this method call. + + @param nanoOfSecond the nano-of-second to set in the result, from 0 to 999,999,999 + @return a {@code ZonedDateTime} based on this date-time with the requested nanosecond, not null + @throws DateTimeException if the nano value is invalid" + {:arglists (quote (["java.time.ZonedDateTime" "int"]))} + (^java.time.ZonedDateTime + [^java.time.ZonedDateTime this ^java.lang.Integer nano-of-second] + (.withNano this nano-of-second))) + +(defn to-epoch-second + "Converts this date-time to the number of seconds from the epoch + of 1970-01-01T00:00:00Z. + + This uses the {@linkplain #toLocalDateTime() local date-time} and + {@linkplain #getOffset() offset} to calculate the epoch-second value, + which is the number of elapsed seconds from 1970-01-01T00:00:00Z. + Instants on the time-line after the epoch are positive, earlier are negative. + + @return the number of seconds from the epoch of 1970-01-01T00:00:00Z" + {:arglists (quote (["java.time.ZonedDateTime"]))} + (^long [^java.time.ZonedDateTime this] (.toEpochSecond this))) + +(defn to-offset-date-time + "Converts this date-time to an {@code OffsetDateTime}. + + This creates an offset date-time using the local date-time and offset. + The zone ID is ignored. + + @return an offset date-time representing the same local date-time and offset, not null" + {:arglists (quote (["java.time.ZonedDateTime"]))} + (^java.time.OffsetDateTime [^java.time.ZonedDateTime this] + (.toOffsetDateTime this))) + +(defn with-later-offset-at-overlap + "Returns a copy of this date-time changing the zone offset to the + later of the two valid offsets at a local time-line overlap. + + This method only has any effect when the local time-line overlaps, such as + at an autumn daylight savings cutover. In this scenario, there are two + valid offsets for the local date-time. Calling this method will return + a zoned date-time with the later of the two selected. + + If this method is called when it is not an overlap, {@code this} + is returned. + + This instance is immutable and unaffected by this method call. + + @return a {@code ZonedDateTime} based on this date-time with the later offset, not null" + {:arglists (quote (["java.time.ZonedDateTime"]))} + (^java.time.ZonedDateTime [^java.time.ZonedDateTime this] + (.withLaterOffsetAtOverlap this))) + +(defn until + "Calculates the amount of time until another date-time in terms of the specified unit. + + This calculates the amount of time between two {@code ZonedDateTime} + objects in terms of a single {@code TemporalUnit}. + The start and end points are {@code this} and the specified date-time. + The result will be negative if the end is before the start. + For example, the amount in days between two date-times can be calculated + using {@code startDateTime.until(endDateTime, DAYS)}. + + The {@code Temporal} passed to this method is converted to a + {@code ZonedDateTime} using {@link #from(TemporalAccessor)}. + If the time-zone differs between the two zoned date-times, the specified + end date-time is normalized to have the same zone as this date-time. + + The calculation returns a whole number, representing the number of + complete units between the two date-times. + For example, the amount in months between 2012-06-15T00:00Z and 2012-08-14T23:59Z + will only be one month as it is one minute short of two months. + + There are two equivalent ways of using this method. + The first is to invoke this method. + The second is to use {@link TemporalUnit#between(Temporal, Temporal)}: +
+   // these two lines are equivalent
+   amount = start.until(end, MONTHS);
+   amount = MONTHS.between(start, end);
+ 
+ The choice should be made based on which makes the code more readable. + + The calculation is implemented in this method for {@link ChronoUnit}. + The units {@code NANOS}, {@code MICROS}, {@code MILLIS}, {@code SECONDS}, + {@code MINUTES}, {@code HOURS} and {@code HALF_DAYS}, {@code DAYS}, + {@code WEEKS}, {@code MONTHS}, {@code YEARS}, {@code DECADES}, + {@code CENTURIES}, {@code MILLENNIA} and {@code ERAS} are supported. + Other {@code ChronoUnit} values will throw an exception. + + The calculation for date and time units differ. + + Date units operate on the local time-line, using the local date-time. + For example, the period from noon on day 1 to noon the following day + in days will always be counted as exactly one day, irrespective of whether + there was a daylight savings change or not. + + Time units operate on the instant time-line. + The calculation effectively converts both zoned date-times to instants + and then calculates the period between the instants. + For example, the period from noon on day 1 to noon the following day + in hours may be 23, 24 or 25 hours (or some other amount) depending on + whether there was a daylight savings change or not. + + If the unit is not a {@code ChronoUnit}, then the result of this method + is obtained by invoking {@code TemporalUnit.between(Temporal, Temporal)} + passing {@code this} as the first argument and the converted input temporal + as the second argument. + + This instance is immutable and unaffected by this method call. + + @param endExclusive the end date, exclusive, which is converted to a {@code ZonedDateTime}, not null + @param unit the unit to measure the amount in, not null + @return the amount of time between this date-time and the end date-time + @throws DateTimeException if the amount cannot be calculated, or the end + temporal cannot be converted to a {@code ZonedDateTime} + @throws UnsupportedTemporalTypeException if the unit is not supported + @throws ArithmeticException if numeric overflow occurs" + {:arglists (quote (["java.time.ZonedDateTime" "java.time.temporal.Temporal" + "java.time.temporal.TemporalUnit"]))} + (^long + [^java.time.ZonedDateTime this ^java.time.temporal.Temporal end-exclusive + ^java.time.temporal.ChronoUnit unit] + (.until this end-exclusive unit))) + +(defn get-zone + "Gets the time-zone, such as 'Europe/Paris'. + + This returns the zone ID. This identifies the time-zone {@link ZoneRules rules} + that determine when and how the offset from UTC/Greenwich changes. + + The zone ID may be same as the {@linkplain #getOffset() offset}. + If this is true, then any future calculations, such as addition or subtraction, + have no complex edge cases due to time-zone rules. + See also {@link #withFixedOffsetZone()}. + + @return the time-zone, not null" + {:arglists (quote (["java.time.ZonedDateTime"]))} + (^java.time.ZoneId [^java.time.ZonedDateTime this] (.getZone this))) + +(defn with-day-of-month + "Returns a copy of this {@code ZonedDateTime} with the day-of-month altered. + + This operates on the local time-line, + {@link LocalDateTime#withDayOfMonth(int) changing the day-of-month} of the local date-time. + This is then converted back to a {@code ZonedDateTime}, using the zone ID + to obtain the offset. + + When converting back to {@code ZonedDateTime}, if the local date-time is in an overlap, + then the offset will be retained if possible, otherwise the earlier offset will be used. + If in a gap, the local date-time will be adjusted forward by the length of the gap. + + This instance is immutable and unaffected by this method call. + + @param dayOfMonth the day-of-month to set in the result, from 1 to 28-31 + @return a {@code ZonedDateTime} based on this date-time with the requested day, not null + @throws DateTimeException if the day-of-month value is invalid, + or if the day-of-month is invalid for the month-year" + {:arglists (quote (["java.time.ZonedDateTime" "int"]))} + (^java.time.ZonedDateTime + [^java.time.ZonedDateTime this ^java.lang.Integer day-of-month] + (.withDayOfMonth this day-of-month))) + +(defn get-day-of-month + "Gets the day-of-month field. + + This method returns the primitive {@code int} value for the day-of-month. + + @return the day-of-month, from 1 to 31" + {:arglists (quote (["java.time.ZonedDateTime"]))} + (^java.lang.Integer [^java.time.ZonedDateTime this] (.getDayOfMonth this))) + +(defn from + "Obtains an instance of {@code ZonedDateTime} from a temporal object. + + This obtains a zoned date-time based on the specified temporal. + A {@code TemporalAccessor} represents an arbitrary set of date and time information, + which this factory converts to an instance of {@code ZonedDateTime}. + + The conversion will first obtain a {@code ZoneId} from the temporal object, + falling back to a {@code ZoneOffset} if necessary. It will then try to obtain + an {@code Instant}, falling back to a {@code LocalDateTime} if necessary. + The result will be either the combination of {@code ZoneId} or {@code ZoneOffset} + with {@code Instant} or {@code LocalDateTime}. + Implementations are permitted to perform optimizations such as accessing + those fields that are equivalent to the relevant objects. + + This method matches the signature of the functional interface {@link TemporalQuery} + allowing it to be used as a query via method reference, {@code ZonedDateTime::from}. + + @param temporal the temporal object to convert, not null + @return the zoned date-time, not null + @throws DateTimeException if unable to convert to an {@code ZonedDateTime}" + {:arglists (quote (["java.time.temporal.TemporalAccessor"]))} + (^java.time.ZonedDateTime [^java.time.temporal.TemporalAccessor temporal] + (java.time.ZonedDateTime/from temporal))) + +(defn is-after + "Checks if the instant of this date-time is after that of the specified date-time. + + This method differs from the comparison in {@link #compareTo} in that it + only compares the instant of the date-time. This is equivalent to using + {@code dateTime1.toInstant().isAfter(dateTime2.toInstant());}. + + This default implementation performs the comparison based on the epoch-second + and nano-of-second. + + @param other the other date-time to compare to, not null + @return true if this is after the specified date-time" + {:arglists (quote (["java.time.ZonedDateTime" + "java.time.chrono.ChronoZonedDateTime"]))} + (^java.lang.Boolean + [^java.time.ZonedDateTime this ^java.time.chrono.ChronoZonedDateTime other] + (.isAfter this other))) + +(defn minus-nanos + "Returns a copy of this {@code ZonedDateTime} with the specified number of nanoseconds subtracted. + + This operates on the instant time-line, such that subtracting one nano will + always be a duration of one nano earlier. + This may cause the local date-time to change by an amount other than one nano. + Note that this is a different approach to that used by days, months and years. + + This instance is immutable and unaffected by this method call. + + @param nanos the nanos to subtract, may be negative + @return a {@code ZonedDateTime} based on this date-time with the nanoseconds subtracted, not null + @throws DateTimeException if the result exceeds the supported date range" + {:arglists (quote (["java.time.ZonedDateTime" "long"]))} + (^java.time.ZonedDateTime [^java.time.ZonedDateTime this ^long nanos] + (.minusNanos this nanos))) + +(defn is-supported + {:arglists (quote + (["java.time.ZonedDateTime" "java.time.temporal.TemporalField"] + ["java.time.ZonedDateTime" "java.time.temporal.TemporalUnit"]))} + (^java.lang.Boolean [^java.time.ZonedDateTime this arg0] + (cond (instance? java.time.temporal.TemporalField arg0) + (let [^java.time.temporal.TemporalField field arg0] + (.isSupported this field)) + (instance? java.time.temporal.ChronoUnit arg0) + (let [^java.time.temporal.TemporalUnit unit arg0] + (.isSupported this unit)) + :else (throw (java.lang.IllegalArgumentException. + "no corresponding java.time method with these args"))))) + +(defn minus-years + "Returns a copy of this {@code ZonedDateTime} with the specified number of years subtracted. + + This operates on the local time-line, + {@link LocalDateTime#minusYears(long) subtracting years} to the local date-time. + This is then converted back to a {@code ZonedDateTime}, using the zone ID + to obtain the offset. + + When converting back to {@code ZonedDateTime}, if the local date-time is in an overlap, + then the offset will be retained if possible, otherwise the earlier offset will be used. + If in a gap, the local date-time will be adjusted forward by the length of the gap. + + This instance is immutable and unaffected by this method call. + + @param years the years to subtract, may be negative + @return a {@code ZonedDateTime} based on this date-time with the years subtracted, not null + @throws DateTimeException if the result exceeds the supported date range" + {:arglists (quote (["java.time.ZonedDateTime" "long"]))} + (^java.time.ZonedDateTime [^java.time.ZonedDateTime this ^long years] + (.minusYears this years))) + +(defn get-chronology + "Gets the chronology of this date-time. + + The {@code Chronology} represents the calendar system in use. + The era and other fields in {@link ChronoField} are defined by the chronology. + + @return the chronology, not null" + {:arglists (quote (["java.time.ZonedDateTime"]))} + (^java.time.chrono.Chronology [^java.time.ZonedDateTime this] + (.getChronology this))) + +(defn parse + {:arglists (quote (["java.lang.CharSequence"] + ["java.lang.CharSequence" + "java.time.format.DateTimeFormatter"]))} + (^java.time.ZonedDateTime [^java.lang.CharSequence text] + (java.time.ZonedDateTime/parse text)) + (^java.time.ZonedDateTime + [^java.lang.CharSequence text ^java.time.format.DateTimeFormatter formatter] + (java.time.ZonedDateTime/parse text formatter))) + +(defn with-second + "Returns a copy of this {@code ZonedDateTime} with the second-of-minute altered. + + This operates on the local time-line, + {@linkplain LocalDateTime#withSecond(int) changing the time} of the local date-time. + This is then converted back to a {@code ZonedDateTime}, using the zone ID + to obtain the offset. + + When converting back to {@code ZonedDateTime}, if the local date-time is in an overlap, + then the offset will be retained if possible, otherwise the earlier offset will be used. + If in a gap, the local date-time will be adjusted forward by the length of the gap. + + This instance is immutable and unaffected by this method call. + + @param second the second-of-minute to set in the result, from 0 to 59 + @return a {@code ZonedDateTime} based on this date-time with the requested second, not null + @throws DateTimeException if the second value is invalid" + {:arglists (quote (["java.time.ZonedDateTime" "int"]))} + (^java.time.ZonedDateTime + [^java.time.ZonedDateTime this ^java.lang.Integer second] + (.withSecond this second))) + +(defn to-local-date + "Gets the {@code LocalDate} part of this date-time. + + This returns a {@code LocalDate} with the same year, month and day + as this date-time. + + @return the date part of this date-time, not null" + {:arglists (quote (["java.time.ZonedDateTime"]))} + (^java.time.LocalDate [^java.time.ZonedDateTime this] (.toLocalDate this))) + +(defn get-minute + "Gets the minute-of-hour field. + + @return the minute-of-hour, from 0 to 59" + {:arglists (quote (["java.time.ZonedDateTime"]))} + (^java.lang.Integer [^java.time.ZonedDateTime this] (.getMinute this))) + +(defn hash-code + "A hash code for this date-time. + + @return a suitable hash code" + {:arglists (quote (["java.time.ZonedDateTime"]))} + (^java.lang.Integer [^java.time.ZonedDateTime this] (.hashCode this))) + +(defn with + {:arglists (quote (["java.time.ZonedDateTime" + "java.time.temporal.TemporalAdjuster"] + ["java.time.ZonedDateTime" + "java.time.temporal.TemporalField" "long"]))} + (^java.time.ZonedDateTime + [^java.time.ZonedDateTime this ^java.time.temporal.TemporalAdjuster adjuster] + (.with this adjuster)) + (^java.time.ZonedDateTime + [^java.time.ZonedDateTime this ^java.time.temporal.TemporalField field + ^long new-value] + (.with this field new-value))) + +(defn now + {:arglists (quote ([] ["java.time.Clock"] ["java.time.ZoneId"]))} + (^java.time.ZonedDateTime [] (java.time.ZonedDateTime/now)) + (^java.time.ZonedDateTime [arg0] + (cond (instance? java.time.Clock arg0) (let [^java.time.Clock clock arg0] + (java.time.ZonedDateTime/now clock)) + (instance? java.time.ZoneId arg0) (let [^java.time.ZoneId zone arg0] + (java.time.ZonedDateTime/now zone)) + :else (throw (java.lang.IllegalArgumentException. + "no corresponding java.time method with these args"))))) + +(defn to-local-date-time + "Gets the {@code LocalDateTime} part of this date-time. + + This returns a {@code LocalDateTime} with the same year, month, day and time + as this date-time. + + @return the local date-time part of this date-time, not null" + {:arglists (quote (["java.time.ZonedDateTime"]))} + (^java.time.LocalDateTime [^java.time.ZonedDateTime this] + (.toLocalDateTime this))) + +(defn get-month-value + "Gets the month-of-year field from 1 to 12. + + This method returns the month as an {@code int} from 1 to 12. + Application code is frequently clearer if the enum {@link Month} + is used by calling {@link #getMonth()}. + + @return the month-of-year, from 1 to 12 + @see #getMonth()" + {:arglists (quote (["java.time.ZonedDateTime"]))} + (^java.lang.Integer [^java.time.ZonedDateTime this] (.getMonthValue this))) + +(defn with-day-of-year + "Returns a copy of this {@code ZonedDateTime} with the day-of-year altered. + + This operates on the local time-line, + {@link LocalDateTime#withDayOfYear(int) changing the day-of-year} of the local date-time. + This is then converted back to a {@code ZonedDateTime}, using the zone ID + to obtain the offset. + + When converting back to {@code ZonedDateTime}, if the local date-time is in an overlap, + then the offset will be retained if possible, otherwise the earlier offset will be used. + If in a gap, the local date-time will be adjusted forward by the length of the gap. + + This instance is immutable and unaffected by this method call. + + @param dayOfYear the day-of-year to set in the result, from 1 to 365-366 + @return a {@code ZonedDateTime} based on this date with the requested day, not null + @throws DateTimeException if the day-of-year value is invalid, + or if the day-of-year is invalid for the year" + {:arglists (quote (["java.time.ZonedDateTime" "int"]))} + (^java.time.ZonedDateTime + [^java.time.ZonedDateTime this ^java.lang.Integer day-of-year] + (.withDayOfYear this day-of-year))) + +(defn compare-to + "Compares this date-time to another date-time, including the chronology. + + The comparison is based first on the instant, then on the local date-time, + then on the zone ID, then on the chronology. + It is \"consistent with equals\", as defined by {@link Comparable}. + + If all the date-time objects being compared are in the same chronology, then the + additional chronology stage is not required. + + This default implementation performs the comparison defined above. + + @param other the other date-time to compare to, not null + @return the comparator value, negative if less, positive if greater" + {:arglists (quote (["java.time.ZonedDateTime" + "java.time.chrono.ChronoZonedDateTime"]))} + (^java.lang.Integer + [^java.time.ZonedDateTime this ^java.time.chrono.ChronoZonedDateTime other] + (.compareTo this other))) + +(defn of-strict + "Obtains an instance of {@code ZonedDateTime} strictly validating the + combination of local date-time, offset and zone ID. + + This creates a zoned date-time ensuring that the offset is valid for the + local date-time according to the rules of the specified zone. + If the offset is invalid, an exception is thrown. + + @param localDateTime the local date-time, not null + @param offset the zone offset, not null + @param zone the time-zone, not null + @return the zoned date-time, not null" + {:arglists (quote (["java.time.LocalDateTime" "java.time.ZoneOffset" + "java.time.ZoneId"]))} + (^java.time.ZonedDateTime + [^java.time.LocalDateTime local-date-time ^java.time.ZoneOffset offset + ^java.time.ZoneId zone] + (java.time.ZonedDateTime/ofStrict local-date-time offset zone))) + +(defn get-month + "Gets the month-of-year field using the {@code Month} enum. + + This method returns the enum {@link Month} for the month. + This avoids confusion as to what {@code int} values mean. + If you need access to the primitive {@code int} value then the enum + provides the {@link Month#getValue() int value}. + + @return the month-of-year, not null + @see #getMonthValue()" + {:arglists (quote (["java.time.ZonedDateTime"]))} + (^java.time.Month [^java.time.ZonedDateTime this] (.getMonth this))) + +(defn of-instant + {:arglists (quote (["java.time.Instant" "java.time.ZoneId"] + ["java.time.LocalDateTime" "java.time.ZoneOffset" + "java.time.ZoneId"]))} + (^java.time.ZonedDateTime [^java.time.Instant instant ^java.time.ZoneId zone] + (java.time.ZonedDateTime/ofInstant instant zone)) + (^java.time.ZonedDateTime + [^java.time.LocalDateTime local-date-time ^java.time.ZoneOffset offset + ^java.time.ZoneId zone] + (java.time.ZonedDateTime/ofInstant local-date-time offset zone))) + +(defn plus-seconds + "Returns a copy of this {@code ZonedDateTime} with the specified number of seconds added. + + This operates on the instant time-line, such that adding one second will + always be a duration of one second later. + This may cause the local date-time to change by an amount other than one second. + Note that this is a different approach to that used by days, months and years. + + This instance is immutable and unaffected by this method call. + + @param seconds the seconds to add, may be negative + @return a {@code ZonedDateTime} based on this date-time with the seconds added, not null + @throws DateTimeException if the result exceeds the supported date range" + {:arglists (quote (["java.time.ZonedDateTime" "long"]))} + (^java.time.ZonedDateTime [^java.time.ZonedDateTime this ^long seconds] + (.plusSeconds this seconds))) + +(defn get + "Gets the value of the specified field from this date-time as an {@code int}. + + This queries this date-time for the value of the specified field. + The returned value will always be within the valid range of values for the field. + If it is not possible to return the value, because the field is not supported + or for some other reason, an exception is thrown. + + If the field is a {@link ChronoField} then the query is implemented here. + The {@link #isSupported(TemporalField) supported fields} will return valid + values based on this date-time, except {@code NANO_OF_DAY}, {@code MICRO_OF_DAY}, + {@code EPOCH_DAY}, {@code PROLEPTIC_MONTH} and {@code INSTANT_SECONDS} which are too + large to fit in an {@code int} and throw a {@code DateTimeException}. + All other {@code ChronoField} instances will throw an {@code UnsupportedTemporalTypeException}. + + If the field is not a {@code ChronoField}, then the result of this method + is obtained by invoking {@code TemporalField.getFrom(TemporalAccessor)} + passing {@code this} as the argument. Whether the value can be obtained, + and what the value represents, is determined by the field. + + @param field the field to get, not null + @return the value for the field + @throws DateTimeException if a value for the field cannot be obtained or + the value is outside the range of valid values for the field + @throws UnsupportedTemporalTypeException if the field is not supported or + the range of values exceeds an {@code int} + @throws ArithmeticException if numeric overflow occurs" + {:arglists (quote (["java.time.ZonedDateTime" + "java.time.temporal.TemporalField"]))} + (^java.lang.Integer + [^java.time.ZonedDateTime this ^java.time.temporal.TemporalField field] + (.get this field))) + +(defn equals + "Checks if this date-time is equal to another date-time. + + The comparison is based on the offset date-time and the zone. + Only objects of type {@code ZonedDateTime} are compared, other types return false. + + @param obj the object to check, null returns false + @return true if this is equal to the other date-time" + {:arglists (quote (["java.time.ZonedDateTime" "java.lang.Object"]))} + (^java.lang.Boolean [^java.time.ZonedDateTime this ^java.lang.Object obj] + (.equals this obj))) + +(defn format + "Formats this date-time using the specified formatter. + + This date-time will be passed to the formatter to produce a string. + + @param formatter the formatter to use, not null + @return the formatted date-time string, not null + @throws DateTimeException if an error occurs during printing" + {:arglists (quote (["java.time.ZonedDateTime" + "java.time.format.DateTimeFormatter"]))} + (^java.lang.String + [^java.time.ZonedDateTime this ^java.time.format.DateTimeFormatter formatter] + (.format this formatter))) + +(defn plus-years + "Returns a copy of this {@code ZonedDateTime} with the specified number of years added. + + This operates on the local time-line, + {@link LocalDateTime#plusYears(long) adding years} to the local date-time. + This is then converted back to a {@code ZonedDateTime}, using the zone ID + to obtain the offset. + + When converting back to {@code ZonedDateTime}, if the local date-time is in an overlap, + then the offset will be retained if possible, otherwise the earlier offset will be used. + If in a gap, the local date-time will be adjusted forward by the length of the gap. + + This instance is immutable and unaffected by this method call. + + @param years the years to add, may be negative + @return a {@code ZonedDateTime} based on this date-time with the years added, not null + @throws DateTimeException if the result exceeds the supported date range" + {:arglists (quote (["java.time.ZonedDateTime" "long"]))} + (^java.time.ZonedDateTime [^java.time.ZonedDateTime this ^long years] + (.plusYears this years))) + +(defn minus-days + "Returns a copy of this {@code ZonedDateTime} with the specified number of days subtracted. + + This operates on the local time-line, + {@link LocalDateTime#minusDays(long) subtracting days} to the local date-time. + This is then converted back to a {@code ZonedDateTime}, using the zone ID + to obtain the offset. + + When converting back to {@code ZonedDateTime}, if the local date-time is in an overlap, + then the offset will be retained if possible, otherwise the earlier offset will be used. + If in a gap, the local date-time will be adjusted forward by the length of the gap. + + This instance is immutable and unaffected by this method call. + + @param days the days to subtract, may be negative + @return a {@code ZonedDateTime} based on this date-time with the days subtracted, not null + @throws DateTimeException if the result exceeds the supported date range" + {:arglists (quote (["java.time.ZonedDateTime" "long"]))} + (^java.time.ZonedDateTime [^java.time.ZonedDateTime this ^long days] + (.minusDays this days))) diff --git a/src/cljc/java_time/zoned_date_time.cljs b/src/cljc/java_time/zoned_date_time.cljs index 66486ed..a0a9255 100644 --- a/src/cljc/java_time/zoned_date_time.cljs +++ b/src/cljc/java_time/zoned_date_time.cljs @@ -1,74 +1,1305 @@ -(ns cljc.java-time.zoned-date-time (:refer-clojure :exclude [abs get range format min max next name resolve short]) (:require [cljc.java-time.extn.calendar-awareness] [goog.object] [java.time :refer [ZonedDateTime]])) -(clojure.core/defn minus-minutes {:arglists (quote (["java.time.ZonedDateTime" "long"]))} (^js/JSJoda.ZonedDateTime [^js/JSJoda.ZonedDateTime this13712 ^long long13713] (.minusMinutes this13712 long13713))) -(clojure.core/defn truncated-to {:arglists (quote (["java.time.ZonedDateTime" "java.time.temporal.TemporalUnit"]))} (^js/JSJoda.ZonedDateTime [^js/JSJoda.ZonedDateTime this13714 ^js/JSJoda.TemporalUnit java-time-temporal-TemporalUnit13715] (.truncatedTo this13714 java-time-temporal-TemporalUnit13715))) -(clojure.core/defn minus-weeks {:arglists (quote (["java.time.ZonedDateTime" "long"]))} (^js/JSJoda.ZonedDateTime [^js/JSJoda.ZonedDateTime this13716 ^long long13717] (.minusWeeks this13716 long13717))) -(clojure.core/defn to-instant {:arglists (quote (["java.time.ZonedDateTime"]))} (^js/JSJoda.Instant [^js/JSJoda.ZonedDateTime this13718] (.toInstant this13718))) -(clojure.core/defn plus-weeks {:arglists (quote (["java.time.ZonedDateTime" "long"]))} (^js/JSJoda.ZonedDateTime [^js/JSJoda.ZonedDateTime this13719 ^long long13720] (.plusWeeks this13719 long13720))) -(clojure.core/defn range {:arglists (quote (["java.time.ZonedDateTime" "java.time.temporal.TemporalField"]))} (^js/JSJoda.ValueRange [^js/JSJoda.ZonedDateTime this13721 ^js/JSJoda.TemporalField java-time-temporal-TemporalField13722] (.range this13721 java-time-temporal-TemporalField13722))) -(clojure.core/defn with-earlier-offset-at-overlap {:arglists (quote (["java.time.ZonedDateTime"]))} (^js/JSJoda.ZonedDateTime [^js/JSJoda.ZonedDateTime this13723] (.withEarlierOffsetAtOverlap this13723))) -(clojure.core/defn get-hour {:arglists (quote (["java.time.ZonedDateTime"]))} (^int [^js/JSJoda.ZonedDateTime this13724] (.hour this13724))) -(clojure.core/defn minus-hours {:arglists (quote (["java.time.ZonedDateTime" "long"]))} (^js/JSJoda.ZonedDateTime [^js/JSJoda.ZonedDateTime this13725 ^long long13726] (.minusHours this13725 long13726))) -(clojure.core/defn of {:arglists (quote (["int" "int" "int" "int" "int" "int" "int" "java.time.ZoneId"] ["java.time.LocalDate" "java.time.LocalTime" "java.time.ZoneId"] ["java.time.LocalDateTime" "java.time.ZoneId"]))} (^js/JSJoda.ZonedDateTime [^int int13727 ^int int13728 ^int int13729 ^int int13730 ^int int13731 ^int int13732 ^int int13733 ^js/JSJoda.ZoneId java-time-ZoneId13734] (js-invoke java.time.ZonedDateTime "of" int13727 int13728 int13729 int13730 int13731 int13732 int13733 java-time-ZoneId13734)) (^js/JSJoda.ZonedDateTime [^js/JSJoda.LocalDate java-time-LocalDate13735 ^js/JSJoda.LocalTime java-time-LocalTime13736 ^js/JSJoda.ZoneId java-time-ZoneId13737] (js-invoke java.time.ZonedDateTime "of" java-time-LocalDate13735 java-time-LocalTime13736 java-time-ZoneId13737)) (^js/JSJoda.ZonedDateTime [^js/JSJoda.LocalDateTime java-time-LocalDateTime13738 ^js/JSJoda.ZoneId java-time-ZoneId13739] (js-invoke java.time.ZonedDateTime "of" java-time-LocalDateTime13738 java-time-ZoneId13739))) -(clojure.core/defn with-month {:arglists (quote (["java.time.ZonedDateTime" "int"]))} (^js/JSJoda.ZonedDateTime [^js/JSJoda.ZonedDateTime this13740 ^int int13741] (.withMonth this13740 int13741))) -(clojure.core/defn is-equal {:arglists (quote (["java.time.ZonedDateTime" "java.time.chrono.ChronoZonedDateTime"]))} (^boolean [^js/JSJoda.ZonedDateTime this13742 ^js/JSJoda.ChronoZonedDateTime java-time-chrono-ChronoZonedDateTime13743] (.isEqual this13742 java-time-chrono-ChronoZonedDateTime13743))) -(clojure.core/defn get-nano {:arglists (quote (["java.time.ZonedDateTime"]))} (^int [^js/JSJoda.ZonedDateTime this13744] (.nano this13744))) -(clojure.core/defn of-local {:arglists (quote (["java.time.LocalDateTime" "java.time.ZoneId" "java.time.ZoneOffset"]))} (^js/JSJoda.ZonedDateTime [^js/JSJoda.LocalDateTime java-time-LocalDateTime13745 ^js/JSJoda.ZoneId java-time-ZoneId13746 ^js/JSJoda.ZoneOffset java-time-ZoneOffset13747] (js-invoke java.time.ZonedDateTime "ofLocal" java-time-LocalDateTime13745 java-time-ZoneId13746 java-time-ZoneOffset13747))) -(clojure.core/defn get-year {:arglists (quote (["java.time.ZonedDateTime"]))} (^int [^js/JSJoda.ZonedDateTime this13748] (.year this13748))) -(clojure.core/defn minus-seconds {:arglists (quote (["java.time.ZonedDateTime" "long"]))} (^js/JSJoda.ZonedDateTime [^js/JSJoda.ZonedDateTime this13749 ^long long13750] (.minusSeconds this13749 long13750))) -(clojure.core/defn get-second {:arglists (quote (["java.time.ZonedDateTime"]))} (^int [^js/JSJoda.ZonedDateTime this13751] (.second this13751))) -(clojure.core/defn plus-nanos {:arglists (quote (["java.time.ZonedDateTime" "long"]))} (^js/JSJoda.ZonedDateTime [^js/JSJoda.ZonedDateTime this13752 ^long long13753] (.plusNanos this13752 long13753))) -(clojure.core/defn get-day-of-year {:arglists (quote (["java.time.ZonedDateTime"]))} (^int [^js/JSJoda.ZonedDateTime this13754] (.dayOfYear this13754))) -(clojure.core/defn plus {:arglists (quote (["java.time.ZonedDateTime" "java.time.temporal.TemporalAmount"] ["java.time.ZonedDateTime" "long" "java.time.temporal.TemporalUnit"]))} (^js/JSJoda.ZonedDateTime [^js/JSJoda.ZonedDateTime this13755 ^js/JSJoda.TemporalAmount java-time-temporal-TemporalAmount13756] (.plus this13755 java-time-temporal-TemporalAmount13756)) (^js/JSJoda.ZonedDateTime [^js/JSJoda.ZonedDateTime this13757 ^long long13758 ^js/JSJoda.TemporalUnit java-time-temporal-TemporalUnit13759] (.plus this13757 long13758 java-time-temporal-TemporalUnit13759))) -(clojure.core/defn with-hour {:arglists (quote (["java.time.ZonedDateTime" "int"]))} (^js/JSJoda.ZonedDateTime [^js/JSJoda.ZonedDateTime this13760 ^int int13761] (.withHour this13760 int13761))) -(clojure.core/defn with-minute {:arglists (quote (["java.time.ZonedDateTime" "int"]))} (^js/JSJoda.ZonedDateTime [^js/JSJoda.ZonedDateTime this13762 ^int int13763] (.withMinute this13762 int13763))) -(clojure.core/defn plus-minutes {:arglists (quote (["java.time.ZonedDateTime" "long"]))} (^js/JSJoda.ZonedDateTime [^js/JSJoda.ZonedDateTime this13764 ^long long13765] (.plusMinutes this13764 long13765))) -(clojure.core/defn query {:arglists (quote (["java.time.ZonedDateTime" "java.time.temporal.TemporalQuery"]))} (^java.lang.Object [^js/JSJoda.ZonedDateTime this13766 ^js/JSJoda.TemporalQuery java-time-temporal-TemporalQuery13767] (.query this13766 java-time-temporal-TemporalQuery13767))) -(clojure.core/defn get-day-of-week {:arglists (quote (["java.time.ZonedDateTime"]))} (^js/JSJoda.DayOfWeek [^js/JSJoda.ZonedDateTime this13768] (.dayOfWeek this13768))) -(clojure.core/defn to-string {:arglists (quote (["java.time.ZonedDateTime"]))} (^java.lang.String [^js/JSJoda.ZonedDateTime this13769] (.toString this13769))) -(clojure.core/defn plus-months {:arglists (quote (["java.time.ZonedDateTime" "long"]))} (^js/JSJoda.ZonedDateTime [^js/JSJoda.ZonedDateTime this13770 ^long long13771] (.plusMonths this13770 long13771))) -(clojure.core/defn is-before {:arglists (quote (["java.time.ZonedDateTime" "java.time.chrono.ChronoZonedDateTime"]))} (^boolean [^js/JSJoda.ZonedDateTime this13772 ^js/JSJoda.ChronoZonedDateTime java-time-chrono-ChronoZonedDateTime13773] (.isBefore this13772 java-time-chrono-ChronoZonedDateTime13773))) -(clojure.core/defn minus-months {:arglists (quote (["java.time.ZonedDateTime" "long"]))} (^js/JSJoda.ZonedDateTime [^js/JSJoda.ZonedDateTime this13774 ^long long13775] (.minusMonths this13774 long13775))) -(clojure.core/defn minus {:arglists (quote (["java.time.ZonedDateTime" "long" "java.time.temporal.TemporalUnit"] ["java.time.ZonedDateTime" "java.time.temporal.TemporalAmount"]))} (^js/JSJoda.ZonedDateTime [^js/JSJoda.ZonedDateTime this13776 ^long long13777 ^js/JSJoda.TemporalUnit java-time-temporal-TemporalUnit13778] (.minus this13776 long13777 java-time-temporal-TemporalUnit13778)) (^js/JSJoda.ZonedDateTime [^js/JSJoda.ZonedDateTime this13779 ^js/JSJoda.TemporalAmount java-time-temporal-TemporalAmount13780] (.minus this13779 java-time-temporal-TemporalAmount13780))) -(clojure.core/defn with-fixed-offset-zone {:arglists (quote (["java.time.ZonedDateTime"]))} (^js/JSJoda.ZonedDateTime [^js/JSJoda.ZonedDateTime this13781] (.withFixedOffsetZone this13781))) -(clojure.core/defn plus-hours {:arglists (quote (["java.time.ZonedDateTime" "long"]))} (^js/JSJoda.ZonedDateTime [^js/JSJoda.ZonedDateTime this13782 ^long long13783] (.plusHours this13782 long13783))) -(clojure.core/defn with-zone-same-local {:arglists (quote (["java.time.ZonedDateTime" "java.time.ZoneId"]))} (^js/JSJoda.ZonedDateTime [^js/JSJoda.ZonedDateTime this13784 ^js/JSJoda.ZoneId java-time-ZoneId13785] (.withZoneSameLocal this13784 java-time-ZoneId13785))) -(clojure.core/defn with-zone-same-instant {:arglists (quote (["java.time.ZonedDateTime" "java.time.ZoneId"]))} (^js/JSJoda.ZonedDateTime [^js/JSJoda.ZonedDateTime this13786 ^js/JSJoda.ZoneId java-time-ZoneId13787] (.withZoneSameInstant this13786 java-time-ZoneId13787))) -(clojure.core/defn plus-days {:arglists (quote (["java.time.ZonedDateTime" "long"]))} (^js/JSJoda.ZonedDateTime [^js/JSJoda.ZonedDateTime this13788 ^long long13789] (.plusDays this13788 long13789))) -(clojure.core/defn to-local-time {:arglists (quote (["java.time.ZonedDateTime"]))} (^js/JSJoda.LocalTime [^js/JSJoda.ZonedDateTime this13790] (.toLocalTime this13790))) -(clojure.core/defn get-long {:arglists (quote (["java.time.ZonedDateTime" "java.time.temporal.TemporalField"]))} (^long [^js/JSJoda.ZonedDateTime this13791 ^js/JSJoda.TemporalField java-time-temporal-TemporalField13792] (.getLong this13791 java-time-temporal-TemporalField13792))) -(clojure.core/defn get-offset {:arglists (quote (["java.time.ZonedDateTime"]))} (^js/JSJoda.ZoneOffset [^js/JSJoda.ZonedDateTime this13793] (.offset this13793))) -(clojure.core/defn with-year {:arglists (quote (["java.time.ZonedDateTime" "int"]))} (^js/JSJoda.ZonedDateTime [^js/JSJoda.ZonedDateTime this13794 ^int int13795] (.withYear this13794 int13795))) -(clojure.core/defn with-nano {:arglists (quote (["java.time.ZonedDateTime" "int"]))} (^js/JSJoda.ZonedDateTime [^js/JSJoda.ZonedDateTime this13796 ^int int13797] (.withNano this13796 int13797))) -(clojure.core/defn to-epoch-second {:arglists (quote (["java.time.ZonedDateTime"]))} (^long [^js/JSJoda.ZonedDateTime this13798] (.toEpochSecond this13798))) -(clojure.core/defn to-offset-date-time {:arglists (quote (["java.time.ZonedDateTime"]))} (^js/JSJoda.OffsetDateTime [^js/JSJoda.ZonedDateTime this13799] (.toOffsetDateTime this13799))) -(clojure.core/defn with-later-offset-at-overlap {:arglists (quote (["java.time.ZonedDateTime"]))} (^js/JSJoda.ZonedDateTime [^js/JSJoda.ZonedDateTime this13800] (.withLaterOffsetAtOverlap this13800))) -(clojure.core/defn until {:arglists (quote (["java.time.ZonedDateTime" "java.time.temporal.Temporal" "java.time.temporal.TemporalUnit"]))} (^long [^js/JSJoda.ZonedDateTime this13801 ^js/JSJoda.Temporal java-time-temporal-Temporal13802 ^js/JSJoda.TemporalUnit java-time-temporal-TemporalUnit13803] (.until this13801 java-time-temporal-Temporal13802 java-time-temporal-TemporalUnit13803))) -(clojure.core/defn get-zone {:arglists (quote (["java.time.ZonedDateTime"]))} (^js/JSJoda.ZoneId [^js/JSJoda.ZonedDateTime this13804] (.zone this13804))) -(clojure.core/defn with-day-of-month {:arglists (quote (["java.time.ZonedDateTime" "int"]))} (^js/JSJoda.ZonedDateTime [^js/JSJoda.ZonedDateTime this13805 ^int int13806] (.withDayOfMonth this13805 int13806))) -(clojure.core/defn get-day-of-month {:arglists (quote (["java.time.ZonedDateTime"]))} (^int [^js/JSJoda.ZonedDateTime this13807] (.dayOfMonth this13807))) -(clojure.core/defn from {:arglists (quote (["java.time.temporal.TemporalAccessor"]))} (^js/JSJoda.ZonedDateTime [^js/JSJoda.TemporalAccessor java-time-temporal-TemporalAccessor13808] (js-invoke java.time.ZonedDateTime "from" java-time-temporal-TemporalAccessor13808))) -(clojure.core/defn is-after {:arglists (quote (["java.time.ZonedDateTime" "java.time.chrono.ChronoZonedDateTime"]))} (^boolean [^js/JSJoda.ZonedDateTime this13809 ^js/JSJoda.ChronoZonedDateTime java-time-chrono-ChronoZonedDateTime13810] (.isAfter this13809 java-time-chrono-ChronoZonedDateTime13810))) -(clojure.core/defn minus-nanos {:arglists (quote (["java.time.ZonedDateTime" "long"]))} (^js/JSJoda.ZonedDateTime [^js/JSJoda.ZonedDateTime this13811 ^long long13812] (.minusNanos this13811 long13812))) -(clojure.core/defn is-supported {:arglists (quote (["java.time.ZonedDateTime" "java.time.temporal.TemporalField"] ["java.time.ZonedDateTime" "java.time.temporal.TemporalUnit"]))} (^boolean [this13813 G__13814] (.isSupported ^js/JSJoda.ZonedDateTime this13813 G__13814))) -(clojure.core/defn minus-years {:arglists (quote (["java.time.ZonedDateTime" "long"]))} (^js/JSJoda.ZonedDateTime [^js/JSJoda.ZonedDateTime this13815 ^long long13816] (.minusYears this13815 long13816))) -(clojure.core/defn get-chronology {:arglists (quote (["java.time.ZonedDateTime"]))} (^js/JSJoda.Chronology [^js/JSJoda.ZonedDateTime this13817] (.chronology this13817))) -(clojure.core/defn parse {:arglists (quote (["java.lang.CharSequence"] ["java.lang.CharSequence" "java.time.format.DateTimeFormatter"]))} (^js/JSJoda.ZonedDateTime [^java.lang.CharSequence java-lang-CharSequence13818] (js-invoke java.time.ZonedDateTime "parse" java-lang-CharSequence13818)) (^js/JSJoda.ZonedDateTime [^java.lang.CharSequence java-lang-CharSequence13819 ^js/JSJoda.DateTimeFormatter java-time-format-DateTimeFormatter13820] (js-invoke java.time.ZonedDateTime "parse" java-lang-CharSequence13819 java-time-format-DateTimeFormatter13820))) -(clojure.core/defn with-second {:arglists (quote (["java.time.ZonedDateTime" "int"]))} (^js/JSJoda.ZonedDateTime [^js/JSJoda.ZonedDateTime this13821 ^int int13822] (.withSecond this13821 int13822))) -(clojure.core/defn to-local-date {:arglists (quote (["java.time.ZonedDateTime"]))} (^js/JSJoda.LocalDate [^js/JSJoda.ZonedDateTime this13823] (.toLocalDate this13823))) -(clojure.core/defn get-minute {:arglists (quote (["java.time.ZonedDateTime"]))} (^int [^js/JSJoda.ZonedDateTime this13824] (.minute this13824))) -(clojure.core/defn hash-code {:arglists (quote (["java.time.ZonedDateTime"]))} (^int [^js/JSJoda.ZonedDateTime this13825] (.hashCode this13825))) -(clojure.core/defn with {:arglists (quote (["java.time.ZonedDateTime" "java.time.temporal.TemporalField" "long"] ["java.time.ZonedDateTime" "java.time.temporal.TemporalAdjuster"]))} (^js/JSJoda.ZonedDateTime [^js/JSJoda.ZonedDateTime this13826 ^js/JSJoda.TemporalField java-time-temporal-TemporalField13827 ^long long13828] (.with this13826 java-time-temporal-TemporalField13827 long13828)) (^js/JSJoda.ZonedDateTime [^js/JSJoda.ZonedDateTime this13829 ^js/JSJoda.TemporalAdjuster java-time-temporal-TemporalAdjuster13830] (.with this13829 java-time-temporal-TemporalAdjuster13830))) -(clojure.core/defn now {:arglists (quote ([] ["java.time.Clock"] ["java.time.ZoneId"]))} (^js/JSJoda.ZonedDateTime [] (js-invoke java.time.ZonedDateTime "now")) (^js/JSJoda.ZonedDateTime [G__13832] (js-invoke java.time.ZonedDateTime "now" G__13832))) -(clojure.core/defn to-local-date-time {:arglists (quote (["java.time.ZonedDateTime"]))} (^js/JSJoda.LocalDateTime [^js/JSJoda.ZonedDateTime this13833] (.toLocalDateTime this13833))) -(clojure.core/defn get-month-value {:arglists (quote (["java.time.ZonedDateTime"]))} (^int [^js/JSJoda.ZonedDateTime this13834] (.monthValue this13834))) -(clojure.core/defn with-day-of-year {:arglists (quote (["java.time.ZonedDateTime" "int"]))} (^js/JSJoda.ZonedDateTime [^js/JSJoda.ZonedDateTime this13835 ^int int13836] (.withDayOfYear this13835 int13836))) -(clojure.core/defn compare-to {:arglists (quote (["java.time.ZonedDateTime" "java.time.chrono.ChronoZonedDateTime"]))} (^int [^js/JSJoda.ZonedDateTime this13837 ^js/JSJoda.ChronoZonedDateTime java-time-chrono-ChronoZonedDateTime13838] (.compareTo this13837 java-time-chrono-ChronoZonedDateTime13838))) -(clojure.core/defn of-strict {:arglists (quote (["java.time.LocalDateTime" "java.time.ZoneOffset" "java.time.ZoneId"]))} (^js/JSJoda.ZonedDateTime [^js/JSJoda.LocalDateTime java-time-LocalDateTime13839 ^js/JSJoda.ZoneOffset java-time-ZoneOffset13840 ^js/JSJoda.ZoneId java-time-ZoneId13841] (js-invoke java.time.ZonedDateTime "ofStrict" java-time-LocalDateTime13839 java-time-ZoneOffset13840 java-time-ZoneId13841))) -(clojure.core/defn get-month {:arglists (quote (["java.time.ZonedDateTime"]))} (^js/JSJoda.Month [^js/JSJoda.ZonedDateTime this13842] (.month this13842))) -(clojure.core/defn of-instant {:arglists (quote (["java.time.Instant" "java.time.ZoneId"] ["java.time.LocalDateTime" "java.time.ZoneOffset" "java.time.ZoneId"]))} (^js/JSJoda.ZonedDateTime [^js/JSJoda.Instant java-time-Instant13843 ^js/JSJoda.ZoneId java-time-ZoneId13844] (js-invoke java.time.ZonedDateTime "ofInstant" java-time-Instant13843 java-time-ZoneId13844)) (^js/JSJoda.ZonedDateTime [^js/JSJoda.LocalDateTime java-time-LocalDateTime13845 ^js/JSJoda.ZoneOffset java-time-ZoneOffset13846 ^js/JSJoda.ZoneId java-time-ZoneId13847] (js-invoke java.time.ZonedDateTime "ofInstant" java-time-LocalDateTime13845 java-time-ZoneOffset13846 java-time-ZoneId13847))) -(clojure.core/defn plus-seconds {:arglists (quote (["java.time.ZonedDateTime" "long"]))} (^js/JSJoda.ZonedDateTime [^js/JSJoda.ZonedDateTime this13848 ^long long13849] (.plusSeconds this13848 long13849))) -(clojure.core/defn get {:arglists (quote (["java.time.ZonedDateTime" "java.time.temporal.TemporalField"]))} (^int [^js/JSJoda.ZonedDateTime this13850 ^js/JSJoda.TemporalField java-time-temporal-TemporalField13851] (.get this13850 java-time-temporal-TemporalField13851))) -(clojure.core/defn equals {:arglists (quote (["java.time.ZonedDateTime" "java.lang.Object"]))} (^boolean [^js/JSJoda.ZonedDateTime this13852 ^java.lang.Object java-lang-Object13853] (.equals this13852 java-lang-Object13853))) -(clojure.core/defn format {:arglists (quote (["java.time.ZonedDateTime" "java.time.format.DateTimeFormatter"]))} (^java.lang.String [^js/JSJoda.ZonedDateTime this13854 ^js/JSJoda.DateTimeFormatter java-time-format-DateTimeFormatter13855] (.format this13854 java-time-format-DateTimeFormatter13855))) -(clojure.core/defn plus-years {:arglists (quote (["java.time.ZonedDateTime" "long"]))} (^js/JSJoda.ZonedDateTime [^js/JSJoda.ZonedDateTime this13856 ^long long13857] (.plusYears this13856 long13857))) -(clojure.core/defn minus-days {:arglists (quote (["java.time.ZonedDateTime" "long"]))} (^js/JSJoda.ZonedDateTime [^js/JSJoda.ZonedDateTime this13858 ^long long13859] (.minusDays this13858 long13859))) +(ns cljc.java-time.zoned-date-time + (:refer-clojure :exclude + [abs get range format min max next name resolve short]) + (:require [cljc.java-time.extn.calendar-awareness] + [goog.object] + [java.time :refer [ZonedDateTime]])) + +(defn minus-minutes + "Returns a copy of this {@code ZonedDateTime} with the specified number of minutes subtracted. + + This operates on the instant time-line, such that subtracting one minute will + always be a duration of one minute earlier. + This may cause the local date-time to change by an amount other than one minute. + Note that this is a different approach to that used by days, months and years. + + This instance is immutable and unaffected by this method call. + + @param minutes the minutes to subtract, may be negative + @return a {@code ZonedDateTime} based on this date-time with the minutes subtracted, not null + @throws DateTimeException if the result exceeds the supported date range" + {:arglists (quote (["java.time.ZonedDateTime" "long"]))} + (^js/JSJoda.ZonedDateTime [^js/JSJoda.ZonedDateTime this ^long minutes] + (.minusMinutes this minutes))) + +(defn truncated-to + "Returns a copy of this {@code ZonedDateTime} with the time truncated. + + Truncation returns a copy of the original date-time with fields + smaller than the specified unit set to zero. + For example, truncating with the {@link ChronoUnit#MINUTES minutes} unit + will set the second-of-minute and nano-of-second field to zero. + + The unit must have a {@linkplain TemporalUnit#getDuration() duration} + that divides into the length of a standard day without remainder. + This includes all supplied time units on {@link ChronoUnit} and + {@link ChronoUnit#DAYS DAYS}. Other units throw an exception. + + This operates on the local time-line, + {@link LocalDateTime#truncatedTo(TemporalUnit) truncating} + the underlying local date-time. This is then converted back to a + {@code ZonedDateTime}, using the zone ID to obtain the offset. + + When converting back to {@code ZonedDateTime}, if the local date-time is in an overlap, + then the offset will be retained if possible, otherwise the earlier offset will be used. + If in a gap, the local date-time will be adjusted forward by the length of the gap. + + This instance is immutable and unaffected by this method call. + + @param unit the unit to truncate to, not null + @return a {@code ZonedDateTime} based on this date-time with the time truncated, not null + @throws DateTimeException if unable to truncate + @throws UnsupportedTemporalTypeException if the unit is not supported" + {:arglists (quote (["java.time.ZonedDateTime" + "java.time.temporal.TemporalUnit"]))} + (^js/JSJoda.ZonedDateTime + [^js/JSJoda.ZonedDateTime this ^js/JSJoda.TemporalUnit unit] + (.truncatedTo this unit))) + +(defn minus-weeks + "Returns a copy of this {@code ZonedDateTime} with the specified number of weeks subtracted. + + This operates on the local time-line, + {@link LocalDateTime#minusWeeks(long) subtracting weeks} to the local date-time. + This is then converted back to a {@code ZonedDateTime}, using the zone ID + to obtain the offset. + + When converting back to {@code ZonedDateTime}, if the local date-time is in an overlap, + then the offset will be retained if possible, otherwise the earlier offset will be used. + If in a gap, the local date-time will be adjusted forward by the length of the gap. + + This instance is immutable and unaffected by this method call. + + @param weeks the weeks to subtract, may be negative + @return a {@code ZonedDateTime} based on this date-time with the weeks subtracted, not null + @throws DateTimeException if the result exceeds the supported date range" + {:arglists (quote (["java.time.ZonedDateTime" "long"]))} + (^js/JSJoda.ZonedDateTime [^js/JSJoda.ZonedDateTime this ^long weeks] + (.minusWeeks this weeks))) + +(defn to-instant + "Converts this date-time to an {@code Instant}. + + This returns an {@code Instant} representing the same point on the + time-line as this date-time. The calculation combines the + {@linkplain #toLocalDateTime() local date-time} and + {@linkplain #getOffset() offset}. + + @return an {@code Instant} representing the same instant, not null" + {:arglists (quote (["java.time.ZonedDateTime"]))} + (^js/JSJoda.Instant [^js/JSJoda.ZonedDateTime this] (.toInstant this))) + +(defn plus-weeks + "Returns a copy of this {@code ZonedDateTime} with the specified number of weeks added. + + This operates on the local time-line, + {@link LocalDateTime#plusWeeks(long) adding weeks} to the local date-time. + This is then converted back to a {@code ZonedDateTime}, using the zone ID + to obtain the offset. + + When converting back to {@code ZonedDateTime}, if the local date-time is in an overlap, + then the offset will be retained if possible, otherwise the earlier offset will be used. + If in a gap, the local date-time will be adjusted forward by the length of the gap. + + This instance is immutable and unaffected by this method call. + + @param weeks the weeks to add, may be negative + @return a {@code ZonedDateTime} based on this date-time with the weeks added, not null + @throws DateTimeException if the result exceeds the supported date range" + {:arglists (quote (["java.time.ZonedDateTime" "long"]))} + (^js/JSJoda.ZonedDateTime [^js/JSJoda.ZonedDateTime this ^long weeks] + (.plusWeeks this weeks))) + +(defn range + "Gets the range of valid values for the specified field. + + The range object expresses the minimum and maximum valid values for a field. + This date-time is used to enhance the accuracy of the returned range. + If it is not possible to return the range, because the field is not supported + or for some other reason, an exception is thrown. + + If the field is a {@link ChronoField} then the query is implemented here. + The {@link #isSupported(TemporalField) supported fields} will return + appropriate range instances. + All other {@code ChronoField} instances will throw an {@code UnsupportedTemporalTypeException}. + + If the field is not a {@code ChronoField}, then the result of this method + is obtained by invoking {@code TemporalField.rangeRefinedBy(TemporalAccessor)} + passing {@code this} as the argument. + Whether the range can be obtained is determined by the field. + + @param field the field to query the range for, not null + @return the range of valid values for the field, not null + @throws DateTimeException if the range for the field cannot be obtained + @throws UnsupportedTemporalTypeException if the field is not supported" + {:arglists (quote (["java.time.ZonedDateTime" + "java.time.temporal.TemporalField"]))} + (^js/JSJoda.ValueRange + [^js/JSJoda.ZonedDateTime this ^js/JSJoda.TemporalField field] + (.range this field))) + +(defn with-earlier-offset-at-overlap + "Returns a copy of this date-time changing the zone offset to the + earlier of the two valid offsets at a local time-line overlap. + + This method only has any effect when the local time-line overlaps, such as + at an autumn daylight savings cutover. In this scenario, there are two + valid offsets for the local date-time. Calling this method will return + a zoned date-time with the earlier of the two selected. + + If this method is called when it is not an overlap, {@code this} + is returned. + + This instance is immutable and unaffected by this method call. + + @return a {@code ZonedDateTime} based on this date-time with the earlier offset, not null" + {:arglists (quote (["java.time.ZonedDateTime"]))} + (^js/JSJoda.ZonedDateTime [^js/JSJoda.ZonedDateTime this] + (.withEarlierOffsetAtOverlap this))) + +(defn get-hour + "Gets the hour-of-day field. + + @return the hour-of-day, from 0 to 23" + {:arglists (quote (["java.time.ZonedDateTime"]))} + (^int [^js/JSJoda.ZonedDateTime this] (.hour this))) + +(defn minus-hours + "Returns a copy of this {@code ZonedDateTime} with the specified number of hours subtracted. + + This operates on the instant time-line, such that subtracting one hour will + always be a duration of one hour earlier. + This may cause the local date-time to change by an amount other than one hour. + Note that this is a different approach to that used by days, months and years, + thus subtracting one day is not the same as adding 24 hours. + + For example, consider a time-zone where the spring DST cutover means that the + local times 01:00 to 01:59 occur twice changing from offset +02:00 to +01:00. +
    +
  • Subtracting one hour from 02:30+01:00 will result in 01:30+02:00 +
  • Subtracting one hour from 01:30+01:00 will result in 01:30+02:00 +
  • Subtracting one hour from 01:30+02:00 will result in 00:30+01:00 +
  • Subtracting three hours from 02:30+01:00 will result in 00:30+02:00 +
+ + This instance is immutable and unaffected by this method call. + + @param hours the hours to subtract, may be negative + @return a {@code ZonedDateTime} based on this date-time with the hours subtracted, not null + @throws DateTimeException if the result exceeds the supported date range" + {:arglists (quote (["java.time.ZonedDateTime" "long"]))} + (^js/JSJoda.ZonedDateTime [^js/JSJoda.ZonedDateTime this ^long hours] + (.minusHours this hours))) + +(defn of + {:arglists + (quote (["java.time.LocalDateTime" "java.time.ZoneId"] + ["java.time.LocalDate" "java.time.LocalTime" "java.time.ZoneId"] + ["int" "int" "int" "int" "int" "int" "int" "java.time.ZoneId"]))} + (^js/JSJoda.ZonedDateTime + [^js/JSJoda.LocalDateTime local-date-time ^js/JSJoda.ZoneId zone] + (js-invoke java.time.ZonedDateTime "of" local-date-time zone)) + (^js/JSJoda.ZonedDateTime + [^js/JSJoda.LocalDate date ^js/JSJoda.LocalTime time ^js/JSJoda.ZoneId zone] + (js-invoke java.time.ZonedDateTime "of" date time zone)) + (^js/JSJoda.ZonedDateTime + [^int year ^int month ^int day-of-month ^int hour ^int minute ^int second + ^int nano-of-second ^js/JSJoda.ZoneId zone] + (js-invoke java.time.ZonedDateTime + "of" + year + month + day-of-month + hour + minute + second + nano-of-second + zone))) + +(defn with-month + "Returns a copy of this {@code ZonedDateTime} with the month-of-year altered. + + This operates on the local time-line, + {@link LocalDateTime#withMonth(int) changing the month} of the local date-time. + This is then converted back to a {@code ZonedDateTime}, using the zone ID + to obtain the offset. + + When converting back to {@code ZonedDateTime}, if the local date-time is in an overlap, + then the offset will be retained if possible, otherwise the earlier offset will be used. + If in a gap, the local date-time will be adjusted forward by the length of the gap. + + This instance is immutable and unaffected by this method call. + + @param month the month-of-year to set in the result, from 1 (January) to 12 (December) + @return a {@code ZonedDateTime} based on this date-time with the requested month, not null + @throws DateTimeException if the month-of-year value is invalid" + {:arglists (quote (["java.time.ZonedDateTime" "int"]))} + (^js/JSJoda.ZonedDateTime [^js/JSJoda.ZonedDateTime this ^int month] + (.withMonth this month))) + +(defn is-equal + "Checks if the instant of this date-time is equal to that of the specified date-time. + + This method differs from the comparison in {@link #compareTo} and {@link #equals} + in that it only compares the instant of the date-time. This is equivalent to using + {@code dateTime1.toInstant().equals(dateTime2.toInstant());}. + + This default implementation performs the comparison based on the epoch-second + and nano-of-second. + + @param other the other date-time to compare to, not null + @return true if the instant equals the instant of the specified date-time" + {:arglists (quote (["java.time.ZonedDateTime" + "java.time.chrono.ChronoZonedDateTime"]))} + (^boolean [^js/JSJoda.ZonedDateTime this ^js/JSJoda.ChronoZonedDateTime other] + (.isEqual this other))) + +(defn get-nano + "Gets the nano-of-second field. + + @return the nano-of-second, from 0 to 999,999,999" + {:arglists (quote (["java.time.ZonedDateTime"]))} + (^int [^js/JSJoda.ZonedDateTime this] (.nano this))) + +(defn of-local + "Obtains an instance of {@code ZonedDateTime} from a local date-time + using the preferred offset if possible. + + The local date-time is resolved to a single instant on the time-line. + This is achieved by finding a valid offset from UTC/Greenwich for the local + date-time as defined by the {@link ZoneRules rules} of the zone ID. + + In most cases, there is only one valid offset for a local date-time. + In the case of an overlap, where clocks are set back, there are two valid offsets. + If the preferred offset is one of the valid offsets then it is used. + Otherwise the earlier valid offset is used, typically corresponding to \"summer\". + + In the case of a gap, where clocks jump forward, there is no valid offset. + Instead, the local date-time is adjusted to be later by the length of the gap. + For a typical one hour daylight savings change, the local date-time will be + moved one hour later into the offset typically corresponding to \"summer\". + + @param localDateTime the local date-time, not null + @param zone the time-zone, not null + @param preferredOffset the zone offset, null if no preference + @return the zoned date-time, not null" + {:arglists (quote (["java.time.LocalDateTime" "java.time.ZoneId" + "java.time.ZoneOffset"]))} + (^js/JSJoda.ZonedDateTime + [^js/JSJoda.LocalDateTime local-date-time ^js/JSJoda.ZoneId zone + ^js/JSJoda.ZoneOffset preferred-offset] + (js-invoke java.time.ZonedDateTime + "ofLocal" + local-date-time + zone + preferred-offset))) + +(defn get-year + "Gets the year field. + + This method returns the primitive {@code int} value for the year. + + The year returned by this method is proleptic as per {@code get(YEAR)}. + To obtain the year-of-era, use {@code get(YEAR_OF_ERA)}. + + @return the year, from MIN_YEAR to MAX_YEAR" + {:arglists (quote (["java.time.ZonedDateTime"]))} + (^int [^js/JSJoda.ZonedDateTime this] (.year this))) + +(defn minus-seconds + "Returns a copy of this {@code ZonedDateTime} with the specified number of seconds subtracted. + + This operates on the instant time-line, such that subtracting one second will + always be a duration of one second earlier. + This may cause the local date-time to change by an amount other than one second. + Note that this is a different approach to that used by days, months and years. + + This instance is immutable and unaffected by this method call. + + @param seconds the seconds to subtract, may be negative + @return a {@code ZonedDateTime} based on this date-time with the seconds subtracted, not null + @throws DateTimeException if the result exceeds the supported date range" + {:arglists (quote (["java.time.ZonedDateTime" "long"]))} + (^js/JSJoda.ZonedDateTime [^js/JSJoda.ZonedDateTime this ^long seconds] + (.minusSeconds this seconds))) + +(defn get-second + "Gets the second-of-minute field. + + @return the second-of-minute, from 0 to 59" + {:arglists (quote (["java.time.ZonedDateTime"]))} + (^int [^js/JSJoda.ZonedDateTime this] (.second this))) + +(defn plus-nanos + "Returns a copy of this {@code ZonedDateTime} with the specified number of nanoseconds added. + + This operates on the instant time-line, such that adding one nano will + always be a duration of one nano later. + This may cause the local date-time to change by an amount other than one nano. + Note that this is a different approach to that used by days, months and years. + + This instance is immutable and unaffected by this method call. + + @param nanos the nanos to add, may be negative + @return a {@code ZonedDateTime} based on this date-time with the nanoseconds added, not null + @throws DateTimeException if the result exceeds the supported date range" + {:arglists (quote (["java.time.ZonedDateTime" "long"]))} + (^js/JSJoda.ZonedDateTime [^js/JSJoda.ZonedDateTime this ^long nanos] + (.plusNanos this nanos))) + +(defn get-day-of-year + "Gets the day-of-year field. + + This method returns the primitive {@code int} value for the day-of-year. + + @return the day-of-year, from 1 to 365, or 366 in a leap year" + {:arglists (quote (["java.time.ZonedDateTime"]))} + (^int [^js/JSJoda.ZonedDateTime this] (.dayOfYear this))) + +(defn plus + {:arglists (quote (["java.time.ZonedDateTime" + "java.time.temporal.TemporalAmount"] + ["java.time.ZonedDateTime" "long" + "java.time.temporal.TemporalUnit"]))} + (^js/JSJoda.ZonedDateTime + [^js/JSJoda.ZonedDateTime this ^js/JSJoda.TemporalAmount amount-to-add] + (.plus this amount-to-add)) + (^js/JSJoda.ZonedDateTime + [^js/JSJoda.ZonedDateTime this ^long amount-to-add + ^js/JSJoda.TemporalUnit unit] + (.plus this amount-to-add unit))) + +(defn with-hour + "Returns a copy of this {@code ZonedDateTime} with the hour-of-day altered. + + This operates on the local time-line, + {@linkplain LocalDateTime#withHour(int) changing the time} of the local date-time. + This is then converted back to a {@code ZonedDateTime}, using the zone ID + to obtain the offset. + + When converting back to {@code ZonedDateTime}, if the local date-time is in an overlap, + then the offset will be retained if possible, otherwise the earlier offset will be used. + If in a gap, the local date-time will be adjusted forward by the length of the gap. + + This instance is immutable and unaffected by this method call. + + @param hour the hour-of-day to set in the result, from 0 to 23 + @return a {@code ZonedDateTime} based on this date-time with the requested hour, not null + @throws DateTimeException if the hour value is invalid" + {:arglists (quote (["java.time.ZonedDateTime" "int"]))} + (^js/JSJoda.ZonedDateTime [^js/JSJoda.ZonedDateTime this ^int hour] + (.withHour this hour))) + +(defn with-minute + "Returns a copy of this {@code ZonedDateTime} with the minute-of-hour altered. + + This operates on the local time-line, + {@linkplain LocalDateTime#withMinute(int) changing the time} of the local date-time. + This is then converted back to a {@code ZonedDateTime}, using the zone ID + to obtain the offset. + + When converting back to {@code ZonedDateTime}, if the local date-time is in an overlap, + then the offset will be retained if possible, otherwise the earlier offset will be used. + If in a gap, the local date-time will be adjusted forward by the length of the gap. + + This instance is immutable and unaffected by this method call. + + @param minute the minute-of-hour to set in the result, from 0 to 59 + @return a {@code ZonedDateTime} based on this date-time with the requested minute, not null + @throws DateTimeException if the minute value is invalid" + {:arglists (quote (["java.time.ZonedDateTime" "int"]))} + (^js/JSJoda.ZonedDateTime [^js/JSJoda.ZonedDateTime this ^int minute] + (.withMinute this minute))) + +(defn plus-minutes + "Returns a copy of this {@code ZonedDateTime} with the specified number of minutes added. + + This operates on the instant time-line, such that adding one minute will + always be a duration of one minute later. + This may cause the local date-time to change by an amount other than one minute. + Note that this is a different approach to that used by days, months and years. + + This instance is immutable and unaffected by this method call. + + @param minutes the minutes to add, may be negative + @return a {@code ZonedDateTime} based on this date-time with the minutes added, not null + @throws DateTimeException if the result exceeds the supported date range" + {:arglists (quote (["java.time.ZonedDateTime" "long"]))} + (^js/JSJoda.ZonedDateTime [^js/JSJoda.ZonedDateTime this ^long minutes] + (.plusMinutes this minutes))) + +(defn query + "Queries this date-time using the specified query. + + This queries this date-time using the specified query strategy object. + The {@code TemporalQuery} object defines the logic to be used to + obtain the result. Read the documentation of the query to understand + what the result of this method will be. + + The result of this method is obtained by invoking the + {@link TemporalQuery#queryFrom(TemporalAccessor)} method on the + specified query passing {@code this} as the argument. + + @param the type of the result + @param query the query to invoke, not null + @return the query result, null may be returned (defined by the query) + @throws DateTimeException if unable to query (defined by the query) + @throws ArithmeticException if numeric overflow occurs (defined by the query)" + {:arglists (quote (["java.time.ZonedDateTime" + "java.time.temporal.TemporalQuery"]))} + (^java.lang.Object + [^js/JSJoda.ZonedDateTime this ^js/JSJoda.TemporalQuery query] + (.query this query))) + +(defn get-day-of-week + "Gets the day-of-week field, which is an enum {@code DayOfWeek}. + + This method returns the enum {@link DayOfWeek} for the day-of-week. + This avoids confusion as to what {@code int} values mean. + If you need access to the primitive {@code int} value then the enum + provides the {@link DayOfWeek#getValue() int value}. + + Additional information can be obtained from the {@code DayOfWeek}. + This includes textual names of the values. + + @return the day-of-week, not null" + {:arglists (quote (["java.time.ZonedDateTime"]))} + (^js/JSJoda.DayOfWeek [^js/JSJoda.ZonedDateTime this] (.dayOfWeek this))) + +(defn to-string + "Outputs this date-time as a {@code String}, such as + {@code 2007-12-03T10:15:30+01:00[Europe/Paris]}. + + The format consists of the {@code LocalDateTime} followed by the {@code ZoneOffset}. + If the {@code ZoneId} is not the same as the offset, then the ID is output. + The output is compatible with ISO-8601 if the offset and ID are the same. + + @return a string representation of this date-time, not null" + {:arglists (quote (["java.time.ZonedDateTime"]))} + (^java.lang.String [^js/JSJoda.ZonedDateTime this] (.toString this))) + +(defn plus-months + "Returns a copy of this {@code ZonedDateTime} with the specified number of months added. + + This operates on the local time-line, + {@link LocalDateTime#plusMonths(long) adding months} to the local date-time. + This is then converted back to a {@code ZonedDateTime}, using the zone ID + to obtain the offset. + + When converting back to {@code ZonedDateTime}, if the local date-time is in an overlap, + then the offset will be retained if possible, otherwise the earlier offset will be used. + If in a gap, the local date-time will be adjusted forward by the length of the gap. + + This instance is immutable and unaffected by this method call. + + @param months the months to add, may be negative + @return a {@code ZonedDateTime} based on this date-time with the months added, not null + @throws DateTimeException if the result exceeds the supported date range" + {:arglists (quote (["java.time.ZonedDateTime" "long"]))} + (^js/JSJoda.ZonedDateTime [^js/JSJoda.ZonedDateTime this ^long months] + (.plusMonths this months))) + +(defn is-before + "Checks if the instant of this date-time is before that of the specified date-time. + + This method differs from the comparison in {@link #compareTo} in that it + only compares the instant of the date-time. This is equivalent to using + {@code dateTime1.toInstant().isBefore(dateTime2.toInstant());}. + + This default implementation performs the comparison based on the epoch-second + and nano-of-second. + + @param other the other date-time to compare to, not null + @return true if this point is before the specified date-time" + {:arglists (quote (["java.time.ZonedDateTime" + "java.time.chrono.ChronoZonedDateTime"]))} + (^boolean [^js/JSJoda.ZonedDateTime this ^js/JSJoda.ChronoZonedDateTime other] + (.isBefore this other))) + +(defn minus-months + "Returns a copy of this {@code ZonedDateTime} with the specified number of months subtracted. + + This operates on the local time-line, + {@link LocalDateTime#minusMonths(long) subtracting months} to the local date-time. + This is then converted back to a {@code ZonedDateTime}, using the zone ID + to obtain the offset. + + When converting back to {@code ZonedDateTime}, if the local date-time is in an overlap, + then the offset will be retained if possible, otherwise the earlier offset will be used. + If in a gap, the local date-time will be adjusted forward by the length of the gap. + + This instance is immutable and unaffected by this method call. + + @param months the months to subtract, may be negative + @return a {@code ZonedDateTime} based on this date-time with the months subtracted, not null + @throws DateTimeException if the result exceeds the supported date range" + {:arglists (quote (["java.time.ZonedDateTime" "long"]))} + (^js/JSJoda.ZonedDateTime [^js/JSJoda.ZonedDateTime this ^long months] + (.minusMonths this months))) + +(defn minus + {:arglists (quote (["java.time.ZonedDateTime" + "java.time.temporal.TemporalAmount"] + ["java.time.ZonedDateTime" "long" + "java.time.temporal.TemporalUnit"]))} + (^js/JSJoda.ZonedDateTime + [^js/JSJoda.ZonedDateTime this ^js/JSJoda.TemporalAmount amount-to-subtract] + (.minus this amount-to-subtract)) + (^js/JSJoda.ZonedDateTime + [^js/JSJoda.ZonedDateTime this ^long amount-to-subtract + ^js/JSJoda.TemporalUnit unit] + (.minus this amount-to-subtract unit))) + +(defn with-fixed-offset-zone + "Returns a copy of this date-time with the zone ID set to the offset. + + This returns a zoned date-time where the zone ID is the same as {@link #getOffset()}. + The local date-time, offset and instant of the result will be the same as in this date-time. + + Setting the date-time to a fixed single offset means that any future + calculations, such as addition or subtraction, have no complex edge cases + due to time-zone rules. + This might also be useful when sending a zoned date-time across a network, + as most protocols, such as ISO-8601, only handle offsets, + and not region-based zone IDs. + + This is equivalent to {@code ZonedDateTime.of(zdt.toLocalDateTime(), zdt.getOffset())}. + + @return a {@code ZonedDateTime} with the zone ID set to the offset, not null" + {:arglists (quote (["java.time.ZonedDateTime"]))} + (^js/JSJoda.ZonedDateTime [^js/JSJoda.ZonedDateTime this] + (.withFixedOffsetZone this))) + +(defn plus-hours + "Returns a copy of this {@code ZonedDateTime} with the specified number of hours added. + + This operates on the instant time-line, such that adding one hour will + always be a duration of one hour later. + This may cause the local date-time to change by an amount other than one hour. + Note that this is a different approach to that used by days, months and years, + thus adding one day is not the same as adding 24 hours. + + For example, consider a time-zone where the spring DST cutover means that the + local times 01:00 to 01:59 occur twice changing from offset +02:00 to +01:00. +
    +
  • Adding one hour to 00:30+02:00 will result in 01:30+02:00 +
  • Adding one hour to 01:30+02:00 will result in 01:30+01:00 +
  • Adding one hour to 01:30+01:00 will result in 02:30+01:00 +
  • Adding three hours to 00:30+02:00 will result in 02:30+01:00 +
+ + This instance is immutable and unaffected by this method call. + + @param hours the hours to add, may be negative + @return a {@code ZonedDateTime} based on this date-time with the hours added, not null + @throws DateTimeException if the result exceeds the supported date range" + {:arglists (quote (["java.time.ZonedDateTime" "long"]))} + (^js/JSJoda.ZonedDateTime [^js/JSJoda.ZonedDateTime this ^long hours] + (.plusHours this hours))) + +(defn with-zone-same-local + "Returns a copy of this date-time with a different time-zone, + retaining the local date-time if possible. + + This method changes the time-zone and retains the local date-time. + The local date-time is only changed if it is invalid for the new zone, + determined using the same approach as + {@link #ofLocal(LocalDateTime, ZoneId, ZoneOffset)}. + + To change the zone and adjust the local date-time, + use {@link #withZoneSameInstant(ZoneId)}. + + This instance is immutable and unaffected by this method call. + + @param zone the time-zone to change to, not null + @return a {@code ZonedDateTime} based on this date-time with the requested zone, not null" + {:arglists (quote (["java.time.ZonedDateTime" "java.time.ZoneId"]))} + (^js/JSJoda.ZonedDateTime + [^js/JSJoda.ZonedDateTime this ^js/JSJoda.ZoneId zone] + (.withZoneSameLocal this zone))) + +(defn with-zone-same-instant + "Returns a copy of this date-time with a different time-zone, + retaining the instant. + + This method changes the time-zone and retains the instant. + This normally results in a change to the local date-time. + + This method is based on retaining the same instant, thus gaps and overlaps + in the local time-line have no effect on the result. + + To change the offset while keeping the local time, + use {@link #withZoneSameLocal(ZoneId)}. + + @param zone the time-zone to change to, not null + @return a {@code ZonedDateTime} based on this date-time with the requested zone, not null + @throws DateTimeException if the result exceeds the supported date range" + {:arglists (quote (["java.time.ZonedDateTime" "java.time.ZoneId"]))} + (^js/JSJoda.ZonedDateTime + [^js/JSJoda.ZonedDateTime this ^js/JSJoda.ZoneId zone] + (.withZoneSameInstant this zone))) + +(defn plus-days + "Returns a copy of this {@code ZonedDateTime} with the specified number of days added. + + This operates on the local time-line, + {@link LocalDateTime#plusDays(long) adding days} to the local date-time. + This is then converted back to a {@code ZonedDateTime}, using the zone ID + to obtain the offset. + + When converting back to {@code ZonedDateTime}, if the local date-time is in an overlap, + then the offset will be retained if possible, otherwise the earlier offset will be used. + If in a gap, the local date-time will be adjusted forward by the length of the gap. + + This instance is immutable and unaffected by this method call. + + @param days the days to add, may be negative + @return a {@code ZonedDateTime} based on this date-time with the days added, not null + @throws DateTimeException if the result exceeds the supported date range" + {:arglists (quote (["java.time.ZonedDateTime" "long"]))} + (^js/JSJoda.ZonedDateTime [^js/JSJoda.ZonedDateTime this ^long days] + (.plusDays this days))) + +(defn to-local-time + "Gets the {@code LocalTime} part of this date-time. + + This returns a {@code LocalTime} with the same hour, minute, second and + nanosecond as this date-time. + + @return the time part of this date-time, not null" + {:arglists (quote (["java.time.ZonedDateTime"]))} + (^js/JSJoda.LocalTime [^js/JSJoda.ZonedDateTime this] (.toLocalTime this))) + +(defn get-long + "Gets the value of the specified field from this date-time as a {@code long}. + + This queries this date-time for the value of the specified field. + If it is not possible to return the value, because the field is not supported + or for some other reason, an exception is thrown. + + If the field is a {@link ChronoField} then the query is implemented here. + The {@link #isSupported(TemporalField) supported fields} will return valid + values based on this date-time. + All other {@code ChronoField} instances will throw an {@code UnsupportedTemporalTypeException}. + + If the field is not a {@code ChronoField}, then the result of this method + is obtained by invoking {@code TemporalField.getFrom(TemporalAccessor)} + passing {@code this} as the argument. Whether the value can be obtained, + and what the value represents, is determined by the field. + + @param field the field to get, not null + @return the value for the field + @throws DateTimeException if a value for the field cannot be obtained + @throws UnsupportedTemporalTypeException if the field is not supported + @throws ArithmeticException if numeric overflow occurs" + {:arglists (quote (["java.time.ZonedDateTime" + "java.time.temporal.TemporalField"]))} + (^long [^js/JSJoda.ZonedDateTime this ^js/JSJoda.TemporalField field] + (.getLong this field))) + +(defn get-offset + "Gets the zone offset, such as '+01:00'. + + This is the offset of the local date-time from UTC/Greenwich. + + @return the zone offset, not null" + {:arglists (quote (["java.time.ZonedDateTime"]))} + (^js/JSJoda.ZoneOffset [^js/JSJoda.ZonedDateTime this] (.offset this))) + +(defn with-year + "Returns a copy of this {@code ZonedDateTime} with the year altered. + + This operates on the local time-line, + {@link LocalDateTime#withYear(int) changing the year} of the local date-time. + This is then converted back to a {@code ZonedDateTime}, using the zone ID + to obtain the offset. + + When converting back to {@code ZonedDateTime}, if the local date-time is in an overlap, + then the offset will be retained if possible, otherwise the earlier offset will be used. + If in a gap, the local date-time will be adjusted forward by the length of the gap. + + This instance is immutable and unaffected by this method call. + + @param year the year to set in the result, from MIN_YEAR to MAX_YEAR + @return a {@code ZonedDateTime} based on this date-time with the requested year, not null + @throws DateTimeException if the year value is invalid" + {:arglists (quote (["java.time.ZonedDateTime" "int"]))} + (^js/JSJoda.ZonedDateTime [^js/JSJoda.ZonedDateTime this ^int year] + (.withYear this year))) + +(defn with-nano + "Returns a copy of this {@code ZonedDateTime} with the nano-of-second altered. + + This operates on the local time-line, + {@linkplain LocalDateTime#withNano(int) changing the time} of the local date-time. + This is then converted back to a {@code ZonedDateTime}, using the zone ID + to obtain the offset. + + When converting back to {@code ZonedDateTime}, if the local date-time is in an overlap, + then the offset will be retained if possible, otherwise the earlier offset will be used. + If in a gap, the local date-time will be adjusted forward by the length of the gap. + + This instance is immutable and unaffected by this method call. + + @param nanoOfSecond the nano-of-second to set in the result, from 0 to 999,999,999 + @return a {@code ZonedDateTime} based on this date-time with the requested nanosecond, not null + @throws DateTimeException if the nano value is invalid" + {:arglists (quote (["java.time.ZonedDateTime" "int"]))} + (^js/JSJoda.ZonedDateTime [^js/JSJoda.ZonedDateTime this ^int nano-of-second] + (.withNano this nano-of-second))) + +(defn to-epoch-second + "Converts this date-time to the number of seconds from the epoch + of 1970-01-01T00:00:00Z. + + This uses the {@linkplain #toLocalDateTime() local date-time} and + {@linkplain #getOffset() offset} to calculate the epoch-second value, + which is the number of elapsed seconds from 1970-01-01T00:00:00Z. + Instants on the time-line after the epoch are positive, earlier are negative. + + @return the number of seconds from the epoch of 1970-01-01T00:00:00Z" + {:arglists (quote (["java.time.ZonedDateTime"]))} + (^long [^js/JSJoda.ZonedDateTime this] (.toEpochSecond this))) + +(defn to-offset-date-time + "Converts this date-time to an {@code OffsetDateTime}. + + This creates an offset date-time using the local date-time and offset. + The zone ID is ignored. + + @return an offset date-time representing the same local date-time and offset, not null" + {:arglists (quote (["java.time.ZonedDateTime"]))} + (^js/JSJoda.OffsetDateTime [^js/JSJoda.ZonedDateTime this] + (.toOffsetDateTime this))) + +(defn with-later-offset-at-overlap + "Returns a copy of this date-time changing the zone offset to the + later of the two valid offsets at a local time-line overlap. + + This method only has any effect when the local time-line overlaps, such as + at an autumn daylight savings cutover. In this scenario, there are two + valid offsets for the local date-time. Calling this method will return + a zoned date-time with the later of the two selected. + + If this method is called when it is not an overlap, {@code this} + is returned. + + This instance is immutable and unaffected by this method call. + + @return a {@code ZonedDateTime} based on this date-time with the later offset, not null" + {:arglists (quote (["java.time.ZonedDateTime"]))} + (^js/JSJoda.ZonedDateTime [^js/JSJoda.ZonedDateTime this] + (.withLaterOffsetAtOverlap this))) + +(defn until + "Calculates the amount of time until another date-time in terms of the specified unit. + + This calculates the amount of time between two {@code ZonedDateTime} + objects in terms of a single {@code TemporalUnit}. + The start and end points are {@code this} and the specified date-time. + The result will be negative if the end is before the start. + For example, the amount in days between two date-times can be calculated + using {@code startDateTime.until(endDateTime, DAYS)}. + + The {@code Temporal} passed to this method is converted to a + {@code ZonedDateTime} using {@link #from(TemporalAccessor)}. + If the time-zone differs between the two zoned date-times, the specified + end date-time is normalized to have the same zone as this date-time. + + The calculation returns a whole number, representing the number of + complete units between the two date-times. + For example, the amount in months between 2012-06-15T00:00Z and 2012-08-14T23:59Z + will only be one month as it is one minute short of two months. + + There are two equivalent ways of using this method. + The first is to invoke this method. + The second is to use {@link TemporalUnit#between(Temporal, Temporal)}: +
+   // these two lines are equivalent
+   amount = start.until(end, MONTHS);
+   amount = MONTHS.between(start, end);
+ 
+ The choice should be made based on which makes the code more readable. + + The calculation is implemented in this method for {@link ChronoUnit}. + The units {@code NANOS}, {@code MICROS}, {@code MILLIS}, {@code SECONDS}, + {@code MINUTES}, {@code HOURS} and {@code HALF_DAYS}, {@code DAYS}, + {@code WEEKS}, {@code MONTHS}, {@code YEARS}, {@code DECADES}, + {@code CENTURIES}, {@code MILLENNIA} and {@code ERAS} are supported. + Other {@code ChronoUnit} values will throw an exception. + + The calculation for date and time units differ. + + Date units operate on the local time-line, using the local date-time. + For example, the period from noon on day 1 to noon the following day + in days will always be counted as exactly one day, irrespective of whether + there was a daylight savings change or not. + + Time units operate on the instant time-line. + The calculation effectively converts both zoned date-times to instants + and then calculates the period between the instants. + For example, the period from noon on day 1 to noon the following day + in hours may be 23, 24 or 25 hours (or some other amount) depending on + whether there was a daylight savings change or not. + + If the unit is not a {@code ChronoUnit}, then the result of this method + is obtained by invoking {@code TemporalUnit.between(Temporal, Temporal)} + passing {@code this} as the first argument and the converted input temporal + as the second argument. + + This instance is immutable and unaffected by this method call. + + @param endExclusive the end date, exclusive, which is converted to a {@code ZonedDateTime}, not null + @param unit the unit to measure the amount in, not null + @return the amount of time between this date-time and the end date-time + @throws DateTimeException if the amount cannot be calculated, or the end + temporal cannot be converted to a {@code ZonedDateTime} + @throws UnsupportedTemporalTypeException if the unit is not supported + @throws ArithmeticException if numeric overflow occurs" + {:arglists (quote (["java.time.ZonedDateTime" "java.time.temporal.Temporal" + "java.time.temporal.TemporalUnit"]))} + (^long + [^js/JSJoda.ZonedDateTime this ^js/JSJoda.Temporal end-exclusive + ^js/JSJoda.TemporalUnit unit] + (.until this end-exclusive unit))) + +(defn get-zone + "Gets the time-zone, such as 'Europe/Paris'. + + This returns the zone ID. This identifies the time-zone {@link ZoneRules rules} + that determine when and how the offset from UTC/Greenwich changes. + + The zone ID may be same as the {@linkplain #getOffset() offset}. + If this is true, then any future calculations, such as addition or subtraction, + have no complex edge cases due to time-zone rules. + See also {@link #withFixedOffsetZone()}. + + @return the time-zone, not null" + {:arglists (quote (["java.time.ZonedDateTime"]))} + (^js/JSJoda.ZoneId [^js/JSJoda.ZonedDateTime this] (.zone this))) + +(defn with-day-of-month + "Returns a copy of this {@code ZonedDateTime} with the day-of-month altered. + + This operates on the local time-line, + {@link LocalDateTime#withDayOfMonth(int) changing the day-of-month} of the local date-time. + This is then converted back to a {@code ZonedDateTime}, using the zone ID + to obtain the offset. + + When converting back to {@code ZonedDateTime}, if the local date-time is in an overlap, + then the offset will be retained if possible, otherwise the earlier offset will be used. + If in a gap, the local date-time will be adjusted forward by the length of the gap. + + This instance is immutable and unaffected by this method call. + + @param dayOfMonth the day-of-month to set in the result, from 1 to 28-31 + @return a {@code ZonedDateTime} based on this date-time with the requested day, not null + @throws DateTimeException if the day-of-month value is invalid, + or if the day-of-month is invalid for the month-year" + {:arglists (quote (["java.time.ZonedDateTime" "int"]))} + (^js/JSJoda.ZonedDateTime [^js/JSJoda.ZonedDateTime this ^int day-of-month] + (.withDayOfMonth this day-of-month))) + +(defn get-day-of-month + "Gets the day-of-month field. + + This method returns the primitive {@code int} value for the day-of-month. + + @return the day-of-month, from 1 to 31" + {:arglists (quote (["java.time.ZonedDateTime"]))} + (^int [^js/JSJoda.ZonedDateTime this] (.dayOfMonth this))) + +(defn from + "Obtains an instance of {@code ZonedDateTime} from a temporal object. + + This obtains a zoned date-time based on the specified temporal. + A {@code TemporalAccessor} represents an arbitrary set of date and time information, + which this factory converts to an instance of {@code ZonedDateTime}. + + The conversion will first obtain a {@code ZoneId} from the temporal object, + falling back to a {@code ZoneOffset} if necessary. It will then try to obtain + an {@code Instant}, falling back to a {@code LocalDateTime} if necessary. + The result will be either the combination of {@code ZoneId} or {@code ZoneOffset} + with {@code Instant} or {@code LocalDateTime}. + Implementations are permitted to perform optimizations such as accessing + those fields that are equivalent to the relevant objects. + + This method matches the signature of the functional interface {@link TemporalQuery} + allowing it to be used as a query via method reference, {@code ZonedDateTime::from}. + + @param temporal the temporal object to convert, not null + @return the zoned date-time, not null + @throws DateTimeException if unable to convert to an {@code ZonedDateTime}" + {:arglists (quote (["java.time.temporal.TemporalAccessor"]))} + (^js/JSJoda.ZonedDateTime [^js/JSJoda.TemporalAccessor temporal] + (js-invoke java.time.ZonedDateTime "from" temporal))) + +(defn is-after + "Checks if the instant of this date-time is after that of the specified date-time. + + This method differs from the comparison in {@link #compareTo} in that it + only compares the instant of the date-time. This is equivalent to using + {@code dateTime1.toInstant().isAfter(dateTime2.toInstant());}. + + This default implementation performs the comparison based on the epoch-second + and nano-of-second. + + @param other the other date-time to compare to, not null + @return true if this is after the specified date-time" + {:arglists (quote (["java.time.ZonedDateTime" + "java.time.chrono.ChronoZonedDateTime"]))} + (^boolean [^js/JSJoda.ZonedDateTime this ^js/JSJoda.ChronoZonedDateTime other] + (.isAfter this other))) + +(defn minus-nanos + "Returns a copy of this {@code ZonedDateTime} with the specified number of nanoseconds subtracted. + + This operates on the instant time-line, such that subtracting one nano will + always be a duration of one nano earlier. + This may cause the local date-time to change by an amount other than one nano. + Note that this is a different approach to that used by days, months and years. + + This instance is immutable and unaffected by this method call. + + @param nanos the nanos to subtract, may be negative + @return a {@code ZonedDateTime} based on this date-time with the nanoseconds subtracted, not null + @throws DateTimeException if the result exceeds the supported date range" + {:arglists (quote (["java.time.ZonedDateTime" "long"]))} + (^js/JSJoda.ZonedDateTime [^js/JSJoda.ZonedDateTime this ^long nanos] + (.minusNanos this nanos))) + +(defn is-supported + {:arglists (quote + (["java.time.ZonedDateTime" "java.time.temporal.TemporalField"] + ["java.time.ZonedDateTime" "java.time.temporal.TemporalUnit"]))} + (^boolean [^js/JSJoda.ZonedDateTime this arg0] + (.isSupported ^js/JSJoda.ZonedDateTime this arg0))) + +(defn minus-years + "Returns a copy of this {@code ZonedDateTime} with the specified number of years subtracted. + + This operates on the local time-line, + {@link LocalDateTime#minusYears(long) subtracting years} to the local date-time. + This is then converted back to a {@code ZonedDateTime}, using the zone ID + to obtain the offset. + + When converting back to {@code ZonedDateTime}, if the local date-time is in an overlap, + then the offset will be retained if possible, otherwise the earlier offset will be used. + If in a gap, the local date-time will be adjusted forward by the length of the gap. + + This instance is immutable and unaffected by this method call. + + @param years the years to subtract, may be negative + @return a {@code ZonedDateTime} based on this date-time with the years subtracted, not null + @throws DateTimeException if the result exceeds the supported date range" + {:arglists (quote (["java.time.ZonedDateTime" "long"]))} + (^js/JSJoda.ZonedDateTime [^js/JSJoda.ZonedDateTime this ^long years] + (.minusYears this years))) + +(defn get-chronology + "Gets the chronology of this date-time. + + The {@code Chronology} represents the calendar system in use. + The era and other fields in {@link ChronoField} are defined by the chronology. + + @return the chronology, not null" + {:arglists (quote (["java.time.ZonedDateTime"]))} + (^js/JSJoda.Chronology [^js/JSJoda.ZonedDateTime this] (.chronology this))) + +(defn parse + {:arglists (quote (["java.lang.CharSequence"] + ["java.lang.CharSequence" + "java.time.format.DateTimeFormatter"]))} + (^js/JSJoda.ZonedDateTime [^java.lang.CharSequence text] + (js-invoke java.time.ZonedDateTime "parse" text)) + (^js/JSJoda.ZonedDateTime + [^java.lang.CharSequence text ^js/JSJoda.DateTimeFormatter formatter] + (js-invoke java.time.ZonedDateTime "parse" text formatter))) + +(defn with-second + "Returns a copy of this {@code ZonedDateTime} with the second-of-minute altered. + + This operates on the local time-line, + {@linkplain LocalDateTime#withSecond(int) changing the time} of the local date-time. + This is then converted back to a {@code ZonedDateTime}, using the zone ID + to obtain the offset. + + When converting back to {@code ZonedDateTime}, if the local date-time is in an overlap, + then the offset will be retained if possible, otherwise the earlier offset will be used. + If in a gap, the local date-time will be adjusted forward by the length of the gap. + + This instance is immutable and unaffected by this method call. + + @param second the second-of-minute to set in the result, from 0 to 59 + @return a {@code ZonedDateTime} based on this date-time with the requested second, not null + @throws DateTimeException if the second value is invalid" + {:arglists (quote (["java.time.ZonedDateTime" "int"]))} + (^js/JSJoda.ZonedDateTime [^js/JSJoda.ZonedDateTime this ^int second] + (.withSecond this second))) + +(defn to-local-date + "Gets the {@code LocalDate} part of this date-time. + + This returns a {@code LocalDate} with the same year, month and day + as this date-time. + + @return the date part of this date-time, not null" + {:arglists (quote (["java.time.ZonedDateTime"]))} + (^js/JSJoda.LocalDate [^js/JSJoda.ZonedDateTime this] (.toLocalDate this))) + +(defn get-minute + "Gets the minute-of-hour field. + + @return the minute-of-hour, from 0 to 59" + {:arglists (quote (["java.time.ZonedDateTime"]))} + (^int [^js/JSJoda.ZonedDateTime this] (.minute this))) + +(defn hash-code + "A hash code for this date-time. + + @return a suitable hash code" + {:arglists (quote (["java.time.ZonedDateTime"]))} + (^int [^js/JSJoda.ZonedDateTime this] (.hashCode this))) + +(defn with + {:arglists (quote (["java.time.ZonedDateTime" + "java.time.temporal.TemporalAdjuster"] + ["java.time.ZonedDateTime" + "java.time.temporal.TemporalField" "long"]))} + (^js/JSJoda.ZonedDateTime + [^js/JSJoda.ZonedDateTime this ^js/JSJoda.TemporalAdjuster adjuster] + (.with this adjuster)) + (^js/JSJoda.ZonedDateTime + [^js/JSJoda.ZonedDateTime this ^js/JSJoda.TemporalField field + ^long new-value] + (.with this field new-value))) + +(defn now + {:arglists (quote ([] ["java.time.Clock"] ["java.time.ZoneId"]))} + (^js/JSJoda.ZonedDateTime [] (js-invoke java.time.ZonedDateTime "now")) + (^js/JSJoda.ZonedDateTime [arg0] + (js-invoke java.time.ZonedDateTime "now" arg0))) + +(defn to-local-date-time + "Gets the {@code LocalDateTime} part of this date-time. + + This returns a {@code LocalDateTime} with the same year, month, day and time + as this date-time. + + @return the local date-time part of this date-time, not null" + {:arglists (quote (["java.time.ZonedDateTime"]))} + (^js/JSJoda.LocalDateTime [^js/JSJoda.ZonedDateTime this] + (.toLocalDateTime this))) + +(defn get-month-value + "Gets the month-of-year field from 1 to 12. + + This method returns the month as an {@code int} from 1 to 12. + Application code is frequently clearer if the enum {@link Month} + is used by calling {@link #getMonth()}. + + @return the month-of-year, from 1 to 12 + @see #getMonth()" + {:arglists (quote (["java.time.ZonedDateTime"]))} + (^int [^js/JSJoda.ZonedDateTime this] (.monthValue this))) + +(defn with-day-of-year + "Returns a copy of this {@code ZonedDateTime} with the day-of-year altered. + + This operates on the local time-line, + {@link LocalDateTime#withDayOfYear(int) changing the day-of-year} of the local date-time. + This is then converted back to a {@code ZonedDateTime}, using the zone ID + to obtain the offset. + + When converting back to {@code ZonedDateTime}, if the local date-time is in an overlap, + then the offset will be retained if possible, otherwise the earlier offset will be used. + If in a gap, the local date-time will be adjusted forward by the length of the gap. + + This instance is immutable and unaffected by this method call. + + @param dayOfYear the day-of-year to set in the result, from 1 to 365-366 + @return a {@code ZonedDateTime} based on this date with the requested day, not null + @throws DateTimeException if the day-of-year value is invalid, + or if the day-of-year is invalid for the year" + {:arglists (quote (["java.time.ZonedDateTime" "int"]))} + (^js/JSJoda.ZonedDateTime [^js/JSJoda.ZonedDateTime this ^int day-of-year] + (.withDayOfYear this day-of-year))) + +(defn compare-to + "Compares this date-time to another date-time, including the chronology. + + The comparison is based first on the instant, then on the local date-time, + then on the zone ID, then on the chronology. + It is \"consistent with equals\", as defined by {@link Comparable}. + + If all the date-time objects being compared are in the same chronology, then the + additional chronology stage is not required. + + This default implementation performs the comparison defined above. + + @param other the other date-time to compare to, not null + @return the comparator value, negative if less, positive if greater" + {:arglists (quote (["java.time.ZonedDateTime" + "java.time.chrono.ChronoZonedDateTime"]))} + (^int [^js/JSJoda.ZonedDateTime this ^js/JSJoda.ChronoZonedDateTime other] + (.compareTo this other))) + +(defn of-strict + "Obtains an instance of {@code ZonedDateTime} strictly validating the + combination of local date-time, offset and zone ID. + + This creates a zoned date-time ensuring that the offset is valid for the + local date-time according to the rules of the specified zone. + If the offset is invalid, an exception is thrown. + + @param localDateTime the local date-time, not null + @param offset the zone offset, not null + @param zone the time-zone, not null + @return the zoned date-time, not null" + {:arglists (quote (["java.time.LocalDateTime" "java.time.ZoneOffset" + "java.time.ZoneId"]))} + (^js/JSJoda.ZonedDateTime + [^js/JSJoda.LocalDateTime local-date-time ^js/JSJoda.ZoneOffset offset + ^js/JSJoda.ZoneId zone] + (js-invoke java.time.ZonedDateTime "ofStrict" local-date-time offset zone))) + +(defn get-month + "Gets the month-of-year field using the {@code Month} enum. + + This method returns the enum {@link Month} for the month. + This avoids confusion as to what {@code int} values mean. + If you need access to the primitive {@code int} value then the enum + provides the {@link Month#getValue() int value}. + + @return the month-of-year, not null + @see #getMonthValue()" + {:arglists (quote (["java.time.ZonedDateTime"]))} + (^js/JSJoda.Month [^js/JSJoda.ZonedDateTime this] (.month this))) + +(defn of-instant + {:arglists (quote (["java.time.Instant" "java.time.ZoneId"] + ["java.time.LocalDateTime" "java.time.ZoneOffset" + "java.time.ZoneId"]))} + (^js/JSJoda.ZonedDateTime [^js/JSJoda.Instant instant ^js/JSJoda.ZoneId zone] + (js-invoke java.time.ZonedDateTime "ofInstant" instant zone)) + (^js/JSJoda.ZonedDateTime + [^js/JSJoda.LocalDateTime local-date-time ^js/JSJoda.ZoneOffset offset + ^js/JSJoda.ZoneId zone] + (js-invoke java.time.ZonedDateTime "ofInstant" local-date-time offset zone))) + +(defn plus-seconds + "Returns a copy of this {@code ZonedDateTime} with the specified number of seconds added. + + This operates on the instant time-line, such that adding one second will + always be a duration of one second later. + This may cause the local date-time to change by an amount other than one second. + Note that this is a different approach to that used by days, months and years. + + This instance is immutable and unaffected by this method call. + + @param seconds the seconds to add, may be negative + @return a {@code ZonedDateTime} based on this date-time with the seconds added, not null + @throws DateTimeException if the result exceeds the supported date range" + {:arglists (quote (["java.time.ZonedDateTime" "long"]))} + (^js/JSJoda.ZonedDateTime [^js/JSJoda.ZonedDateTime this ^long seconds] + (.plusSeconds this seconds))) + +(defn get + "Gets the value of the specified field from this date-time as an {@code int}. + + This queries this date-time for the value of the specified field. + The returned value will always be within the valid range of values for the field. + If it is not possible to return the value, because the field is not supported + or for some other reason, an exception is thrown. + + If the field is a {@link ChronoField} then the query is implemented here. + The {@link #isSupported(TemporalField) supported fields} will return valid + values based on this date-time, except {@code NANO_OF_DAY}, {@code MICRO_OF_DAY}, + {@code EPOCH_DAY}, {@code PROLEPTIC_MONTH} and {@code INSTANT_SECONDS} which are too + large to fit in an {@code int} and throw a {@code DateTimeException}. + All other {@code ChronoField} instances will throw an {@code UnsupportedTemporalTypeException}. + + If the field is not a {@code ChronoField}, then the result of this method + is obtained by invoking {@code TemporalField.getFrom(TemporalAccessor)} + passing {@code this} as the argument. Whether the value can be obtained, + and what the value represents, is determined by the field. + + @param field the field to get, not null + @return the value for the field + @throws DateTimeException if a value for the field cannot be obtained or + the value is outside the range of valid values for the field + @throws UnsupportedTemporalTypeException if the field is not supported or + the range of values exceeds an {@code int} + @throws ArithmeticException if numeric overflow occurs" + {:arglists (quote (["java.time.ZonedDateTime" + "java.time.temporal.TemporalField"]))} + (^int [^js/JSJoda.ZonedDateTime this ^js/JSJoda.TemporalField field] + (.get this field))) + +(defn equals + "Checks if this date-time is equal to another date-time. + + The comparison is based on the offset date-time and the zone. + Only objects of type {@code ZonedDateTime} are compared, other types return false. + + @param obj the object to check, null returns false + @return true if this is equal to the other date-time" + {:arglists (quote (["java.time.ZonedDateTime" "java.lang.Object"]))} + (^boolean [^js/JSJoda.ZonedDateTime this ^java.lang.Object obj] + (.equals this obj))) + +(defn format + "Formats this date-time using the specified formatter. + + This date-time will be passed to the formatter to produce a string. + + @param formatter the formatter to use, not null + @return the formatted date-time string, not null + @throws DateTimeException if an error occurs during printing" + {:arglists (quote (["java.time.ZonedDateTime" + "java.time.format.DateTimeFormatter"]))} + (^java.lang.String + [^js/JSJoda.ZonedDateTime this ^js/JSJoda.DateTimeFormatter formatter] + (.format this formatter))) + +(defn plus-years + "Returns a copy of this {@code ZonedDateTime} with the specified number of years added. + + This operates on the local time-line, + {@link LocalDateTime#plusYears(long) adding years} to the local date-time. + This is then converted back to a {@code ZonedDateTime}, using the zone ID + to obtain the offset. + + When converting back to {@code ZonedDateTime}, if the local date-time is in an overlap, + then the offset will be retained if possible, otherwise the earlier offset will be used. + If in a gap, the local date-time will be adjusted forward by the length of the gap. + + This instance is immutable and unaffected by this method call. + + @param years the years to add, may be negative + @return a {@code ZonedDateTime} based on this date-time with the years added, not null + @throws DateTimeException if the result exceeds the supported date range" + {:arglists (quote (["java.time.ZonedDateTime" "long"]))} + (^js/JSJoda.ZonedDateTime [^js/JSJoda.ZonedDateTime this ^long years] + (.plusYears this years))) + +(defn minus-days + "Returns a copy of this {@code ZonedDateTime} with the specified number of days subtracted. + + This operates on the local time-line, + {@link LocalDateTime#minusDays(long) subtracting days} to the local date-time. + This is then converted back to a {@code ZonedDateTime}, using the zone ID + to obtain the offset. + + When converting back to {@code ZonedDateTime}, if the local date-time is in an overlap, + then the offset will be retained if possible, otherwise the earlier offset will be used. + If in a gap, the local date-time will be adjusted forward by the length of the gap. + + This instance is immutable and unaffected by this method call. + + @param days the days to subtract, may be negative + @return a {@code ZonedDateTime} based on this date-time with the days subtracted, not null + @throws DateTimeException if the result exceeds the supported date range" + {:arglists (quote (["java.time.ZonedDateTime" "long"]))} + (^js/JSJoda.ZonedDateTime [^js/JSJoda.ZonedDateTime this ^long days] + (.minusDays this days)))