Socket
Socket
Sign inDemoInstall

javascript-time-ago

Package Overview
Dependencies
Maintainers
1
Versions
120
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

javascript-time-ago - npm Package Compare versions

Comparing version 0.1.1 to 0.2.0

5

HISTORY.md

@@ -0,1 +1,6 @@

0.2.0 / 13.04.2016
===================
* Moved `intl-messageformat` to `peerDependencies`
0.1.0 / 03.04.2016

@@ -2,0 +7,0 @@ ===================

7

package.json
{
"name": "javascript-time-ago",
"version": "0.1.1",
"version": "0.2.0",
"description": "International highly customizable relative time formatting",
"main": "build/index.js",
"jsnext:main": "source/index.js",
"dependencies": {
"intl-messageformat": "^1.3.0"
},
"peerDependencies": {},
"devDependencies": {

@@ -31,3 +29,2 @@ "babel-cli": "^6.6.5",

},
"peerDependencies": {},
"scripts": {

@@ -34,0 +31,0 @@ "test": "mocha --compilers js:babel-core/register --colors --bail --reporter spec test/runner.js --recursive",

@@ -35,2 +35,3 @@ # javascript-time-ago

```
npm install intl-messageformat --save
npm install javascript-time-ago --save

@@ -60,5 +61,5 @@ ```

//
global.IntlMessageFormat = require('javascript-time-ago/node_modules/intl-messageformat')
require('javascript-time-ago/node_modules/intl-messageformat/dist/locale-data/en')
require('javascript-time-ago/node_modules/intl-messageformat/dist/locale-data/ru')
global.IntlMessageFormat = require('intl-messageformat')
require('intl-messageformat/dist/locale-data/en')
require('intl-messageformat/dist/locale-data/ru')
delete global.IntlMessageFormat

@@ -138,3 +139,3 @@

Same as the default style but with "ago" omitted:
The time scale is (actually same as the default style but with "ago" omitted):

@@ -249,7 +250,13 @@ * just now

To add support for a specific language one can download the corresponding JSON file from [CLDR dates repository](https://github.com/unicode-cldr/cldr-dates-full/blob/master/main) and add the data from that file to the library:
To add support for a specific language one can download the [CLDR dates package](https://github.com/unicode-cldr/cldr-dates-full/blob/master/main):
```
npm install cldr-dates-modern --save
```
And then add the neccessary locales from it:
```js
import javascript_time_ago from 'javascript-time-ago'
import russian from './CLDR/cldr-dates-full/main/ru/dateFields.json'
import russian from 'cldr-dates-modern/main/ru/dateFields.json'

@@ -310,2 +317,3 @@ javascript_time_ago.locale('ru', russian.main.ru.dates.fields)

* (some more `threshold` customization is possible, see the link below)
* `granularity` can also be specified (for example, `5` for `minute` to allow only 5-minute intervals)

@@ -312,0 +320,0 @@ For more gradation examples see [`source/classify elapsed.js`](https://github.com/halt-hammerzeit/javascript-time-ago/blob/master/source/classify%20elapsed.js)

@@ -19,5 +19,5 @@ // import chai from 'chai'

//
global.IntlMessageFormat = require('../node_modules/intl-messageformat')
require('../node_modules/intl-messageformat/dist/locale-data/en')
require('../node_modules/intl-messageformat/dist/locale-data/ru')
global.IntlMessageFormat = require('intl-messageformat')
require('intl-messageformat/dist/locale-data/en')
require('intl-messageformat/dist/locale-data/ru')
delete global.IntlMessageFormat

@@ -24,0 +24,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc