{"id":13591295,"url":"https://github.com/juxt/tick","last_synced_at":"2025-08-01T04:46:05.303Z","repository":{"id":37742754,"uuid":"72018343","full_name":"juxt/tick","owner":"juxt","description":"Time as a value.","archived":false,"fork":false,"pushed_at":"2025-06-10T16:14:33.000Z","size":3315,"stargazers_count":624,"open_issues_count":6,"forks_count":57,"subscribers_count":17,"default_branch":"master","last_synced_at":"2025-07-07T19:47:28.705Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Clojure","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/juxt.png","metadata":{"files":{"readme":"README.adoc","changelog":"CHANGELOG","contributing":"CONTRIBUTING.adoc","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2016-10-26T15:41:33.000Z","updated_at":"2025-06-12T19:49:39.000Z","dependencies_parsed_at":"2023-02-08T05:45:33.833Z","dependency_job_id":"886bb63b-8fe8-44f7-8d56-9e930a0e0acc","html_url":"https://github.com/juxt/tick","commit_stats":{"total_commits":692,"total_committers":40,"mean_commits":17.3,"dds":"0.49132947976878616","last_synced_commit":"c4a0dcab2e5c2740a0d4903d41dbe17715f0b6cb"},"previous_names":[],"tags_count":54,"template":false,"template_full_name":null,"purl":"pkg:github/juxt/tick","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/juxt%2Ftick","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/juxt%2Ftick/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/juxt%2Ftick/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/juxt%2Ftick/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/juxt","download_url":"https://codeload.github.com/juxt/tick/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/juxt%2Ftick/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":268171719,"owners_count":24207418,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-01T02:00:08.611Z","response_time":67,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-01T16:00:55.661Z","updated_at":"2025-08-01T04:46:05.269Z","avatar_url":"https://github.com/juxt.png","language":"Clojure","funding_links":[],"categories":["Clojure","Date and Time"],"sub_categories":[],"readme":"image:https://img.shields.io/clojars/v/tick.svg?style=svg[\"clojars\",link=\"https://clojars.org/tick\"]\nimage:https://github.com/juxt/tick/actions/workflows/tests.yaml/badge.svg?style=svg[\"tests build\",link=\"https://github.com/juxt/tick/actions/workflows/tests.yaml\"]\nimage:https://raw.githubusercontent.com/babashka/babashka/master/logo/badge.svg[\"bb compatible\",link=\"https://book.babashka.org#badges\"]\n\n= tick\n\nA Clojure(Script) \u0026 babashka library for dealing with time. Intended as a\nreplacement for clj-time.\n\nBased on `java.time` (on the JVM) and `js-joda` (on JavaScript\nruntimes). \n\nFor a cross-platform library using Javascript's modern date-time API https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal[Temporal], see https://github.com/henryw374/tempo[Tempo] \n\nSee https://www.youtube.com/watch?v=UFuL-ZDoB2U[Henry Widd's talk at Clojure/North 2019] for more background \u0026 rationale.\n\n== Status\n\n* tick.core - stable\n* tick.alpha.interval - Alpha: Ready to use with the caveat that the API might still undergo minor changes. Note also that this part of tick is not being actively maintained at the moment (other than to keep existing tests passing). There are currently around https://github.com/juxt/tick/issues?q=is%3Aissue+is%3Aopen+label%3Ainterval-calculus[4 open tickets]  relating to intervals which no one is looking at. It may be maintained again in the future of course.\n\n== Should you use Tick for date-time work?\n\n=== Concision vs Discoverability\n\n* If you are just working on the JVM then raw interop will work of course. Doing so, every java.time recipe is easily found via web search and there are many tutorials to aid understanding.\n* New and even experienced users of java.time often trip up on Instant not being calendar-aware, so if you would like https://widdindustries.com/why-not-interop/[improved error messages] then use either https://github.com/henryw374/cljc.java-time[cljc.java-time] (which has the same API as java.time and which underpins tick) or tick.\n* To use tick effectively an understanding of java.time is required. If you have that understanding and will spend significant time working with dates and times from Clojure, then learning Tick can be worthwhile because it provides a concise, single-ns API.\n\n=== Cross-Platform and/or just JS runtimes\n\n* If working in a Javascript environment then one should be aware that the legacy Date API is https://maggiepint.com/2017/04/09/fixing-javascript-date-getting-started/[flawed]\n* Either tick or https://github.com/henryw374/cljc.java-time[cljc.java-time] (which underpins tick) are sane alternatives to js/Date. The JS build size https://widdindustries.com/blog/clojurescript-datetime-lib-comparison.html[will likely not adversely affect your users] and if you already know java.time then your knowledge will carry over. \n* https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal[Temporal] is the native JS replacement for the legacy Date (similar to how java.time was on the JVM). It has some overlap with java.time but also some significant differences. Please see the https://github.com/henryw374/tempo[Tempo] library for an alternative to tick with uses that.\n\n== Usage \n\n[source,clojure]\n----\n(require '[tick.core :as t])\n\n;; Get the current time\n(t/instant)\n----\n\n\nhttps://github.com/juxt/tick/blob/master/docs/cheatsheet.md[Cheat Sheet]\n\nhttps://juxt.github.io/tick/[Comprehensive Documentation]\n\n=== Top tips \n\n==== java.time\n\nIn 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 \u0026 OffsetDateTime) and so on.\n\n==== Instants \n\nInstants are not 'calendar-aware' - they just contain millis+nanos fields representing an \noffset from the Unix epoch. This means Instants have no method to get their year or month for example, \nbecause to do so would require a calendar (e.g. the https://en.wikipedia.org/wiki/Gregorian_calendar[Gregorian calendar]).\n\nHowever, the following does work in Tick:\n`(t/year (t/instant))`. To make that possible, tick first converts the Instant into a ZonedDateTime \n(which does have a calendar). Take note however that the zone of the ZonedDateTime will be the \nbrowser's or jvm's timezone. To be explicit about the zone required do this:  \n\n[source,clojure]\n----\n(-\u003e (t/instant)\n    (t/in \"UTC\")\n    (t/year))\n----\n\nThe other cases where calendar-awareness might come up is when formatting Instants to string or when\nshifting them by e.g. years/months, so Tick \nhttps://widdindustries.com/why-not-interop/[shows explanatory error messages in that case].\n\n=== Singular vs Plural ?\n\nAs with java.time, any functions working with amounts of time (ie Durations or Periods), \nwill have names which are in the plural. Functions that\nwork with dates and times are singular. Knowing that, e.g. `t/second` vs `t/seconds` \nmakes sense.\n\n== Install\n\nGet the latest from https://clojars.org/tick[Clojars] and\nadd to your `project.clj`, `build.boot` or `deps.edn`.\n\nTo use this from Clojurescript, you must have at least version 1.11.51. If using shadow-cljs, it must be at least version 2.19.3\n\nIf using cljsjs, add https://clojars.org/henryw374/js-joda[js-joda] and https://clojars.org/henryw374/js-joda-locale-en-us[js-joda-locale-en-us] and https://clojars.org/cljsjs/js-joda-timezone[js-joda-timezone] to your dependencies as well.\n\nFor Clojurescript users of Tick, see https://github.com/juxt/tick/blob/master/docs/cljs.adoc[docs/cljs.adoc], for\nsome discussion around Clojurescript build size.\n\nHere is a one-liner to drop into a node repl with tick:\n\n----\nclj -Sdeps '{:deps {org.clojure/clojurescript {:mvn/version \"RELEASE\" } tick/tick {:mvn/version \"RELEASE\"} henryw374/js-joda {:mvn/version \"RELEASE\"} }}' -m cljs.main  -re node  --repl\n----\n\nHere is how to get to a babashka (v 1.2.174+) repl with tick:\n\n----\nexport BABASHKA_CLASSPATH=$(clojure -Spath -Sdeps '{:deps {tick/tick {:mvn/version \"0.6.0\"}}}')\n\nbb\n----\n\n\n== Development\n\n=== Develop The Documentation Site\n\nBuild the html\n----\nmake\n----\n\n`make dev-docs-cljs` to build the js for the site needs fixing.\n\n\n=== Build a production version of the Documentation Site\n\nThe following is not working currently:\n\n----\nmake release-docs-cljs\n----\n\n=== Develop Tick\n\n----\nclj -Atest-clj:test-cljs\n----\n\n - To start testing clojurescript, follow instructions in the `cljs` ns.\n - To start testing clojure, follow instructions in the the `repl` ns.\n\nSee the .github dir to see instructions for CLI testing\n\n=== Release\n\ncreate a git tag.\n\n`make install` (this installs in ~/.m2 - check that things look ok)\n\n`make deploy`  - you need to have set up clojars credentials as per https://github.com/applied-science/deps-library\n\n`git push origin new-tag-name`\n\n== Acknowledgements\n\nIn particular, special credit to Eric Evans for discovering Allen's\ninterval algebra and pointing out its potential usefulness,\ndemonstrating a working implementation of Allen's ideas in\nlink:https://github.com/domainlanguage/time-count[his Clojure library].\n\nThanks also to my esteemed colleagues Patrik Kårlin for his redesign of\nthe interval constructor function, and Henry Widd for porting to cljc.\n\n== References\n\n* https://github.com/dm3/clojure.java-time\n* https://clojuresync.com/emily-ashley/\n* https://github.com/aphyr/tea-time\n* https://github.com/sunng87/rigui\n\n== Copyright \u0026 License\n\nThe MIT License (MIT)\n\nCopyright © 2016-2021 JUXT LTD.\n\nPermission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjuxt%2Ftick","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjuxt%2Ftick","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjuxt%2Ftick/lists"}