Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

angular-timeago

Package Overview
Dependencies
Maintainers
1
Versions
26
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

angular-timeago - npm Package Compare versions

Comparing version 0.2.2 to 0.2.3

6

demo/angular-timeago.js
/**
* Angular directive/filter/service for formatting date so that it displays how long ago the given time was compared to now.
* @version v0.2.2 - 2015-08-25
* @version v0.2.3 - 2015-08-26
* @link https://github.com/yaru22/angular-timeago

@@ -97,5 +97,5 @@ * @author Brian Park <yaru22@gmail.com>

prefixAgo: 'vor',
prefixFromNow: null,
prefixFromNow: 'in',
suffixAgo: null,
suffixFromNow: 'from now',
suffixFromNow: null,
seconds: 'weniger als einer Minute',

@@ -102,0 +102,0 @@ minute: 'ca. einer Minute',

/**
* Angular directive/filter/service for formatting date so that it displays how long ago the given time was compared to now.
* @version v0.2.2 - 2015-08-25
* @version v0.2.3 - 2015-08-26
* @link https://github.com/yaru22/angular-timeago

@@ -97,5 +97,5 @@ * @author Brian Park <yaru22@gmail.com>

prefixAgo: 'vor',
prefixFromNow: null,
prefixFromNow: 'in',
suffixAgo: null,
suffixFromNow: 'from now',
suffixFromNow: null,
seconds: 'weniger als einer Minute',

@@ -102,0 +102,0 @@ minute: 'ca. einer Minute',

/**
* Angular directive/filter/service for formatting date so that it displays how long ago the given time was compared to now.
* @version v0.2.2 - 2015-08-25
* @version v0.2.3 - 2015-08-26
* @link https://github.com/yaru22/angular-timeago

@@ -8,2 +8,2 @@ * @author Brian Park <yaru22@gmail.com>

*/
"use strict";angular.module("yaru22.angular-timeago",[]).directive("timeAgo",["timeAgo","nowTime",function(a,b){return{scope:{fromTime:"@",format:"@"},restrict:"EA",link:function(c,d){var e=a.parse(c.fromTime);c.$watch(function(){return b()-e},function(b){angular.element(d).text(a.inWords(b,e,c.format))})}}}]).factory("nowTime",["$window","$rootScope",function(a,b){var c=Date.now(),d=function(){a.setTimeout(function(){b.$apply(function(){c=Date.now(),d()})},1e3)};return d(),function(){return c}}]).factory("timeAgo",["$filter",function(a){var b={};return b.settings={refreshMillis:6e4,allowFuture:!1,overrideLang:null,fullDateAfterSeconds:null,strings:{it_IT:{prefixAgo:null,prefixFromNow:null,suffixAgo:"fa",suffixFromNow:"da ora",seconds:"meno di un minuto",minute:"circa un minuto",minutes:"%d minuti",hour:"circa un' ora",hours:"circa %d ore",day:"un giorno",days:"%d giorni",month:"circa un mese",months:"%d mesi",year:"circa un anno",years:"%d anni",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:[]},de_DE:{prefixAgo:"vor",prefixFromNow:null,suffixAgo:null,suffixFromNow:"from now",seconds:"weniger als einer Minute",minute:"ca. einer Minute",minutes:"%d Minuten",hour:"ca. einer Stunde",hours:"ca. %d Stunden",day:"einem Tag",days:"%d Tagen",month:"ca. einem Monat",months:"%d Monaten",year:"ca. einem Jahr",years:"%d Jahren",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:[]},pt_BR:{prefixAgo:null,prefixFromNow:"daqui a",suffixAgo:"atrás",suffixFromNow:null,seconds:"menos de um minuto",minute:"cerca de um minuto",minutes:"%d minutos",hour:"cerca de uma hora",hours:"cerca de %d horas",day:"um dia",days:"%d dias",month:"cerca de um mês",months:"%d meses",year:"cerca de um ano",years:"%d anos",numbers:[]},fr_FR:{prefixAgo:"il y a",prefixFromNow:null,suffixAgo:null,suffixFromNow:"from now",seconds:"moins d'une minute",minute:"environ une minute",minutes:"%d minutes",hour:"environ une heure",hours:"environ %d heures",day:"un jour",days:"%d jours",month:"environ un mois",months:"%d mois",year:"environ un an",years:"%d ans",numbers:[]},es_LA:{prefixAgo:"hace",prefixFromNow:null,suffixAgo:null,suffixFromNow:"apartir de ahora",seconds:"menos de un minuto",minute:"un minuto",minutes:"%d minutos",hour:"una hora",hours:"%d horas",day:"un dia",days:"%d dias",month:"un mes",months:"%d meses",year:"un año",years:"%d años",numbers:[]},nl_NL:{prefixAgo:null,prefixFromNow:"over",suffixAgo:"geleden",suffixFromNow:"vanaf nu",seconds:"een paar seconden",minute:"ongeveer een minuut",minutes:"%d minuten",hour:"een uur",hours:"%d uur",day:"een dag",days:"%d dagen",month:"een maand",months:"%d maanden",year:"een jaar",years:"%d jaar",numbers:[]}}},b.inWords=function(c,d,e,f){function g(a,b){var d=angular.isFunction(a)?a(b,c):a,e=k.numbers&&k.numbers[b]||b;return d.replace(/%d/i,e)}var h=parseInt(b.settings.fullDateAfterSeconds,10);if(!isNaN(h)){var i=1e3*h;if(c>=0&&c>=i||0>c&&i>=c)return e?a("date")(d,e,f):d}var j,k,l=b.settings.overrideLang,m=document.documentElement.lang,n=b.settings.strings;"undefined"!=typeof n[l]?(j=l,k=n[l]):"undefined"!=typeof n[m]?(j=m,k=n[m]):(j="en_US",k=n[j]);var o=k.prefixAgo,p=k.suffixAgo;b.settings.allowFuture&&0>c&&(o=k.prefixFromNow,p=k.suffixFromNow);var q=Math.abs(c)/1e3,r=q/60,s=r/60,t=s/24,u=t/365,v=45>q&&g(k.seconds,Math.round(q))||90>q&&g(k.minute,1)||45>r&&g(k.minutes,Math.round(r))||90>r&&g(k.hour,1)||24>s&&g(k.hours,Math.round(s))||42>s&&g(k.day,1)||30>t&&g(k.days,Math.round(t))||45>t&&g(k.month,1)||365>t&&g(k.months,Math.round(t/30))||1.5>u&&g(k.year,1)||g(k.years,Math.round(u)),w=void 0===k.wordSeparator?" ":k.wordSeparator;return"he_IL"===j?[o,p,v].join(w).trim():[o,v,p].join(w).trim()},b.parse=function(a){if(a instanceof Date)return a;if(angular.isNumber(a))return new Date(a);if(/^\d+$/.test(a))return new Date(parseInt(a,10));var b=(a||"").trim();return b=b.replace(/\.\d+/,""),b=b.replace(/-/,"/").replace(/-/,"/"),b=b.replace(/T/," ").replace(/Z/," UTC"),b=b.replace(/([\+\-]\d\d)\:?(\d\d)/," $1$2"),new Date(b)},b}]).filter("timeAgo",["nowTime","timeAgo",function(a,b){return function(c,d,e){var f=b.parse(c),g=a()-f;return b.inWords(g,f,d,e)}}]);
"use strict";angular.module("yaru22.angular-timeago",[]).directive("timeAgo",["timeAgo","nowTime",function(a,b){return{scope:{fromTime:"@",format:"@"},restrict:"EA",link:function(c,d){var e=a.parse(c.fromTime);c.$watch(function(){return b()-e},function(b){angular.element(d).text(a.inWords(b,e,c.format))})}}}]).factory("nowTime",["$window","$rootScope",function(a,b){var c=Date.now(),d=function(){a.setTimeout(function(){b.$apply(function(){c=Date.now(),d()})},1e3)};return d(),function(){return c}}]).factory("timeAgo",["$filter",function(a){var b={};return b.settings={refreshMillis:6e4,allowFuture:!1,overrideLang:null,fullDateAfterSeconds:null,strings:{it_IT:{prefixAgo:null,prefixFromNow:null,suffixAgo:"fa",suffixFromNow:"da ora",seconds:"meno di un minuto",minute:"circa un minuto",minutes:"%d minuti",hour:"circa un' ora",hours:"circa %d ore",day:"un giorno",days:"%d giorni",month:"circa un mese",months:"%d mesi",year:"circa un anno",years:"%d anni",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:[]},de_DE:{prefixAgo:"vor",prefixFromNow:"in",suffixAgo:null,suffixFromNow:null,seconds:"weniger als einer Minute",minute:"ca. einer Minute",minutes:"%d Minuten",hour:"ca. einer Stunde",hours:"ca. %d Stunden",day:"einem Tag",days:"%d Tagen",month:"ca. einem Monat",months:"%d Monaten",year:"ca. einem Jahr",years:"%d Jahren",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:[]},pt_BR:{prefixAgo:null,prefixFromNow:"daqui a",suffixAgo:"atrás",suffixFromNow:null,seconds:"menos de um minuto",minute:"cerca de um minuto",minutes:"%d minutos",hour:"cerca de uma hora",hours:"cerca de %d horas",day:"um dia",days:"%d dias",month:"cerca de um mês",months:"%d meses",year:"cerca de um ano",years:"%d anos",numbers:[]},fr_FR:{prefixAgo:"il y a",prefixFromNow:null,suffixAgo:null,suffixFromNow:"from now",seconds:"moins d'une minute",minute:"environ une minute",minutes:"%d minutes",hour:"environ une heure",hours:"environ %d heures",day:"un jour",days:"%d jours",month:"environ un mois",months:"%d mois",year:"environ un an",years:"%d ans",numbers:[]},es_LA:{prefixAgo:"hace",prefixFromNow:null,suffixAgo:null,suffixFromNow:"apartir de ahora",seconds:"menos de un minuto",minute:"un minuto",minutes:"%d minutos",hour:"una hora",hours:"%d horas",day:"un dia",days:"%d dias",month:"un mes",months:"%d meses",year:"un año",years:"%d años",numbers:[]},nl_NL:{prefixAgo:null,prefixFromNow:"over",suffixAgo:"geleden",suffixFromNow:"vanaf nu",seconds:"een paar seconden",minute:"ongeveer een minuut",minutes:"%d minuten",hour:"een uur",hours:"%d uur",day:"een dag",days:"%d dagen",month:"een maand",months:"%d maanden",year:"een jaar",years:"%d jaar",numbers:[]}}},b.inWords=function(c,d,e,f){function g(a,b){var d=angular.isFunction(a)?a(b,c):a,e=k.numbers&&k.numbers[b]||b;return d.replace(/%d/i,e)}var h=parseInt(b.settings.fullDateAfterSeconds,10);if(!isNaN(h)){var i=1e3*h;if(c>=0&&c>=i||0>c&&i>=c)return e?a("date")(d,e,f):d}var j,k,l=b.settings.overrideLang,m=document.documentElement.lang,n=b.settings.strings;"undefined"!=typeof n[l]?(j=l,k=n[l]):"undefined"!=typeof n[m]?(j=m,k=n[m]):(j="en_US",k=n[j]);var o=k.prefixAgo,p=k.suffixAgo;b.settings.allowFuture&&0>c&&(o=k.prefixFromNow,p=k.suffixFromNow);var q=Math.abs(c)/1e3,r=q/60,s=r/60,t=s/24,u=t/365,v=45>q&&g(k.seconds,Math.round(q))||90>q&&g(k.minute,1)||45>r&&g(k.minutes,Math.round(r))||90>r&&g(k.hour,1)||24>s&&g(k.hours,Math.round(s))||42>s&&g(k.day,1)||30>t&&g(k.days,Math.round(t))||45>t&&g(k.month,1)||365>t&&g(k.months,Math.round(t/30))||1.5>u&&g(k.year,1)||g(k.years,Math.round(u)),w=void 0===k.wordSeparator?" ":k.wordSeparator;return"he_IL"===j?[o,p,v].join(w).trim():[o,v,p].join(w).trim()},b.parse=function(a){if(a instanceof Date)return a;if(angular.isNumber(a))return new Date(a);if(/^\d+$/.test(a))return new Date(parseInt(a,10));var b=(a||"").trim();return b=b.replace(/\.\d+/,""),b=b.replace(/-/,"/").replace(/-/,"/"),b=b.replace(/T/," ").replace(/Z/," UTC"),b=b.replace(/([\+\-]\d\d)\:?(\d\d)/," $1$2"),new Date(b)},b}]).filter("timeAgo",["nowTime","timeAgo",function(a,b){return function(c,d,e){var f=b.parse(c),g=a()-f;return b.inWords(g,f,d,e)}}]);

@@ -8,3 +8,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.2.2",
"version": "0.2.3",
"license": "MIT",

@@ -11,0 +11,0 @@ "homepage": "https://github.com/yaru22/angular-timeago",

@@ -85,5 +85,5 @@ /* global angular */

prefixAgo: 'vor',
prefixFromNow: null,
prefixFromNow: 'in',
suffixAgo: null,
suffixFromNow: 'from now',
suffixFromNow: null,
seconds: 'weniger als einer Minute',

@@ -90,0 +90,0 @@ minute: 'ca. einer Minute',

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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