       try
         dt = Date(t)
         tm = _array(t)
-        s = tz(t, format)
+        s = _strftime(t, format)
       catch error
         console.log error
         console.log("Unable to convert tick for timestamp " + t)


_four_digit_year = (t) ->
  # Round to the nearest Jan 1, roughly.
  dt = Date(t)
  year = dt.getFullYear()
  if dt.getMonth() >= 7
      year += 1

_array = (t) ->
  return tz(t, "%Y %m %d %H %M %S").split(/\s+/).map( (e) -> return parseInt(e, 10) );

_strftime = (t, format) ->
  if _.isFunction(format)
    return format(t)
  else
    return tz(t, format)

class DatetimeFormatter

  # Labels of time units, from finest to coarsest.
