Liking cljdoc? Tell your friends :D

Clojurescript

There are some considerations when using tick with Clojurescript

Timezone and Locale data

TL;DR if you’re working with timezones and/or need to create custom formatters from patterns, such as "dd MMM yyyy"

add the following to your dependencies:



and add this to your cljs code somewhere before timezones and locales are used


(ns xyz

(:require [tick.alpha.api] [cljsjs.js-joda-timezone] [henryw374.js-joda-locale-en-us]))

(set! js/JSJoda (.use js/JSJoda js/JSJodaLocale))


Tick uses the js-joda library, which aims to replicate three-ten-backport project. JS-Joda is broken down into a core project (what tick depends on) and additional timezone and locale projects.

The js-joda timezone dependency contains the timezone database, containing mappings between zone names, their offsets from UTC, and daylight savings(DST) data.


 (. ZoneId of "Europe/London")
---

Locale data is needed for custom date formatters which need particular symbols, such as M for month. Due to the size and complexity of using the js-joda-locale, the authors of js-joda-locale have created prebuilt locale packages, for specific locales. en-US is one which is currently packaged for cljs and can be used as suggested above. The henryw374.js-joda-locale-en-us package is not yet available on cljsjs because the underlying package is not yet on npm see for more info.

Clock

Clock in js-joda is currently missing the offset function js-joda issue 245

OffsetTime and OffsetDateTime

OffsetTime is currently missing from JS-Joda (see JS-Joda issue 240). For now, tick uses LocalTime as the implementation which is not ideal.

OffsetDateTime is also missing but ZonedDateTime has the same functionality so this shouldn’t be a problem.

Can you improve this documentation?Edit on GitHub

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close