Skip to content

v0.3.0

Choose a tag to compare

@woodie woodie released this 10 Jul 09:57

humane v0.3.0

collapse_minute renamed to include_seconds (breaking)

Humane::TimeFormatter.new's option is now include_seconds: (default false),
replacing collapse_minute: (default true).

This isn't just a rename -- the polarity inverts too. collapse_minute: true (the
old default) suppressed seconds below a minute; include_seconds: false (the new
default) does the exact same thing, so the default behavior is unchanged. But
collapse_minute: false and include_seconds: true are the two ends of that same
inversion, not equivalents of each other.

The rename borrows ActionView's own name for this concept -- distance_of_time_in_words
has an include_seconds: option that defaults false for the same reason this one
does. Reusing the name isn't just convenience: the defaults independently agree
(Rails defaults to suppressing seconds too), which is a stronger signal this is the
right name than either language picking its own term would have been.

collapse_minute read ambiguously once humane-swift's approximate option
(ActionView-inspired "about"/"in about" prefixing on hour-plus buckets) entered the
picture -- "collapse" suggested the same kind of rounding-language operation
approximate performs, when this option has only ever been a granularity floor
below a minute. include_seconds doesn't compete for that word.

Upgrading

  • No explicit collapse_minute:/include_seconds: argument: no change needed,
    behavior is identical.
  • collapse_minute: false: change to include_seconds: true.
  • collapse_minute: true: remove the argument entirely (now the default), or change
    to include_seconds: false if being explicit is preferred.

scandalous is the one known consumer and doesn't pass this option explicitly, so no
follow-up is required there -- worth double-checking before bumping its humane pin
past "~> 0.1", since that pin also hasn't picked up the v0.2.0 wording change yet
(see that release's own upgrade note).