angular-timeago
Advanced tools
Comparing version 0.1.2 to 0.1.3
{ | ||
"author": { | ||
"name": "Brian Park", | ||
"email": "yaru22@gmail.com" | ||
"email": "yaru22@gmail.com", | ||
"name": "Brian Park" | ||
}, | ||
"name": "angular-timeago", | ||
"dependencies": { | ||
"angular": "~1.2.10", | ||
"angular-mocks": "~1.2.10" | ||
}, | ||
"description": "Angular directive/filter/service for formatting date so that it displays how long ago the given time was compared to now.", | ||
"version": "0.1.2", | ||
"license": "MIT", | ||
"devDependencies": { | ||
"chai": "1.9.0", | ||
"jquery": "2.1.0" | ||
}, | ||
"homepage": "https://github.com/yaru22/angular-timeago", | ||
"repository": { | ||
"type": "git", | ||
"url": "git://github.com/yaru22/angular-timeago.git" | ||
}, | ||
"ignore": [ | ||
@@ -22,10 +20,10 @@ "demo", | ||
], | ||
"dependencies": { | ||
"angular": "~1.2.10", | ||
"angular-mocks": "~1.2.10" | ||
"license": "MIT", | ||
"main": "src/timeAgo.js", | ||
"name": "angular-timeago", | ||
"repository": { | ||
"type": "git", | ||
"url": "git://github.com/yaru22/angular-timeago.git" | ||
}, | ||
"devDependencies": { | ||
"chai": "1.9.0", | ||
"jquery": "2.1.0" | ||
} | ||
"version": "0.1.3" | ||
} |
@@ -9,3 +9,3 @@ { | ||
"description": "Angular directive/filter/service for formatting date so that it displays how long ago the given time was compared to now.", | ||
"version": "0.1.2", | ||
"version": "0.1.3", | ||
"license": "MIT", | ||
@@ -12,0 +12,0 @@ |
@@ -5,3 +5,3 @@ # angular-timeago [](https://github.com/yaru22/angular-timeago) | ||
## Disclaimer | ||
This project is based off of [a thread](https://groups.google.com/forum/#!topic/angular/o7vl4tsg53w) on Angular Google Groups. The person who started the thread, @lrlopez, gave me permission to start a repo using the code he wrote initially. Thanks to @lrlopez and other contributors in the thread. | ||
This project is based off of [a thread](https://groups.google.com/forum/#!topic/angular/o7vl4tsg53w) on Angular Google Groups. The person who started the thread, [@lrlopez](https://github.com/lrlopez), gave me permission to start a repo using the code he wrote initially. Thanks to [@lrlopez](https://github.com/lrlopez) and other contributors in the thread. | ||
@@ -8,0 +8,0 @@ ## Demo |
@@ -44,18 +44,38 @@ /* global angular */ | ||
strings: { | ||
prefixAgo: null, | ||
prefixFromNow: null, | ||
suffixAgo: 'ago', | ||
suffixFromNow: 'from now', | ||
seconds: 'less than a minute', | ||
minute: 'about a minute', | ||
minutes: '%d minutes', | ||
hour: 'about an hour', | ||
hours: 'about %d hours', | ||
day: 'a day', | ||
days: '%d days', | ||
month: 'about a month', | ||
months: '%d months', | ||
year: 'about a year', | ||
years: '%d years', | ||
numbers: [] | ||
'en_US': { | ||
prefixAgo: null, | ||
prefixFromNow: null, | ||
suffixAgo: 'ago', | ||
suffixFromNow: 'from now', | ||
seconds: 'less than a minute', | ||
minute: 'about a minute', | ||
minutes: '%d minutes', | ||
hour: 'about an hour', | ||
hours: 'about %d hours', | ||
day: 'a day', | ||
days: '%d days', | ||
month: 'about a month', | ||
months: '%d months', | ||
year: 'about a year', | ||
years: '%d years', | ||
numbers: [] | ||
}, | ||
'he_IL': { | ||
prefixAgo: null, | ||
prefixFromNow: null, | ||
suffixAgo: 'לפני', | ||
suffixFromNow: 'מעכשיו', | ||
seconds: 'פחות מדקה', | ||
minute: 'כדקה', | ||
minutes: '%d דקות', | ||
hour: 'כשעה', | ||
hours: 'כ %d שעות', | ||
day: 'יום', | ||
days: '%d ימים', | ||
month: 'כחודש', | ||
months: '%d חודשים', | ||
year: 'כשנה', | ||
years: '%d שנים', | ||
numbers: [] | ||
}, | ||
} | ||
@@ -65,3 +85,7 @@ }; | ||
service.inWords = function (distanceMillis) { | ||
var $l = service.settings.strings; | ||
var lang = document.documentElement.lang; | ||
var $l = service.settings.strings[lang]; | ||
if (typeof $l === 'undefined') { | ||
$l = service.settings.strings['en_US']; | ||
} | ||
var prefix = $l.prefixAgo; | ||
@@ -68,0 +92,0 @@ var suffix = $l.suffixAgo; |
@@ -1,2 +0,2 @@ | ||
/* globals angular, beforeEach, chai, describe, inject, it */ | ||
/* jshint ignore:start */ | ||
'use strict'; | ||
@@ -6,3 +6,3 @@ | ||
describe('blink', function () { | ||
describe('timeAgo', function () { | ||
var elm, scope; | ||
@@ -14,17 +14,3 @@ | ||
beforeEach(inject(function ($rootScope, $compile) { | ||
// we might move this tpl into an html file as well... | ||
elm = angular.element('<blink>Hello world</blink>'); | ||
scope = $rootScope; | ||
$compile(elm)(scope); | ||
scope.$digest(); | ||
})); | ||
it('should create a marquee element', inject(function() { | ||
var marquee = elm.find('marquee'); | ||
expect(marquee).to.have.length(1); | ||
expect(marquee.eq(0).text()).to.equal('Hello world'); | ||
})); | ||
}); |
Sorry, the diff of this file is not supported yet
749077
19287