https://github.com/seancorfield/clj-time/issues/8
Given that a two-argument version exists to specify a timezone, so you
can say (formatter "fmtstr" utc) - utc coming from clj-time.core -
he's right that this is probably odd / undesirable... and there's no
easy / obvious way to create a formatter with the default timezone,
without dropping down to the underlying Java.
I'm considering changing (formatter "fmtstr") to mean just
(DateTimeFormat/forPattern "fmtstr") and bumping the version to 0.4.0
since this is potentially a breaking change but I wanted to get a
sense of whether anyone cares / has a strong opinion?
--
Sean A Corfield -- (904) 302-SEAN
An Architect's View -- http://corfield.org/
World Singles, LLC. -- http://worldsingles.com/
"Perfection is the enemy of the good."
-- Gustave Flaubert, French realist novelist (1821-1880)
Ah yes, but if that's the normal desired behavior that's an ugly
default compared to (formatter "fmtstr")...
Also worth noting is that Avi pointed out that (now),
(today-at-midnight), (epoch) etc all use UTC instead of the default
time zone so this is a broader philosophical point of whether clj-time
should continue to use UTC as its default or your default time zone. I
tend to have all my servers set to UTC and do everything in UTC (and
then convert for input / output into the local user's timezone) so I'm
perfectly happy with clj-time as it stands. This is more about whether
the majority of users would prefer the current UTC behavior or whether
it would be more convenient to use the (local) default time zone?
Currently folks would need (to-time-zone (now) (default-time-zone))
and similar calls. If the behavior was changed, folks who wanted UTC
would need (to-time-zone (now) utc) - although for many of these calls
I'd probably add an optional timezone argument to support (now utc).
Hmm, that might be worthwhile anyway to allow (now
(default-time-zone))...
Maybe there should be a *switch* for that ...
A good suggestion as a possible compromise to allow both defaults.
Right now, my default position is to not change anything unless enough
folks indicate a desire for default time zone per Avi's suggestion.
This is an important, valid point.
Probably I should amend my earlier suggestion from a switch that uses
either UTC or the OS timezone setting to, instead, that there should
be a *default-time-zone* Var that is, by default, UTC, but which you
can set!, alter-var-root!, or dynamically bind to something else
before/when calling into the lib if you want some other default in the
no-timezone-argument versions of the functions in the lib.