- Moved the package to use "ES Modules" exports.
Fixed the CDN bundle javascript-time-ago.js
when it exported the TimeAgo
class as a default
property instead of exporting the TimeAgo
class itself.
- Added
mini
style (akatwitter
style) for some locales:da
,sv
,nl
,it
,fr
,es
. By @trustpilot.
- Added additional
pt
locale styles by Victor Biasibetti.
- Changed the default
style
from"approximate"
(legacy) to"round-minute"
. This isn't a "breaking change" because no application would be "broken" by something like that, and relative time would still be shown in a similar way, only without too much approximation.
- (advanced) Renamed
getMinTimeToFrom()
togetMinTimeForUnit()
.
-
test(timestamp)
function of a step is now deprecated. UseminTime(timestamp)
function instead. -
Fixed
getTimeToNextUpdate()
. -
Renamed
"mini-time"
labels to"mini"
. -
Added styles:
"mini"
,"mini-now"
,"mini-minute"
,"mini-minute-now"
. -
Added a new
round
property (described in the readme): it can be"round"
or"floor"
. The default is"round"
. -
(Could be a breaking change for those who read
"tiny"
from JSON files directly) Removed "tiny" labels from JSON files."tiny"
labels type name still works.
- Fixed
"twitter-..."
styles.
-
Added
"twitter-minute-now"
style. -
The threshold for
"now"
->"1m"
/"1 minute ago"
is now 30 seconds rather than 40 seconds.
-
Changed
"twitter"
style: doesn't output"now"
for 0 seconds. -
Added
"twitter-now"
style that outputs"now"
for 0 seconds.
-
Added
addDefaultLocale()
static function (similar toaddLocale()
but also callssetDefaultLocale()
). -
"twitter"
style used to output"now"
for 0 seconds. Then it was changed to"0s"
. Now it has been changed to"now"
again. -
Added "CDN" section in the readme that documents using the library with
<script/>
tags (without a bundler).
-
Renamed steps'
unit
toformatAs
. The older name still works. Maybe it will be renamed to something else in some future. -
Renamed steps'
threshold
tominTime
. The older name still works but is considered deprecated. -
Renamed steps'
threshold_for_idOrUnit: value
tominTime: { id: value }
. The older way still works but is considered deprecated. MaybeminTime: {}
object will be deprecated too in some future. -
Added
test(date, { now, future })
function to steps: it can be an alternative tominTime
. See "twitter" style for an example. -
Added a third argument to steps'
format()
function: an object having shape{ formatAs(unit, value): string, future: boolean }
. -
Added
TimeAgo.addLabels(locale, name, labels)
function, that can be used to expand localized time labels. -
Added
"twitter-first-minute"
style: same as"twitter"
but doesn't output anything before the first minute. This is how"twitter"
style worked initially. -
Added
getTimeToNextUpdate
feature (see README). -
Updated
relative-time-format
to the latest version:0.1.x
->1.0.0
. -
Locale files are now
*.json
files. There's noquantify
function there now: now it's just labels.{locale}/index.js
files are still there just for legacy compatibility. -
Added the ability to use native
Intl.RelativeTimeFormat
andIntl.PluralRules
instead of the polyfills: in this case, passpolyfill: false
option when creating aTimeAgo
instance. -
The bundle is now generated by Rollup rather than Webpack.
-
Custom styles: renamed
gradation
tosteps
andflavour
tolabels
. The older names still work but are considered deprecated. -
factor
property of a "step" is now not required: if not present, it's assumed equal to theunit
in seconds (for example, the defaultfactor
is60 * 60
forunit: "hour"
).
-
Renamed
"default"
style to"round"
. The older name still works but is considered deprecated. -
Added
"round-minute"
style: same as"round"
but without seconds. -
Renamed
"time"
style to"approximate-time"
. The older name still works but is considered deprecated. -
Renamed
"canonical"
gradation to"round"
. The older name still works but is considered deprecated. -
Renamed
"tiny"
time labels style to"mini-time"
."tiny"
time labels style still works but is considered deprecated. -
(internals) Renamed
tiny.json
locale files tomini-time.json
. Removednow
unit frommini-time.json
. -
(internals)
"approximate"
(previously"convenient"
) style now useslong
labels instead oflong-convenient.json
. -
(internals) Removed
now
unit frommini-time.json
files. -
(internals) Removed
long-convenient.json
andshort-convenient.json
files:long.json
andshort.json
in combination withnow.json
are used instead.
-
(could be considered a breaking change, but it doesn't actually break any apps)
"twitter"
style now outputs something like"1s"
in case of"1 second ago"
. Previously it didn't output anything when the time difference was less than a minute. The rationale for the change is that Twitter actually does output seconds when the time difference is less than a minute. There's still a small difference from Twitter: Twitter outputs"now"
in case of"0 seconds ago"
while this library outputs"0s"
— the rationale is that "now" could be too long is different languages, and also it would look too contrasty compared to its "sibling""Xs"
time labels. -
Added
"default"
style (long
time labels +canonical
gradation). Update: it's now called"round"
instead of"default"
. -
Added
future
option on.format(value, style, options)
function: it determines, whether to use the"future"
variant of"now"
when formatting0
time difference. By default, it uses the"past"
variant of"now"
when formatting0
time difference:"just now"
instead of"in a moment"
. -
(miscellaneous) Added dedicated
"now.json"
labels for"now"
time unit.
- Added
"tiny"
time labels for"de"
locale.
-
Moved
RelativeTimeFormat
to a separaterelative-time-format
package. -
(breaking change) Removed
.locale()
static function. Use.addLocale()
instead. -
(breaking change)
flavour
property renamed in non-single-word cases: underscores (_
) got replaced with dashes (-
). Examples:short_convenient
->short-convenient
,long_convenient
->long-convenient
,short_time
->short-time
,long_time
->long-time
. The relevant keys in localeindex.js
files got renamed the same way. -
(breaking change)
RelativeTimeFormat
is no longer exported from this library. -
(could be a breaking change) Re-did
/prop-types
,/gradation
,/cache
exports as sub-packages. This could possibly change their import behavior. Maybe/prop-types
did change — I changed some export strategies for it. -
(unlikely a breaking change)
yue-Hant
locale removed (due to its removal from CLDR). -
(unlikely to be a breaking change) Removed handling for a case when "now" unit had "past"/"future" which is an object of quantifier messages instead of a string. The rationale that having "now" unit with "past"/"future" which are objects of quantifier messages wouldn't make sense because "now" is a moment and one can't differentiate between "past moment", "current moment" and "next moment" in real life.
-
Resolved cyclic dependency between
JavascriptTimeAgo.js
andRelativeTimeFormat.js
. -
JavascriptTimeAgo.default_locale
variable no longer exists (it wasn't public or documented).
-
Added
.addLocale()
alias for.locale()
function (better naming). The old.locale()
function name is now deprecated and will be removed in some next major version release. -
Added
RelativeTimeFormat.addLocale()
proxy function which simply callsJavascriptTimeAgo.addLocale()
.
- Refactored
twitter
style and styles overall: style can now havethreshold(now)
function and also gradation step can haveformat(value, locale)
function instead ofunit
.
- Renamed
override
tocustom
for styles
- Renamed
fuzzy
style totime
. - Refactored
gradation
s andstyle
s. gradation
is now not being exported fromindex.js
along withday
,month
andyear
(one can stillimport
it manually fromgradation.js
).es6
folder got renamed tomodules
build
folder got renamed tocommonjs
- Renamed
plural
toquantify
inside locale data. - Implemented
Intl.RelativeTimeFormat
proposal polyfill which is now being exported.
- (can be a breaking change for custom styles) Renamed
just-now
unit tonow
andxxx-concise
flavour toxxx_time
(+ flavour.json
files got renamed accordingly).
- (breaking change) When defining a custom
style
itsoverride()
function takesdate
andtime
parameters: nowdate
parameter ofoverride()
is not guaranteed to be set (can be inferred fromtime
).
-
(breaking change) Due to a long-standing engineering flaw in
intl-messageformat
library (the locale data loading process) I dismissed it and this library is now using raw CLDR locale data instead so built-in locale data now holds an extra property: theplural
function taking a number and returning the pluralization type of that number ("one", "few", etc). Therefore, if adding raw CLDR locale data for locales which are not built-in this pluralization function must be passed as the second argument to.locale(localeDataCLDR, pluralsClassifier)
. -
(breaking change)
javascriptTimeAgo.styles
is no more accesible: passstyle
as a string instead. -
(breaking change)
locales
folder inside the package renamed tolocale
(e.g.javascript-time-ago/locales/en
->javascript-time-ago/locale/en
). -
style.flavour
can now be an array
- Changed
yesterday
andtomorrow
labels for Russian localization
- Moved
intl-messageformat
topeerDependencies
- Initial release