javascript-time-ago
Advanced tools
Comparing version 2.0.9 to 2.0.10
@@ -0,1 +1,6 @@ | ||
2.0.10 / 16.07.2020 | ||
================== | ||
* Added `"tiny"` time labels for `"de"` locale. | ||
2.0.0 / 14.01.2018 | ||
@@ -2,0 +7,0 @@ ================== |
@@ -17,4 +17,4 @@ "use strict"; | ||
it('should fallback from "tiny" to "narrow" for Twitter style for autogenerated locales', function () { | ||
var timeAgo = new _JavascriptTimeAgo.default('de'); | ||
timeAgo.format(Date.now() - 3 * 60 * 60 * 1000, 'twitter').should.equal('vor 3 Std.'); | ||
var timeAgo = new _JavascriptTimeAgo.default('fr'); | ||
timeAgo.format(Date.now() - 3 * 60 * 60 * 1000, 'twitter').should.equal('-3 h'); | ||
}); | ||
@@ -85,6 +85,22 @@ it('should format Twitter style relative time (English)', function () { | ||
elapsed(59.51).should.equal('1분'); | ||
elapsed(59.51 * 60).should.equal('1시간'); // elapsed(day + 62 * 60).should.equal('9 апр.') | ||
// elapsed(year).should.equal('11 апр. 2015 г.') | ||
elapsed(59.51 * 60).should.equal('1시간'); | ||
elapsed(_gradation.day + 62 * 60).should.equal('4월 9일'); | ||
elapsed(_gradation.year).should.equal('2015년 4월 11일'); | ||
}); | ||
it('should format Twitter style relative time (German)', function () { | ||
var timeAgo = new _JavascriptTimeAgo.default('de'); | ||
var now = new Date(2016, 3, 10, 22, 59).getTime(); | ||
var elapsed = function elapsed(time) { | ||
return timeAgo.format(now - time * 1000, _objectSpread({ | ||
now: now | ||
}, _twitter.default)); | ||
}; | ||
elapsed(59.51).should.equal('1 Min.'); | ||
elapsed(59.51 * 60).should.equal('1 Std.'); | ||
elapsed(_gradation.day + 62 * 60).should.equal('9. Apr.'); | ||
elapsed(_gradation.year).should.equal('11. Apr. 2015'); | ||
}); | ||
}); | ||
//# sourceMappingURL=twitter.test.js.map |
@@ -12,4 +12,5 @@ var locale = require('relative-time-format/locale/de') | ||
'long-convenient': require('../../locale-more-styles/de/long-convenient.json'), | ||
'tiny': require('../../locale-more-styles/de/tiny.json'), | ||
// Quantifier. | ||
quantify: locale.quantify | ||
} |
@@ -10,4 +10,4 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; var ownKeys = Object.keys(source); if (typeof Object.getOwnPropertySymbols === 'function') { ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) { return Object.getOwnPropertyDescriptor(source, sym).enumerable; })); } ownKeys.forEach(function (key) { _defineProperty(target, key, source[key]); }); } return target; } | ||
it('should fallback from "tiny" to "narrow" for Twitter style for autogenerated locales', function () { | ||
var timeAgo = new JavascriptTimeAgo('de'); | ||
timeAgo.format(Date.now() - 3 * 60 * 60 * 1000, 'twitter').should.equal('vor 3 Std.'); | ||
var timeAgo = new JavascriptTimeAgo('fr'); | ||
timeAgo.format(Date.now() - 3 * 60 * 60 * 1000, 'twitter').should.equal('-3 h'); | ||
}); | ||
@@ -78,6 +78,22 @@ it('should format Twitter style relative time (English)', function () { | ||
elapsed(59.51).should.equal('1분'); | ||
elapsed(59.51 * 60).should.equal('1시간'); // elapsed(day + 62 * 60).should.equal('9 апр.') | ||
// elapsed(year).should.equal('11 апр. 2015 г.') | ||
elapsed(59.51 * 60).should.equal('1시간'); | ||
elapsed(day + 62 * 60).should.equal('4월 9일'); | ||
elapsed(year).should.equal('2015년 4월 11일'); | ||
}); | ||
it('should format Twitter style relative time (German)', function () { | ||
var timeAgo = new JavascriptTimeAgo('de'); | ||
var now = new Date(2016, 3, 10, 22, 59).getTime(); | ||
var elapsed = function elapsed(time) { | ||
return timeAgo.format(now - time * 1000, _objectSpread({ | ||
now: now | ||
}, twitterStyle)); | ||
}; | ||
elapsed(59.51).should.equal('1 Min.'); | ||
elapsed(59.51 * 60).should.equal('1 Std.'); | ||
elapsed(day + 62 * 60).should.equal('9. Apr.'); | ||
elapsed(year).should.equal('11. Apr. 2015'); | ||
}); | ||
}); | ||
//# sourceMappingURL=twitter.test.js.map |
{ | ||
"name": "javascript-time-ago", | ||
"version": "2.0.9", | ||
"version": "2.0.10", | ||
"description": "International highly customizable relative date/time formatting", | ||
@@ -5,0 +5,0 @@ "main": "index.commonjs.js", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
535998
270
5397