Socket
Socket
Sign inDemoInstall

vue-timeago3

Package Overview
Dependencies
Maintainers
1
Versions
18
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

vue-timeago3 - npm Package Compare versions

Comparing version 2.2.1 to 2.3.0

18

dist/vue-timeago.es.js

@@ -946,19 +946,17 @@ import { defineComponent, ref, onBeforeMount, onBeforeUnmount, watch, h } from "vue";

var defaultConverter = (date, converterOptions = {}, locale2) => {
var _a, _b;
if (typeof date === "string") {
date = parseISO(date);
}
const {
includeSeconds,
addSuffix = true,
useStrict = false
} = converterOptions;
if (useStrict) {
if (converterOptions.useStrict) {
return formatDistanceToNowStrict(date, {
addSuffix,
locale: locale2
addSuffix: (_a = converterOptions.addSuffix) != null ? _a : true,
locale: locale2,
unit: converterOptions.unit,
roundingMethod: converterOptions.roundingMethod
});
}
return formatDistanceToNow(date, {
includeSeconds,
addSuffix,
includeSeconds: converterOptions.includeSeconds,
addSuffix: (_b = converterOptions.addSuffix) != null ? _b : true,
locale: locale2

@@ -965,0 +963,0 @@ });

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

(function(g,v){typeof exports=="object"&&typeof module!="undefined"?v(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],v):(g=typeof globalThis!="undefined"?globalThis:g||self,v(g.VueTimeago3={},g.Vue))})(this,function(g,v){"use strict";function X(e){if(e===null||e===!0||e===!1)return NaN;var t=Number(e);return isNaN(t)?t:t<0?Math.ceil(t):Math.floor(t)}function h(e,t){if(t.length<e)throw new TypeError(e+" argument"+(e>1?"s":"")+" required, but only "+t.length+" present")}function d(e){h(1,arguments);var t=Object.prototype.toString.call(e);return e instanceof Date||typeof e=="object"&&t==="[object Date]"?new Date(e.getTime()):typeof e=="number"||t==="[object Number]"?new Date(e):((typeof e=="string"||t==="[object String]")&&typeof console!="undefined"&&(console.warn("Starting with v2.0.0-beta.1 date-fns doesn't accept strings as date arguments. Please use `parseISO` to parse strings. See: https://git.io/fjule"),console.warn(new Error().stack)),new Date(NaN))}function T(e){var t=new Date(Date.UTC(e.getFullYear(),e.getMonth(),e.getDate(),e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds()));return t.setUTCFullYear(e.getFullYear()),e.getTime()-t.getTime()}function M(e,t){h(2,arguments);var n=d(e),a=d(t),i=n.getTime()-a.getTime();return i<0?-1:i>0?1:i}var C=6e4,U=36e5;function q(e,t){h(2,arguments);var n=d(e),a=d(t),i=n.getFullYear()-a.getFullYear(),r=n.getMonth()-a.getMonth();return i*12+r}function L(e,t){return h(2,arguments),d(e).getTime()-d(t).getTime()}var F={ceil:Math.ceil,round:Math.round,floor:Math.floor,trunc:function(e){return e<0?Math.ceil(e):Math.floor(e)}},H="trunc";function V(e){return e?F[e]:F[H]}function $(e){h(1,arguments);var t=d(e);return t.setHours(23,59,59,999),t}function J(e){h(1,arguments);var t=d(e),n=t.getMonth();return t.setFullYear(t.getFullYear(),n+1,0),t.setHours(23,59,59,999),t}function Q(e){h(1,arguments);var t=d(e);return $(t).getTime()===J(t).getTime()}function Z(e,t){h(2,arguments);var n=d(e),a=d(t),i=M(n,a),r=Math.abs(q(n,a)),o;if(r<1)o=0;else{n.getMonth()===1&&n.getDate()>27&&n.setDate(30),n.setMonth(n.getMonth()-i*r);var l=M(n,a)===-i;Q(d(e))&&r===1&&M(e,a)===1&&(l=!1),o=i*(r-Number(l))}return o===0?0:o}function B(e,t,n){h(2,arguments);var a=L(e,t)/1e3;return V(n==null?void 0:n.roundingMethod)(a)}var K={lessThanXSeconds:{one:"less than a second",other:"less than {{count}} seconds"},xSeconds:{one:"1 second",other:"{{count}} seconds"},halfAMinute:"half a minute",lessThanXMinutes:{one:"less than a minute",other:"less than {{count}} minutes"},xMinutes:{one:"1 minute",other:"{{count}} minutes"},aboutXHours:{one:"about 1 hour",other:"about {{count}} hours"},xHours:{one:"1 hour",other:"{{count}} hours"},xDays:{one:"1 day",other:"{{count}} days"},aboutXWeeks:{one:"about 1 week",other:"about {{count}} weeks"},xWeeks:{one:"1 week",other:"{{count}} weeks"},aboutXMonths:{one:"about 1 month",other:"about {{count}} months"},xMonths:{one:"1 month",other:"{{count}} months"},aboutXYears:{one:"about 1 year",other:"about {{count}} years"},xYears:{one:"1 year",other:"{{count}} years"},overXYears:{one:"over 1 year",other:"over {{count}} years"},almostXYears:{one:"almost 1 year",other:"almost {{count}} years"}},G=function(e,t,n){var a,i=K[e];return typeof i=="string"?a=i:t===1?a=i.one:a=i.other.replace("{{count}}",t.toString()),n!=null&&n.addSuffix?n.comparison&&n.comparison>0?"in "+a:a+" ago":a},ee=G;function I(e){return function(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},n=t.width?String(t.width):e.defaultWidth,a=e.formats[n]||e.formats[e.defaultWidth];return a}}var te={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},ne={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},ae={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},re={date:I({formats:te,defaultWidth:"full"}),time:I({formats:ne,defaultWidth:"full"}),dateTime:I({formats:ae,defaultWidth:"full"})},ie=re,oe={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},ue=function(e,t,n,a){return oe[e]},se=ue;function w(e){return function(t,n){var a=n||{},i=a.context?String(a.context):"standalone",r;if(i==="formatting"&&e.formattingValues){var o=e.defaultFormattingWidth||e.defaultWidth,l=a.width?String(a.width):o;r=e.formattingValues[l]||e.formattingValues[o]}else{var f=e.defaultWidth,u=a.width?String(a.width):e.defaultWidth;r=e.values[u]||e.values[f]}var s=e.argumentCallback?e.argumentCallback(t):t;return r[s]}}var le={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},fe={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},de={narrow:["J","F","M","A","M","J","J","A","S","O","N","D"],abbreviated:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],wide:["January","February","March","April","May","June","July","August","September","October","November","December"]},me={narrow:["S","M","T","W","T","F","S"],short:["Su","Mo","Tu","We","Th","Fr","Sa"],abbreviated:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],wide:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},ce={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"}},he={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"}},ve=function(e,t){var n=Number(e),a=n%100;if(a>20||a<10)switch(a%10){case 1:return n+"st";case 2:return n+"nd";case 3:return n+"rd"}return n+"th"},ge={ordinalNumber:ve,era:w({values:le,defaultWidth:"wide"}),quarter:w({values:fe,defaultWidth:"wide",argumentCallback:function(e){return e-1}}),month:w({values:de,defaultWidth:"wide"}),day:w({values:me,defaultWidth:"wide"}),dayPeriod:w({values:ce,defaultWidth:"wide",formattingValues:he,defaultFormattingWidth:"wide"})},pe=ge;function b(e){return function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},a=n.width,i=a&&e.matchPatterns[a]||e.matchPatterns[e.defaultMatchWidth],r=t.match(i);if(!r)return null;var o=r[0],l=a&&e.parsePatterns[a]||e.parsePatterns[e.defaultParseWidth],f=Array.isArray(l)?we(l,function(m){return m.test(o)}):Me(l,function(m){return m.test(o)}),u;u=e.valueCallback?e.valueCallback(f):f,u=n.valueCallback?n.valueCallback(u):u;var s=t.slice(o.length);return{value:u,rest:s}}}function Me(e,t){for(var n in e)if(e.hasOwnProperty(n)&&t(e[n]))return n}function we(e,t){for(var n=0;n<e.length;n++)if(t(e[n]))return n}function be(e){return function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},a=t.match(e.matchPattern);if(!a)return null;var i=a[0],r=t.match(e.parsePattern);if(!r)return null;var o=e.valueCallback?e.valueCallback(r[0]):r[0];o=n.valueCallback?n.valueCallback(o):o;var l=t.slice(i.length);return{value:o,rest:l}}}var De=/^(\d+)(th|st|nd|rd)?/i,ye=/\d+/i,Te={narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},Ne={any:[/^b/i,/^(a|c)/i]},Se={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},Pe={any:[/1/i,/2/i,/3/i,/4/i]},Ie={narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},We={narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},xe={narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},Oe={narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},Ce={narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},Ue={any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},Fe={ordinalNumber:be({matchPattern:De,parsePattern:ye,valueCallback:function(e){return parseInt(e,10)}}),era:b({matchPatterns:Te,defaultMatchWidth:"wide",parsePatterns:Ne,defaultParseWidth:"any"}),quarter:b({matchPatterns:Se,defaultMatchWidth:"wide",parsePatterns:Pe,defaultParseWidth:"any",valueCallback:function(e){return e+1}}),month:b({matchPatterns:Ie,defaultMatchWidth:"wide",parsePatterns:We,defaultParseWidth:"any"}),day:b({matchPatterns:xe,defaultMatchWidth:"wide",parsePatterns:Oe,defaultParseWidth:"any"}),dayPeriod:b({matchPatterns:Ce,defaultMatchWidth:"any",parsePatterns:Ue,defaultParseWidth:"any"})},Ee=Fe,_e={code:"en-US",formatDistance:ee,formatLong:ie,formatRelative:se,localize:pe,match:Ee,options:{weekStartsOn:0,firstWeekContainsDate:1}},E=_e;function Ye(e,t){if(e==null)throw new TypeError("assign requires that input parameter not be null or undefined");t=t||{};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e}function _(e){return Ye({},e)}var Y=1440,Re=2520,W=43200,ke=86400;function Ae(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};h(2,arguments);var a=n.locale||E;if(!a.formatDistance)throw new RangeError("locale must contain formatDistance property");var i=M(e,t);if(isNaN(i))throw new RangeError("Invalid time value");var r=_(n);r.addSuffix=Boolean(n.addSuffix),r.comparison=i;var o,l;i>0?(o=d(t),l=d(e)):(o=d(e),l=d(t));var f=B(l,o),u=(T(l)-T(o))/1e3,s=Math.round((f-u)/60),m;if(s<2)return n.includeSeconds?f<5?a.formatDistance("lessThanXSeconds",5,r):f<10?a.formatDistance("lessThanXSeconds",10,r):f<20?a.formatDistance("lessThanXSeconds",20,r):f<40?a.formatDistance("halfAMinute",null,r):f<60?a.formatDistance("lessThanXMinutes",1,r):a.formatDistance("xMinutes",1,r):s===0?a.formatDistance("lessThanXMinutes",1,r):a.formatDistance("xMinutes",s,r);if(s<45)return a.formatDistance("xMinutes",s,r);if(s<90)return a.formatDistance("aboutXHours",1,r);if(s<Y){var O=Math.round(s/60);return a.formatDistance("aboutXHours",O,r)}else{if(s<Re)return a.formatDistance("xDays",1,r);if(s<W){var p=Math.round(s/Y);return a.formatDistance("xDays",p,r)}else if(s<ke)return m=Math.round(s/W),a.formatDistance("aboutXMonths",m,r)}if(m=Z(l,o),m<12){var c=Math.round(s/W);return a.formatDistance("xMonths",c,r)}else{var P=m%12,y=Math.floor(m/12);return P<3?a.formatDistance("aboutXYears",y,r):P<9?a.formatDistance("overXYears",y,r):a.formatDistance("almostXYears",y+1,r)}}var R=1e3*60,N=60*24,k=N*30,A=N*365;function ze(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};h(2,arguments);var a=n.locale||E;if(!a.formatDistance)throw new RangeError("locale must contain localize.formatDistance property");var i=M(e,t);if(isNaN(i))throw new RangeError("Invalid time value");var r=_(n);r.addSuffix=Boolean(n.addSuffix),r.comparison=i;var o,l;i>0?(o=d(t),l=d(e)):(o=d(e),l=d(t));var f=n.roundingMethod==null?"round":String(n.roundingMethod),u;if(f==="floor")u=Math.floor;else if(f==="ceil")u=Math.ceil;else if(f==="round")u=Math.round;else throw new RangeError("roundingMethod must be 'floor', 'ceil' or 'round'");var s=l.getTime()-o.getTime(),m=s/R,O=T(l)-T(o),p=(s-O)/R,c;if(n.unit==null?m<1?c="second":m<60?c="minute":m<N?c="hour":p<k?c="day":p<A?c="month":c="year":c=String(n.unit),c==="second"){var P=u(s/1e3);return a.formatDistance("xSeconds",P,r)}else if(c==="minute"){var y=u(m);return a.formatDistance("xMinutes",y,r)}else if(c==="hour"){var st=u(m/60);return a.formatDistance("xHours",st,r)}else if(c==="day"){var lt=u(p/N);return a.formatDistance("xDays",lt,r)}else if(c==="month"){var j=u(p/k);return j===12&&n.unit!=="month"?a.formatDistance("xYears",1,r):a.formatDistance("xMonths",j,r)}else if(c==="year"){var ft=u(p/A);return a.formatDistance("xYears",ft,r)}throw new RangeError("unit must be 'second', 'minute', 'hour', 'day', 'month' or 'year'")}function je(e,t){return h(1,arguments),Ae(e,Date.now(),t)}function Xe(e,t){return h(1,arguments),ze(e,Date.now(),t)}function qe(e,t){h(1,arguments);var n=t||{},a=n.additionalDigits==null?2:X(n.additionalDigits);if(a!==2&&a!==1&&a!==0)throw new RangeError("additionalDigits must be 0, 1 or 2");if(!(typeof e=="string"||Object.prototype.toString.call(e)==="[object String]"))return new Date(NaN);var i=$e(e),r;if(i.date){var o=Je(i.date,a);r=Qe(o.restDateString,o.year)}if(!r||isNaN(r.getTime()))return new Date(NaN);var l=r.getTime(),f=0,u;if(i.time&&(f=Ze(i.time),isNaN(f)))return new Date(NaN);if(i.timezone){if(u=Be(i.timezone),isNaN(u))return new Date(NaN)}else{var s=new Date(l+f),m=new Date(0);return m.setFullYear(s.getUTCFullYear(),s.getUTCMonth(),s.getUTCDate()),m.setHours(s.getUTCHours(),s.getUTCMinutes(),s.getUTCSeconds(),s.getUTCMilliseconds()),m}return new Date(l+f+u)}var S={dateTimeDelimiter:/[T ]/,timeZoneDelimiter:/[Z ]/i,timezone:/([Z+-].*)$/},Le=/^-?(?:(\d{3})|(\d{2})(?:-?(\d{2}))?|W(\d{2})(?:-?(\d{1}))?|)$/,He=/^(\d{2}(?:[.,]\d*)?)(?::?(\d{2}(?:[.,]\d*)?))?(?::?(\d{2}(?:[.,]\d*)?))?$/,Ve=/^([+-])(\d{2})(?::?(\d{2}))?$/;function $e(e){var t={},n=e.split(S.dateTimeDelimiter),a;if(n.length>2)return t;if(/:/.test(n[0])?a=n[0]:(t.date=n[0],a=n[1],S.timeZoneDelimiter.test(t.date)&&(t.date=e.split(S.timeZoneDelimiter)[0],a=e.substr(t.date.length,e.length))),a){var i=S.timezone.exec(a);i?(t.time=a.replace(i[1],""),t.timezone=i[1]):t.time=a}return t}function Je(e,t){var n=new RegExp("^(?:(\\d{4}|[+-]\\d{"+(4+t)+"})|(\\d{2}|[+-]\\d{"+(2+t)+"})$)"),a=e.match(n);if(!a)return{year:NaN,restDateString:""};var i=a[1]?parseInt(a[1]):null,r=a[2]?parseInt(a[2]):null;return{year:r===null?i:r*100,restDateString:e.slice((a[1]||a[2]).length)}}function Qe(e,t){if(t===null)return new Date(NaN);var n=e.match(Le);if(!n)return new Date(NaN);var a=!!n[4],i=D(n[1]),r=D(n[2])-1,o=D(n[3]),l=D(n[4]),f=D(n[5])-1;if(a)return nt(t,l,f)?Ke(t,l,f):new Date(NaN);var u=new Date(0);return!et(t,r,o)||!tt(t,i)?new Date(NaN):(u.setUTCFullYear(t,r,Math.max(i,o)),u)}function D(e){return e?parseInt(e):1}function Ze(e){var t=e.match(He);if(!t)return NaN;var n=x(t[1]),a=x(t[2]),i=x(t[3]);return at(n,a,i)?n*U+a*C+i*1e3:NaN}function x(e){return e&&parseFloat(e.replace(",","."))||0}function Be(e){if(e==="Z")return 0;var t=e.match(Ve);if(!t)return 0;var n=t[1]==="+"?-1:1,a=parseInt(t[2]),i=t[3]&&parseInt(t[3])||0;return rt(a,i)?n*(a*U+i*C):NaN}function Ke(e,t,n){var a=new Date(0);a.setUTCFullYear(e,0,4);var i=a.getUTCDay()||7,r=(t-1)*7+n+1-i;return a.setUTCDate(a.getUTCDate()+r),a}var Ge=[31,null,31,30,31,30,31,31,30,31,30,31];function z(e){return e%400===0||e%4===0&&e%100!==0}function et(e,t,n){return t>=0&&t<=11&&n>=1&&n<=(Ge[t]||(z(e)?29:28))}function tt(e,t){return t>=1&&t<=(z(e)?366:365)}function nt(e,t,n){return t>=1&&t<=53&&n>=0&&n<=6}function at(e,t,n){return e===24?t===0&&n===0:n>=0&&n<60&&t>=0&&t<60&&e>=0&&e<25}function rt(e,t){return t>=0&&t<=59}var it=(e,t={},n)=>{typeof e=="string"&&(e=qe(e));const{includeSeconds:a,addSuffix:i=!0,useStrict:r=!1}=t;return r?Xe(e,{addSuffix:i,locale:n}):je(e,{includeSeconds:a,addSuffix:i,locale:n})};const ot=(e={})=>{const t=e.name||"Timeago";return v.defineComponent({name:t,props:{datetime:{type:[String,Number,Date],required:!0},title:{type:[String,Boolean],required:!1,default:null},autoUpdate:{type:[Number,Boolean],required:!1,default:null},converter:{type:Function,required:!1,default:null},converterOptions:{type:Object,required:!1,default:null},locale:{type:Object,required:!1,default:null}},setup(n){const a=v.ref();v.onBeforeMount(()=>{l()}),v.onBeforeUnmount(()=>{f()});const i=u=>(n.converter||it)(u||n.datetime,n.converterOptions||e.converterOptions,n.locale||e.locale),r=v.ref(i()),o=u=>{r.value=i(u)},l=()=>{if(n.autoUpdate){const u=n.autoUpdate===!0?60:n.autoUpdate;a.value=setInterval(()=>{o(n.datetime)},u*1e3)}},f=()=>{a.value&&(clearInterval(a.value),a.value=void 0)};return v.watch(()=>n.autoUpdate,u=>{f(),u&&l()}),v.watch(()=>[n.datetime,n.converter],()=>{o()}),v.watch(()=>n.converterOptions,()=>{o()},{deep:!0}),{timeago:r,updateTimer:a}},render(){return v.h("timeago",{attrs:{datetime:new Date(this.datetime).toISOString(),title:typeof this.title=="string"?this.title:this.title===!1?null:this.timeago}},[this.timeago])}})};var ut=(e,t)=>{if(e.config.globalProperties.$timeago)return;Number(e.version.split(".")[0])<3&&console.warn("[vue-timeago3] This plugin requires at least Vue version 3.0");const a=ot(t);e.component(a.name,a)};g.default=ut,Object.defineProperty(g,"__esModule",{value:!0}),g[Symbol.toStringTag]="Module"});
(function(g,v){typeof exports=="object"&&typeof module!="undefined"?v(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],v):(g=typeof globalThis!="undefined"?globalThis:g||self,v(g.VueTimeago3={},g.Vue))})(this,function(g,v){"use strict";function X(e){if(e===null||e===!0||e===!1)return NaN;var t=Number(e);return isNaN(t)?t:t<0?Math.ceil(t):Math.floor(t)}function h(e,t){if(t.length<e)throw new TypeError(e+" argument"+(e>1?"s":"")+" required, but only "+t.length+" present")}function d(e){h(1,arguments);var t=Object.prototype.toString.call(e);return e instanceof Date||typeof e=="object"&&t==="[object Date]"?new Date(e.getTime()):typeof e=="number"||t==="[object Number]"?new Date(e):((typeof e=="string"||t==="[object String]")&&typeof console!="undefined"&&(console.warn("Starting with v2.0.0-beta.1 date-fns doesn't accept strings as date arguments. Please use `parseISO` to parse strings. See: https://git.io/fjule"),console.warn(new Error().stack)),new Date(NaN))}function T(e){var t=new Date(Date.UTC(e.getFullYear(),e.getMonth(),e.getDate(),e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds()));return t.setUTCFullYear(e.getFullYear()),e.getTime()-t.getTime()}function p(e,t){h(2,arguments);var n=d(e),a=d(t),i=n.getTime()-a.getTime();return i<0?-1:i>0?1:i}var U=6e4,O=36e5;function q(e,t){h(2,arguments);var n=d(e),a=d(t),i=n.getFullYear()-a.getFullYear(),r=n.getMonth()-a.getMonth();return i*12+r}function L(e,t){return h(2,arguments),d(e).getTime()-d(t).getTime()}var F={ceil:Math.ceil,round:Math.round,floor:Math.floor,trunc:function(e){return e<0?Math.ceil(e):Math.floor(e)}},H="trunc";function V(e){return e?F[e]:F[H]}function $(e){h(1,arguments);var t=d(e);return t.setHours(23,59,59,999),t}function J(e){h(1,arguments);var t=d(e),n=t.getMonth();return t.setFullYear(t.getFullYear(),n+1,0),t.setHours(23,59,59,999),t}function Q(e){h(1,arguments);var t=d(e);return $(t).getTime()===J(t).getTime()}function Z(e,t){h(2,arguments);var n=d(e),a=d(t),i=p(n,a),r=Math.abs(q(n,a)),o;if(r<1)o=0;else{n.getMonth()===1&&n.getDate()>27&&n.setDate(30),n.setMonth(n.getMonth()-i*r);var l=p(n,a)===-i;Q(d(e))&&r===1&&p(e,a)===1&&(l=!1),o=i*(r-Number(l))}return o===0?0:o}function B(e,t,n){h(2,arguments);var a=L(e,t)/1e3;return V(n==null?void 0:n.roundingMethod)(a)}var K={lessThanXSeconds:{one:"less than a second",other:"less than {{count}} seconds"},xSeconds:{one:"1 second",other:"{{count}} seconds"},halfAMinute:"half a minute",lessThanXMinutes:{one:"less than a minute",other:"less than {{count}} minutes"},xMinutes:{one:"1 minute",other:"{{count}} minutes"},aboutXHours:{one:"about 1 hour",other:"about {{count}} hours"},xHours:{one:"1 hour",other:"{{count}} hours"},xDays:{one:"1 day",other:"{{count}} days"},aboutXWeeks:{one:"about 1 week",other:"about {{count}} weeks"},xWeeks:{one:"1 week",other:"{{count}} weeks"},aboutXMonths:{one:"about 1 month",other:"about {{count}} months"},xMonths:{one:"1 month",other:"{{count}} months"},aboutXYears:{one:"about 1 year",other:"about {{count}} years"},xYears:{one:"1 year",other:"{{count}} years"},overXYears:{one:"over 1 year",other:"over {{count}} years"},almostXYears:{one:"almost 1 year",other:"almost {{count}} years"}},G=function(e,t,n){var a,i=K[e];return typeof i=="string"?a=i:t===1?a=i.one:a=i.other.replace("{{count}}",t.toString()),n!=null&&n.addSuffix?n.comparison&&n.comparison>0?"in "+a:a+" ago":a},ee=G;function x(e){return function(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},n=t.width?String(t.width):e.defaultWidth,a=e.formats[n]||e.formats[e.defaultWidth];return a}}var te={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},ne={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},ae={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},re={date:x({formats:te,defaultWidth:"full"}),time:x({formats:ne,defaultWidth:"full"}),dateTime:x({formats:ae,defaultWidth:"full"})},ie=re,oe={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},ue=function(e,t,n,a){return oe[e]},se=ue;function w(e){return function(t,n){var a=n||{},i=a.context?String(a.context):"standalone",r;if(i==="formatting"&&e.formattingValues){var o=e.defaultFormattingWidth||e.defaultWidth,l=a.width?String(a.width):o;r=e.formattingValues[l]||e.formattingValues[o]}else{var f=e.defaultWidth,u=a.width?String(a.width):e.defaultWidth;r=e.values[u]||e.values[f]}var s=e.argumentCallback?e.argumentCallback(t):t;return r[s]}}var le={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},fe={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},de={narrow:["J","F","M","A","M","J","J","A","S","O","N","D"],abbreviated:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],wide:["January","February","March","April","May","June","July","August","September","October","November","December"]},me={narrow:["S","M","T","W","T","F","S"],short:["Su","Mo","Tu","We","Th","Fr","Sa"],abbreviated:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],wide:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},ce={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"}},he={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"}},ve=function(e,t){var n=Number(e),a=n%100;if(a>20||a<10)switch(a%10){case 1:return n+"st";case 2:return n+"nd";case 3:return n+"rd"}return n+"th"},ge={ordinalNumber:ve,era:w({values:le,defaultWidth:"wide"}),quarter:w({values:fe,defaultWidth:"wide",argumentCallback:function(e){return e-1}}),month:w({values:de,defaultWidth:"wide"}),day:w({values:me,defaultWidth:"wide"}),dayPeriod:w({values:ce,defaultWidth:"wide",formattingValues:he,defaultFormattingWidth:"wide"})},Me=ge;function b(e){return function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},a=n.width,i=a&&e.matchPatterns[a]||e.matchPatterns[e.defaultMatchWidth],r=t.match(i);if(!r)return null;var o=r[0],l=a&&e.parsePatterns[a]||e.parsePatterns[e.defaultParseWidth],f=Array.isArray(l)?we(l,function(m){return m.test(o)}):pe(l,function(m){return m.test(o)}),u;u=e.valueCallback?e.valueCallback(f):f,u=n.valueCallback?n.valueCallback(u):u;var s=t.slice(o.length);return{value:u,rest:s}}}function pe(e,t){for(var n in e)if(e.hasOwnProperty(n)&&t(e[n]))return n}function we(e,t){for(var n=0;n<e.length;n++)if(t(e[n]))return n}function be(e){return function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},a=t.match(e.matchPattern);if(!a)return null;var i=a[0],r=t.match(e.parsePattern);if(!r)return null;var o=e.valueCallback?e.valueCallback(r[0]):r[0];o=n.valueCallback?n.valueCallback(o):o;var l=t.slice(i.length);return{value:o,rest:l}}}var De=/^(\d+)(th|st|nd|rd)?/i,ye=/\d+/i,Te={narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},Se={any:[/^b/i,/^(a|c)/i]},Ne={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},Pe={any:[/1/i,/2/i,/3/i,/4/i]},xe={narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},Ie={narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},We={narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},Ce={narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},Ue={narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},Oe={any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},Fe={ordinalNumber:be({matchPattern:De,parsePattern:ye,valueCallback:function(e){return parseInt(e,10)}}),era:b({matchPatterns:Te,defaultMatchWidth:"wide",parsePatterns:Se,defaultParseWidth:"any"}),quarter:b({matchPatterns:Ne,defaultMatchWidth:"wide",parsePatterns:Pe,defaultParseWidth:"any",valueCallback:function(e){return e+1}}),month:b({matchPatterns:xe,defaultMatchWidth:"wide",parsePatterns:Ie,defaultParseWidth:"any"}),day:b({matchPatterns:We,defaultMatchWidth:"wide",parsePatterns:Ce,defaultParseWidth:"any"}),dayPeriod:b({matchPatterns:Ue,defaultMatchWidth:"any",parsePatterns:Oe,defaultParseWidth:"any"})},Ee=Fe,_e={code:"en-US",formatDistance:ee,formatLong:ie,formatRelative:se,localize:Me,match:Ee,options:{weekStartsOn:0,firstWeekContainsDate:1}},E=_e;function Ye(e,t){if(e==null)throw new TypeError("assign requires that input parameter not be null or undefined");t=t||{};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e}function _(e){return Ye({},e)}var Y=1440,Re=2520,I=43200,ke=86400;function Ae(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};h(2,arguments);var a=n.locale||E;if(!a.formatDistance)throw new RangeError("locale must contain formatDistance property");var i=p(e,t);if(isNaN(i))throw new RangeError("Invalid time value");var r=_(n);r.addSuffix=Boolean(n.addSuffix),r.comparison=i;var o,l;i>0?(o=d(t),l=d(e)):(o=d(e),l=d(t));var f=B(l,o),u=(T(l)-T(o))/1e3,s=Math.round((f-u)/60),m;if(s<2)return n.includeSeconds?f<5?a.formatDistance("lessThanXSeconds",5,r):f<10?a.formatDistance("lessThanXSeconds",10,r):f<20?a.formatDistance("lessThanXSeconds",20,r):f<40?a.formatDistance("halfAMinute",null,r):f<60?a.formatDistance("lessThanXMinutes",1,r):a.formatDistance("xMinutes",1,r):s===0?a.formatDistance("lessThanXMinutes",1,r):a.formatDistance("xMinutes",s,r);if(s<45)return a.formatDistance("xMinutes",s,r);if(s<90)return a.formatDistance("aboutXHours",1,r);if(s<Y){var C=Math.round(s/60);return a.formatDistance("aboutXHours",C,r)}else{if(s<Re)return a.formatDistance("xDays",1,r);if(s<I){var M=Math.round(s/Y);return a.formatDistance("xDays",M,r)}else if(s<ke)return m=Math.round(s/I),a.formatDistance("aboutXMonths",m,r)}if(m=Z(l,o),m<12){var c=Math.round(s/I);return a.formatDistance("xMonths",c,r)}else{var P=m%12,y=Math.floor(m/12);return P<3?a.formatDistance("aboutXYears",y,r):P<9?a.formatDistance("overXYears",y,r):a.formatDistance("almostXYears",y+1,r)}}var R=1e3*60,S=60*24,k=S*30,A=S*365;function ze(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};h(2,arguments);var a=n.locale||E;if(!a.formatDistance)throw new RangeError("locale must contain localize.formatDistance property");var i=p(e,t);if(isNaN(i))throw new RangeError("Invalid time value");var r=_(n);r.addSuffix=Boolean(n.addSuffix),r.comparison=i;var o,l;i>0?(o=d(t),l=d(e)):(o=d(e),l=d(t));var f=n.roundingMethod==null?"round":String(n.roundingMethod),u;if(f==="floor")u=Math.floor;else if(f==="ceil")u=Math.ceil;else if(f==="round")u=Math.round;else throw new RangeError("roundingMethod must be 'floor', 'ceil' or 'round'");var s=l.getTime()-o.getTime(),m=s/R,C=T(l)-T(o),M=(s-C)/R,c;if(n.unit==null?m<1?c="second":m<60?c="minute":m<S?c="hour":M<k?c="day":M<A?c="month":c="year":c=String(n.unit),c==="second"){var P=u(s/1e3);return a.formatDistance("xSeconds",P,r)}else if(c==="minute"){var y=u(m);return a.formatDistance("xMinutes",y,r)}else if(c==="hour"){var st=u(m/60);return a.formatDistance("xHours",st,r)}else if(c==="day"){var lt=u(M/S);return a.formatDistance("xDays",lt,r)}else if(c==="month"){var j=u(M/k);return j===12&&n.unit!=="month"?a.formatDistance("xYears",1,r):a.formatDistance("xMonths",j,r)}else if(c==="year"){var ft=u(M/A);return a.formatDistance("xYears",ft,r)}throw new RangeError("unit must be 'second', 'minute', 'hour', 'day', 'month' or 'year'")}function je(e,t){return h(1,arguments),Ae(e,Date.now(),t)}function Xe(e,t){return h(1,arguments),ze(e,Date.now(),t)}function qe(e,t){h(1,arguments);var n=t||{},a=n.additionalDigits==null?2:X(n.additionalDigits);if(a!==2&&a!==1&&a!==0)throw new RangeError("additionalDigits must be 0, 1 or 2");if(!(typeof e=="string"||Object.prototype.toString.call(e)==="[object String]"))return new Date(NaN);var i=$e(e),r;if(i.date){var o=Je(i.date,a);r=Qe(o.restDateString,o.year)}if(!r||isNaN(r.getTime()))return new Date(NaN);var l=r.getTime(),f=0,u;if(i.time&&(f=Ze(i.time),isNaN(f)))return new Date(NaN);if(i.timezone){if(u=Be(i.timezone),isNaN(u))return new Date(NaN)}else{var s=new Date(l+f),m=new Date(0);return m.setFullYear(s.getUTCFullYear(),s.getUTCMonth(),s.getUTCDate()),m.setHours(s.getUTCHours(),s.getUTCMinutes(),s.getUTCSeconds(),s.getUTCMilliseconds()),m}return new Date(l+f+u)}var N={dateTimeDelimiter:/[T ]/,timeZoneDelimiter:/[Z ]/i,timezone:/([Z+-].*)$/},Le=/^-?(?:(\d{3})|(\d{2})(?:-?(\d{2}))?|W(\d{2})(?:-?(\d{1}))?|)$/,He=/^(\d{2}(?:[.,]\d*)?)(?::?(\d{2}(?:[.,]\d*)?))?(?::?(\d{2}(?:[.,]\d*)?))?$/,Ve=/^([+-])(\d{2})(?::?(\d{2}))?$/;function $e(e){var t={},n=e.split(N.dateTimeDelimiter),a;if(n.length>2)return t;if(/:/.test(n[0])?a=n[0]:(t.date=n[0],a=n[1],N.timeZoneDelimiter.test(t.date)&&(t.date=e.split(N.timeZoneDelimiter)[0],a=e.substr(t.date.length,e.length))),a){var i=N.timezone.exec(a);i?(t.time=a.replace(i[1],""),t.timezone=i[1]):t.time=a}return t}function Je(e,t){var n=new RegExp("^(?:(\\d{4}|[+-]\\d{"+(4+t)+"})|(\\d{2}|[+-]\\d{"+(2+t)+"})$)"),a=e.match(n);if(!a)return{year:NaN,restDateString:""};var i=a[1]?parseInt(a[1]):null,r=a[2]?parseInt(a[2]):null;return{year:r===null?i:r*100,restDateString:e.slice((a[1]||a[2]).length)}}function Qe(e,t){if(t===null)return new Date(NaN);var n=e.match(Le);if(!n)return new Date(NaN);var a=!!n[4],i=D(n[1]),r=D(n[2])-1,o=D(n[3]),l=D(n[4]),f=D(n[5])-1;if(a)return nt(t,l,f)?Ke(t,l,f):new Date(NaN);var u=new Date(0);return!et(t,r,o)||!tt(t,i)?new Date(NaN):(u.setUTCFullYear(t,r,Math.max(i,o)),u)}function D(e){return e?parseInt(e):1}function Ze(e){var t=e.match(He);if(!t)return NaN;var n=W(t[1]),a=W(t[2]),i=W(t[3]);return at(n,a,i)?n*O+a*U+i*1e3:NaN}function W(e){return e&&parseFloat(e.replace(",","."))||0}function Be(e){if(e==="Z")return 0;var t=e.match(Ve);if(!t)return 0;var n=t[1]==="+"?-1:1,a=parseInt(t[2]),i=t[3]&&parseInt(t[3])||0;return rt(a,i)?n*(a*O+i*U):NaN}function Ke(e,t,n){var a=new Date(0);a.setUTCFullYear(e,0,4);var i=a.getUTCDay()||7,r=(t-1)*7+n+1-i;return a.setUTCDate(a.getUTCDate()+r),a}var Ge=[31,null,31,30,31,30,31,31,30,31,30,31];function z(e){return e%400===0||e%4===0&&e%100!==0}function et(e,t,n){return t>=0&&t<=11&&n>=1&&n<=(Ge[t]||(z(e)?29:28))}function tt(e,t){return t>=1&&t<=(z(e)?366:365)}function nt(e,t,n){return t>=1&&t<=53&&n>=0&&n<=6}function at(e,t,n){return e===24?t===0&&n===0:n>=0&&n<60&&t>=0&&t<60&&e>=0&&e<25}function rt(e,t){return t>=0&&t<=59}var it=(e,t={},n)=>{var a,i;return typeof e=="string"&&(e=qe(e)),t.useStrict?Xe(e,{addSuffix:(a=t.addSuffix)!=null?a:!0,locale:n,unit:t.unit,roundingMethod:t.roundingMethod}):je(e,{includeSeconds:t.includeSeconds,addSuffix:(i=t.addSuffix)!=null?i:!0,locale:n})};const ot=(e={})=>{const t=e.name||"Timeago";return v.defineComponent({name:t,props:{datetime:{type:[String,Number,Date],required:!0},title:{type:[String,Boolean],required:!1,default:null},autoUpdate:{type:[Number,Boolean],required:!1,default:null},converter:{type:Function,required:!1,default:null},converterOptions:{type:Object,required:!1,default:null},locale:{type:Object,required:!1,default:null}},setup(n){const a=v.ref();v.onBeforeMount(()=>{l()}),v.onBeforeUnmount(()=>{f()});const i=u=>(n.converter||it)(u||n.datetime,n.converterOptions||e.converterOptions,n.locale||e.locale),r=v.ref(i()),o=u=>{r.value=i(u)},l=()=>{if(n.autoUpdate){const u=n.autoUpdate===!0?60:n.autoUpdate;a.value=setInterval(()=>{o(n.datetime)},u*1e3)}},f=()=>{a.value&&(clearInterval(a.value),a.value=void 0)};return v.watch(()=>n.autoUpdate,u=>{f(),u&&l()}),v.watch(()=>[n.datetime,n.converter],()=>{o()}),v.watch(()=>n.converterOptions,()=>{o()},{deep:!0}),{timeago:r,updateTimer:a}},render(){return v.h("timeago",{attrs:{datetime:new Date(this.datetime).toISOString(),title:typeof this.title=="string"?this.title:this.title===!1?null:this.timeago}},[this.timeago])}})};var ut=(e,t)=>{if(e.config.globalProperties.$timeago)return;Number(e.version.split(".")[0])<3&&console.warn("[vue-timeago3] This plugin requires at least Vue version 3.0");const a=ot(t);e.component(a.name,a)};g.default=ut,Object.defineProperty(g,"__esModule",{value:!0}),g[Symbol.toStringTag]="Module"});
{
"name": "vue-timeago3",
"version": "2.2.1",
"version": "2.3.0",
"files": [

@@ -55,24 +55,26 @@ "dist"

"devDependencies": {
"@release-it/conventional-changelog": "^4.3.0",
"@types/jest": "^27.4.1",
"@types/node": "^17.0.30",
"@typescript-eslint/eslint-plugin": "^5.21.0",
"@typescript-eslint/parser": "^5.21.0",
"@vitejs/plugin-vue": "^2.3.1",
"@vue/compiler-sfc": "^3.2.33",
"@vue/test-utils": "^2.0.0-rc.21",
"eslint": "^8.14.0",
"@release-it/conventional-changelog": "^5.0.0",
"@types/jest": "^27.5.0",
"@types/node": "^17.0.42",
"@typescript-eslint/eslint-plugin": "^5.27.1",
"@typescript-eslint/parser": "^5.27.1",
"@vitejs/plugin-vue": "^2.3.3",
"@vue/compiler-sfc": "^3.2.37",
"@vue/test-utils": "^2.0.0",
"eslint": "^8.17.0",
"eslint-config-prettier": "^8.5.0",
"eslint-plugin-vue": "^8.7.1",
"eslint-plugin-vue": "^9.1.1",
"jest": "^27.5.1",
"prettier": "2.6.2",
"release-it": "^14.14.2",
"release-it": "^15.0.0",
"ts-jest": "^27.1.4",
"ts-node": "^10.7.0",
"typescript": "^4.6.4",
"vite": "^2.9.6",
"vitepress": "^0.22.3",
"vue-eslint-parser": "^8.3.0",
"vue-tsc": "^0.34.11"
}
"ts-node": "^10.8.1",
"typescript": "^4.7.3",
"vite": "^2.9.12",
"vitepress": "^0.22.4",
"vue-eslint-parser": "^9.0.2",
"vue-tsc": "^0.37.3"
},
"description": "vue-timeago3 is a tiny component for Vue.js 3, to show the time passed since a specific date. You simply pass a date and get somewhat like 10 seconds ago, 3 weeks ago, ... printed by the component",
"author": "MrDeerly"
}

@@ -94,8 +94,9 @@ # ⏳ vue-timeago3

| option | type | description |
| -------------------- | -------------------------------------------------------------------------- |----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| **name** | `string` | Register the component with a custom name. Default is: `timeago` |
| **locale** | `Locale` (see [date-fns/Locale](https://date-fns.org/v2.26.0/docs/Locale)) | The `locale` specifies the language which is used to render the date. All available `date-fns` locales are supported by default. |
| **converter** | `(date, converterOptions) => string` | A **converter** that formats regular dates in `x Seconds ago`, or in `xxx` style. Check out the [default converter](ahttps://github.com/MrDeerly/vue-timeago3/blob/master/src/defaultConverter.js) which uses [date-fns formatDistanceToNow](https://date-fns.org/v2.24.0/docs/formatDistanceToNow) |
| **converterOptions** | `Object` | Pass some extra settings to the default converter mentioned above. It supports the main options of `date-fns`, namingly: <br/><br/> `includeSeconds` - `boolean` - distances less than a minute are more detailed </br> `addSuffix` - `boolean` - results specifies if now is earlier or later than the date passed <br/> `useStrict` - `boolean` - use strict units, does not use helpers like 'almost', 'over', 'less than' and the like |
| option | type | description |
|-----------------------------|----------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| **name** | `string` | Register the component with a custom name. Default is: `timeago` |
| **locale** | `Locale` (see [date-fns/Locale](https://date-fns.org/v2.26.0/docs/Locale)) | The `locale` specifies the language which is used to render the date. All available `date-fns` locales are supported by default. |
| **converter** | `(date, defaultConvertOptions \| strictConverterOptions) => string` | A **converter** that formats regular dates in `x Seconds ago`, or in `xxx` style. Check out the [default converter](ahttps://github.com/MrDeerly/vue-timeago3/blob/master/src/defaultConverter.js) which uses [date-fns formatDistanceToNow](https://date-fns.org/v2.24.0/docs/formatDistanceToNow) |
| **defaultConverterOptions** | `Object` | Pass some extra settings to the default converter mentioned above. It supports the main options of `date-fns`, namingly: <br/><br/> `includeSeconds` - `boolean` - distances less than a minute are more detailed </br> `addSuffix` - `boolean` - results specifies if now is earlier or later than the date passed <br/> `useStrict` - `false` - **if `true` you need to use the `strictConverterOptions` (see below)** |
| **strictConverterOptions** | `Object` | Pass some extra settings to the default converter mentioned above. It supports the main options of `date-fns` strict converter, namingly: <br/><br/> `useStrict` - `true` - needs to be `true`, otherwise the `defaultConverterOptions` have to be used (see above) </br> `addSuffix` - `boolean` - results specifies if now is earlier or later than the date passed <br/> `unit` - `second, minute, hour, day, month, year` if specified, will force a unit<br/>`roundingMethod` - `floor, ceil, round` which way to round partial units (default=round) |

@@ -134,3 +135,4 @@ ### Component

| **locale** | `Locale` (see [date-fns/Locale](https://date-fns.org/v2.26.0/docs/Locale)) | :x: | `en` | The `locale` specifies the language which is used to render the date. All available `date-fns` locales are supported by default. |
| **converter** | `date, converterOptions) => string` | :x: | | See plugin options above |
| **converterOptions** | `Object` | :x: | | See plugin options above |
| **converter** | `date, defaultConverterOptions \| strictConverterOptions) => string` | :x: | | See plugin options above |
| **defaultConverterOptions** | `Object` | :x: | | See plugin options above |
| **strictConverterOptions** | `Object` | :x: | | See plugin options above |
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