Skip to content

Commit

Permalink
readme- point to cheatsheet
Browse files Browse the repository at this point in the history
  • Loading branch information
henryw374 committed Aug 24, 2023
1 parent 5f476d3 commit 00672c0
Showing 1 changed file with 18 additions and 15 deletions.
33 changes: 18 additions & 15 deletions README.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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,
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 00672c0

Please sign in to comment.