From 00672c0374a0a26eb812c66ce147d6c0222e9f74 Mon Sep 17 00:00:00 2001 From: Henry Widd Date: Thu, 24 Aug 2023 10:55:41 +0100 Subject: [PATCH] readme- point to cheatsheet --- README.adoc | 33 ++++++++++++++++++--------------- 1 file changed, 18 insertions(+), 15 deletions(-) diff --git a/README.adoc b/README.adoc index debd91f..aa3855e 100644 --- a/README.adoc +++ b/README.adoc @@ -11,14 +11,6 @@ Based on Java 8 time (on the JVM) and js-joda (on JavaScript runtimes). We are considering an implementation based on https://github.com/tc39/proposal-temporal[Temporal], via https://github.com/henryw374/tempo[Tempo] when it is available. -[source,clojure] ----- -(require '[tick.core :as t]) - -;; Get the current time -(t/instant) ----- - See https://www.youtube.com/watch?v=UFuL-ZDoB2U[Henry Widd's talk at Clojure/North 2019] for some background == Status @@ -37,13 +29,28 @@ See https://www.youtube.com/watch?v=UFuL-ZDoB2U[Henry Widd's talk at Clojure/Nor * If you meet the criteria to use cljc.java-time but would like a more terse API and the benefits of e.g. https://juxt.github.io/tick/#_substitution[(t/with-clock ...)] but will not miss having every date-time recipe one google search away, then tick might be a good choice. Tick uses https://github.com/henryw374/cljc.java-time[cljc.java-time] so you can always drop to that if Tick is missing something you need. * Similar in aiming for a terse API, but jvm-only is https://github.com/dm3/clojure.java-time[clojure.java-time]. -== Top tips +== Usage + +[source,clojure] +---- +(require '[tick.core :as t]) + +;; Get the current time +(t/instant) +---- + -=== java.time +https://github.com/juxt/tick/docs/cheatsheet.md[Cheat Sheet] + +https://juxt.github.io/tick/[Comprehensive Documentation] + +=== Top tips + +==== java.time In both Clojure and Clojurescript versions, tick is just calling through to java.time methods. Understanding https://docs.oracle.com/javase/tutorial/datetime/iso/overview.html[the main entities of java.time] is necessary to use tick. For example, one should know that there are 2 separate ways to measure amounts of time (Period and Duration), 3 ways to represent a point on the timeline (Instant, ZonedDateTime & OffsetDateTime) and so on. -=== Instants +==== Instants Instants are not 'calendar-aware' - they just contain millis+nanos fields representing an offset from the Unix epoch. This means Instants have no method to get their year or month for example, @@ -72,10 +79,6 @@ will have names which are in the plural. Functions that work with dates and times are singular. Knowing that, e.g. `t/second` vs `t/seconds` makes sense. -== Docs - -https://juxt.github.io/tick/[Full Tick Documentation] - == Install Get the latest from https://clojars.org/tick[Clojars] and