Public Vars

Back

predefined-formatters (clj)

(source)

variable

Examples

tick
(ns tick.api-test
  (:require
    [clojure.test
     :refer [deftest is testing run-tests]
     :refer-macros [deftest is testing run-tests]]
    [tick.core :as t]
    [tick.locale-en-us]
    [tick.protocols :as p]
    [cljc.java-time.clock]
    [cljc.java-time.instant]
    [cljc.java-time.day-of-week]
    [cljc.java-time.month]
    [cljc.java-time.year]
    #?@(:cljs [[java.time :refer [Instant]]]))
  #?(:clj
     (:import [java.time Instant])))

(deftest formatting-test
  (testing "all predefined formatters exist"
    (doseq [pre-defined (vals t/predefined-formatters)]
      (is pre-defined)))
  (let [d "3030-05-03"]
    (is (= d (t/format :iso-local-date (t/date d))))
    (is (= d (t/format (t/formatter :iso-local-date) (t/date d))))
    (is (= d (t/format (t/formatter "YYYY-MM-dd") (t/date d))))
    #?(:bb
       ; bb only inlcludes the English Locale by default
       (is (= "3030-May-03" (t/format (t/formatter "YYYY-MMM-dd" java.util.Locale/FRENCH)
                              (t/date d))))
       :clj
       (is (= "3030-mai-03" (t/format (t/formatter "YYYY-MMM-dd" java.util.Locale/FRENCH)
                              (t/date d)))))))