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

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.1.2 to 2.2.1-rc1

167

dist/vue-timeago.es.js

@@ -50,2 +50,4 @@ import { defineComponent, ref, onBeforeMount, onBeforeUnmount, watch, h } from "vue";

}
var millisecondsInMinute = 6e4;
var millisecondsInHour = 36e5;
function differenceInCalendarMonths(dirtyDateLeft, dirtyDateRight) {

@@ -589,5 +591,5 @@ requiredArgs(2, arguments);

}
var MINUTES_IN_DAY = 1440;
var MINUTES_IN_DAY$1 = 1440;
var MINUTES_IN_ALMOST_TWO_DAYS = 2520;
var MINUTES_IN_MONTH = 43200;
var MINUTES_IN_MONTH$1 = 43200;
var MINUTES_IN_TWO_MONTHS = 86400;

@@ -647,3 +649,3 @@ function formatDistance(dirtyDate, dirtyBaseDate) {

return locale2.formatDistance("aboutXHours", 1, localizeOptions);
} else if (minutes < MINUTES_IN_DAY) {
} else if (minutes < MINUTES_IN_DAY$1) {
var hours = Math.round(minutes / 60);

@@ -653,7 +655,7 @@ return locale2.formatDistance("aboutXHours", hours, localizeOptions);

return locale2.formatDistance("xDays", 1, localizeOptions);
} else if (minutes < MINUTES_IN_MONTH) {
var days = Math.round(minutes / MINUTES_IN_DAY);
} else if (minutes < MINUTES_IN_MONTH$1) {
var days = Math.round(minutes / MINUTES_IN_DAY$1);
return locale2.formatDistance("xDays", days, localizeOptions);
} else if (minutes < MINUTES_IN_TWO_MONTHS) {
months = Math.round(minutes / MINUTES_IN_MONTH);
months = Math.round(minutes / MINUTES_IN_MONTH$1);
return locale2.formatDistance("aboutXMonths", months, localizeOptions);

@@ -663,3 +665,3 @@ }

if (months < 12) {
var nearestMonth = Math.round(minutes / MINUTES_IN_MONTH);
var nearestMonth = Math.round(minutes / MINUTES_IN_MONTH$1);
return locale2.formatDistance("xMonths", nearestMonth, localizeOptions);

@@ -678,2 +680,83 @@ } else {

}
var MILLISECONDS_IN_MINUTE = 1e3 * 60;
var MINUTES_IN_DAY = 60 * 24;
var MINUTES_IN_MONTH = MINUTES_IN_DAY * 30;
var MINUTES_IN_YEAR = MINUTES_IN_DAY * 365;
function formatDistanceStrict(dirtyDate, dirtyBaseDate) {
var options = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {};
requiredArgs(2, arguments);
var locale2 = options.locale || defaultLocale;
if (!locale2.formatDistance) {
throw new RangeError("locale must contain localize.formatDistance property");
}
var comparison = compareAsc(dirtyDate, dirtyBaseDate);
if (isNaN(comparison)) {
throw new RangeError("Invalid time value");
}
var localizeOptions = cloneObject(options);
localizeOptions.addSuffix = Boolean(options.addSuffix);
localizeOptions.comparison = comparison;
var dateLeft;
var dateRight;
if (comparison > 0) {
dateLeft = toDate(dirtyBaseDate);
dateRight = toDate(dirtyDate);
} else {
dateLeft = toDate(dirtyDate);
dateRight = toDate(dirtyBaseDate);
}
var roundingMethod = options.roundingMethod == null ? "round" : String(options.roundingMethod);
var roundingMethodFn;
if (roundingMethod === "floor") {
roundingMethodFn = Math.floor;
} else if (roundingMethod === "ceil") {
roundingMethodFn = Math.ceil;
} else if (roundingMethod === "round") {
roundingMethodFn = Math.round;
} else {
throw new RangeError("roundingMethod must be 'floor', 'ceil' or 'round'");
}
var milliseconds = dateRight.getTime() - dateLeft.getTime();
var minutes = milliseconds / MILLISECONDS_IN_MINUTE;
var timezoneOffset = getTimezoneOffsetInMilliseconds(dateRight) - getTimezoneOffsetInMilliseconds(dateLeft);
var dstNormalizedMinutes = (milliseconds - timezoneOffset) / MILLISECONDS_IN_MINUTE;
var unit;
if (options.unit == null) {
if (minutes < 1) {
unit = "second";
} else if (minutes < 60) {
unit = "minute";
} else if (minutes < MINUTES_IN_DAY) {
unit = "hour";
} else if (dstNormalizedMinutes < MINUTES_IN_MONTH) {
unit = "day";
} else if (dstNormalizedMinutes < MINUTES_IN_YEAR) {
unit = "month";
} else {
unit = "year";
}
} else {
unit = String(options.unit);
}
if (unit === "second") {
var seconds = roundingMethodFn(milliseconds / 1e3);
return locale2.formatDistance("xSeconds", seconds, localizeOptions);
} else if (unit === "minute") {
var roundedMinutes = roundingMethodFn(minutes);
return locale2.formatDistance("xMinutes", roundedMinutes, localizeOptions);
} else if (unit === "hour") {
var hours = roundingMethodFn(minutes / 60);
return locale2.formatDistance("xHours", hours, localizeOptions);
} else if (unit === "day") {
var days = roundingMethodFn(dstNormalizedMinutes / MINUTES_IN_DAY);
return locale2.formatDistance("xDays", days, localizeOptions);
} else if (unit === "month") {
var months = roundingMethodFn(dstNormalizedMinutes / MINUTES_IN_MONTH);
return months === 12 && options.unit !== "month" ? locale2.formatDistance("xYears", 1, localizeOptions) : locale2.formatDistance("xMonths", months, localizeOptions);
} else if (unit === "year") {
var years = roundingMethodFn(dstNormalizedMinutes / MINUTES_IN_YEAR);
return locale2.formatDistance("xYears", years, localizeOptions);
}
throw new RangeError("unit must be 'second', 'minute', 'hour', 'day', 'month' or 'year'");
}
function formatDistanceToNow(dirtyDate, dirtyOptions) {

@@ -683,17 +766,10 @@ requiredArgs(1, arguments);

}
var MILLISECONDS_IN_HOUR = 36e5;
var MILLISECONDS_IN_MINUTE = 6e4;
var DEFAULT_ADDITIONAL_DIGITS = 2;
var patterns = {
dateTimeDelimiter: /[T ]/,
timeZoneDelimiter: /[Z ]/i,
timezone: /([Z+-].*)$/
};
var dateRegex = /^-?(?:(\d{3})|(\d{2})(?:-?(\d{2}))?|W(\d{2})(?:-?(\d{1}))?|)$/;
var timeRegex = /^(\d{2}(?:[.,]\d*)?)(?::?(\d{2}(?:[.,]\d*)?))?(?::?(\d{2}(?:[.,]\d*)?))?$/;
var timezoneRegex = /^([+-])(\d{2})(?::?(\d{2}))?$/;
function formatDistanceToNowStrict(dirtyDate, dirtyOptions) {
requiredArgs(1, arguments);
return formatDistanceStrict(dirtyDate, Date.now(), dirtyOptions);
}
function parseISO(argument, dirtyOptions) {
requiredArgs(1, arguments);
var options = dirtyOptions || {};
var additionalDigits = options.additionalDigits == null ? DEFAULT_ADDITIONAL_DIGITS : toInteger(options.additionalDigits);
var additionalDigits = options.additionalDigits == null ? 2 : toInteger(options.additionalDigits);
if (additionalDigits !== 2 && additionalDigits !== 1 && additionalDigits !== 0) {

@@ -711,3 +787,3 @@ throw new RangeError("additionalDigits must be 0, 1 or 2");

}
if (isNaN(date) || !date) {
if (!date || isNaN(date.getTime())) {
return new Date(NaN);

@@ -720,3 +796,3 @@ }

time = parseTime(dateStrings.time);
if (isNaN(time) || time === null) {
if (isNaN(time)) {
return new Date(NaN);

@@ -739,2 +815,10 @@ }

}
var patterns = {
dateTimeDelimiter: /[T ]/,
timeZoneDelimiter: /[Z ]/i,
timezone: /([Z+-].*)$/
};
var dateRegex = /^-?(?:(\d{3})|(\d{2})(?:-?(\d{2}))?|W(\d{2})(?:-?(\d{1}))?|)$/;
var timeRegex = /^(\d{2}(?:[.,]\d*)?)(?::?(\d{2}(?:[.,]\d*)?))?(?::?(\d{2}(?:[.,]\d*)?))?$/;
var timezoneRegex = /^([+-])(\d{2})(?::?(\d{2}))?$/;
function splitDateString(dateString) {

@@ -748,3 +832,2 @@ var dateStrings = {};

if (/:/.test(array[0])) {
dateStrings.date = null;
timeString = array[0];

@@ -775,8 +858,9 @@ } else {

return {
year: null
year: NaN,
restDateString: ""
};
var year = captures[1] && parseInt(captures[1]);
var century = captures[2] && parseInt(captures[2]);
var year = captures[1] ? parseInt(captures[1]) : null;
var century = captures[2] ? parseInt(captures[2]) : null;
return {
year: century == null ? year : century * 100,
year: century === null ? year : century * 100,
restDateString: dateString.slice((captures[1] || captures[2]).length)

@@ -787,6 +871,6 @@ };

if (year === null)
return null;
return new Date(NaN);
var captures = dateString.match(dateRegex);
if (!captures)
return null;
return new Date(NaN);
var isWeekDate = !!captures[4];

@@ -818,3 +902,3 @@ var dayOfYear = parseDateUnit(captures[1]);

if (!captures)
return null;
return NaN;
var hours = parseTimeUnit(captures[1]);

@@ -826,3 +910,3 @@ var minutes = parseTimeUnit(captures[2]);

}
return hours * MILLISECONDS_IN_HOUR + minutes * MILLISECONDS_IN_MINUTE + seconds * 1e3;
return hours * millisecondsInHour + minutes * millisecondsInMinute + seconds * 1e3;
}

@@ -844,3 +928,3 @@ function parseTimeUnit(value) {

}
return sign * (hours * MILLISECONDS_IN_HOUR + minutes * MILLISECONDS_IN_MINUTE);
return sign * (hours * millisecondsInHour + minutes * millisecondsInMinute);
}

@@ -857,3 +941,3 @@ function dayOfISOWeekYear(isoWeekYear, week, day) {

function isLeapYearIndex(year) {
return year % 400 === 0 || year % 4 === 0 && year % 100;
return year % 400 === 0 || year % 4 === 0 && year % 100 !== 0;
}

@@ -882,3 +966,13 @@ function validateDate(year, month, date) {

}
const { includeSeconds, addSuffix = true } = converterOptions;
const {
includeSeconds,
addSuffix = true,
useStrict = false
} = converterOptions;
if (useStrict) {
return formatDistanceToNowStrict(date, {
addSuffix,
locale: locale2
});
}
return formatDistanceToNow(date, {

@@ -925,3 +1019,3 @@ includeSeconds,

},
setup(props) {
setup(props, { expose }) {
const updateTimer = ref();

@@ -970,3 +1064,6 @@ onBeforeMount(() => {

});
return { timeago, updateTimer };
{
expose({ convert });
}
return { timeago, updateTimer, convert };
},

@@ -973,0 +1070,0 @@ render() {

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

(function(v,c){typeof exports=="object"&&typeof module!="undefined"?c(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],c):(v=typeof globalThis!="undefined"?globalThis:v||self,c(v.VueTimeago3={},v.Vue))})(this,function(v,c){"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 N(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 b(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}function F(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 _(e,t){return h(2,arguments),d(e).getTime()-d(t).getTime()}var P={ceil:Math.ceil,round:Math.round,floor:Math.floor,trunc:function(e){return e<0?Math.ceil(e):Math.floor(e)}},A="trunc";function k(e){return e?P[e]:P[A]}function Y(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 E(e){h(1,arguments);var t=d(e);return Y(t).getTime()===j(t).getTime()}function R(e,t){h(2,arguments);var n=d(e),a=d(t),i=b(n,a),r=Math.abs(F(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 s=b(n,a)===-i;E(d(e))&&r===1&&b(e,a)===1&&(s=!1),o=i*(r-Number(s))}return o===0?0:o}function X(e,t,n){h(2,arguments);var a=_(e,t)/1e3;return k(n==null?void 0:n.roundingMethod)(a)}var q={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"}},z=function(e,t,n){var a,i=q[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},L=z;function D(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 V={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},H={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},$={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},J={date:D({formats:V,defaultWidth:"full"}),time:D({formats:H,defaultWidth:"full"}),dateTime:D({formats:$,defaultWidth:"full"})},B=J,Q={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},Z=function(e,t,n,a){return Q[e]},G=Z;function g(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,s=a.width?String(a.width):o;r=e.formattingValues[s]||e.formattingValues[o]}else{var f=e.defaultWidth,l=a.width?String(a.width):e.defaultWidth;r=e.values[l]||e.values[f]}var u=e.argumentCallback?e.argumentCallback(t):t;return r[u]}}var K={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},ee={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},te={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"]},ne={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"]},ae={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"}},re={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"}},ie=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"},oe={ordinalNumber:ie,era:g({values:K,defaultWidth:"wide"}),quarter:g({values:ee,defaultWidth:"wide",argumentCallback:function(e){return e-1}}),month:g({values:te,defaultWidth:"wide"}),day:g({values:ne,defaultWidth:"wide"}),dayPeriod:g({values:ae,defaultWidth:"wide",formattingValues:re,defaultFormattingWidth:"wide"})},ue=oe;function p(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],s=a&&e.parsePatterns[a]||e.parsePatterns[e.defaultParseWidth],f=Array.isArray(s)?le(s,function(m){return m.test(o)}):se(s,function(m){return m.test(o)}),l;l=e.valueCallback?e.valueCallback(f):f,l=n.valueCallback?n.valueCallback(l):l;var u=t.slice(o.length);return{value:l,rest:u}}}function se(e,t){for(var n in e)if(e.hasOwnProperty(n)&&t(e[n]))return n}function le(e,t){for(var n=0;n<e.length;n++)if(t(e[n]))return n}function fe(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 s=t.slice(i.length);return{value:o,rest:s}}}var de=/^(\d+)(th|st|nd|rd)?/i,me=/\d+/i,ce={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},he={any:[/^b/i,/^(a|c)/i]},ve={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},ge={any:[/1/i,/2/i,/3/i,/4/i]},pe={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},Me={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]},be={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},we={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]},De={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},ye={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}},Te={ordinalNumber:fe({matchPattern:de,parsePattern:me,valueCallback:function(e){return parseInt(e,10)}}),era:p({matchPatterns:ce,defaultMatchWidth:"wide",parsePatterns:he,defaultParseWidth:"any"}),quarter:p({matchPatterns:ve,defaultMatchWidth:"wide",parsePatterns:ge,defaultParseWidth:"any",valueCallback:function(e){return e+1}}),month:p({matchPatterns:pe,defaultMatchWidth:"wide",parsePatterns:Me,defaultParseWidth:"any"}),day:p({matchPatterns:be,defaultMatchWidth:"wide",parsePatterns:we,defaultParseWidth:"any"}),dayPeriod:p({matchPatterns:De,defaultMatchWidth:"any",parsePatterns:ye,defaultParseWidth:"any"})},Se=Te,Ne={code:"en-US",formatDistance:L,formatLong:B,formatRelative:G,localize:ue,match:Se,options:{weekStartsOn:0,firstWeekContainsDate:1}},Pe=Ne;function We(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 Ie(e){return We({},e)}var W=1440,Ce=2520,y=43200,Oe=86400;function Ue(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};h(2,arguments);var a=n.locale||Pe;if(!a.formatDistance)throw new RangeError("locale must contain formatDistance property");var i=b(e,t);if(isNaN(i))throw new RangeError("Invalid time value");var r=Ie(n);r.addSuffix=Boolean(n.addSuffix),r.comparison=i;var o,s;i>0?(o=d(t),s=d(e)):(o=d(e),s=d(t));var f=X(s,o),l=(N(s)-N(o))/1e3,u=Math.round((f-l)/60),m;if(u<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):u===0?a.formatDistance("lessThanXMinutes",1,r):a.formatDistance("xMinutes",u,r);if(u<45)return a.formatDistance("xMinutes",u,r);if(u<90)return a.formatDistance("aboutXHours",1,r);if(u<W){var Ke=Math.round(u/60);return a.formatDistance("aboutXHours",Ke,r)}else{if(u<Ce)return a.formatDistance("xDays",1,r);if(u<y){var et=Math.round(u/W);return a.formatDistance("xDays",et,r)}else if(u<Oe)return m=Math.round(u/y),a.formatDistance("aboutXMonths",m,r)}if(m=R(s,o),m<12){var tt=Math.round(u/y);return a.formatDistance("xMonths",tt,r)}else{var U=m%12,S=Math.floor(m/12);return U<3?a.formatDistance("aboutXYears",S,r):U<9?a.formatDistance("overXYears",S,r):a.formatDistance("almostXYears",S+1,r)}}function xe(e,t){return h(1,arguments),Ue(e,Date.now(),t)}var I=36e5,C=6e4,Fe=2,w={dateTimeDelimiter:/[T ]/,timeZoneDelimiter:/[Z ]/i,timezone:/([Z+-].*)$/},_e=/^-?(?:(\d{3})|(\d{2})(?:-?(\d{2}))?|W(\d{2})(?:-?(\d{1}))?|)$/,Ae=/^(\d{2}(?:[.,]\d*)?)(?::?(\d{2}(?:[.,]\d*)?))?(?::?(\d{2}(?:[.,]\d*)?))?$/,ke=/^([+-])(\d{2})(?::?(\d{2}))?$/;function Ye(e,t){h(1,arguments);var n=t||{},a=n.additionalDigits==null?Fe: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=je(e),r;if(i.date){var o=Ee(i.date,a);r=Re(o.restDateString,o.year)}if(isNaN(r)||!r)return new Date(NaN);var s=r.getTime(),f=0,l;if(i.time&&(f=Xe(i.time),isNaN(f)||f===null))return new Date(NaN);if(i.timezone){if(l=qe(i.timezone),isNaN(l))return new Date(NaN)}else{var u=new Date(s+f),m=new Date(0);return m.setFullYear(u.getUTCFullYear(),u.getUTCMonth(),u.getUTCDate()),m.setHours(u.getUTCHours(),u.getUTCMinutes(),u.getUTCSeconds(),u.getUTCMilliseconds()),m}return new Date(s+f+l)}function je(e){var t={},n=e.split(w.dateTimeDelimiter),a;if(n.length>2)return t;if(/:/.test(n[0])?(t.date=null,a=n[0]):(t.date=n[0],a=n[1],w.timeZoneDelimiter.test(t.date)&&(t.date=e.split(w.timeZoneDelimiter)[0],a=e.substr(t.date.length,e.length))),a){var i=w.timezone.exec(a);i?(t.time=a.replace(i[1],""),t.timezone=i[1]):t.time=a}return t}function Ee(e,t){var n=new RegExp("^(?:(\\d{4}|[+-]\\d{"+(4+t)+"})|(\\d{2}|[+-]\\d{"+(2+t)+"})$)"),a=e.match(n);if(!a)return{year:null};var i=a[1]&&parseInt(a[1]),r=a[2]&&parseInt(a[2]);return{year:r==null?i:r*100,restDateString:e.slice((a[1]||a[2]).length)}}function Re(e,t){if(t===null)return null;var n=e.match(_e);if(!n)return null;var a=!!n[4],i=M(n[1]),r=M(n[2])-1,o=M(n[3]),s=M(n[4]),f=M(n[5])-1;if(a)return $e(t,s,f)?ze(t,s,f):new Date(NaN);var l=new Date(0);return!Ve(t,r,o)||!He(t,i)?new Date(NaN):(l.setUTCFullYear(t,r,Math.max(i,o)),l)}function M(e){return e?parseInt(e):1}function Xe(e){var t=e.match(Ae);if(!t)return null;var n=T(t[1]),a=T(t[2]),i=T(t[3]);return Je(n,a,i)?n*I+a*C+i*1e3:NaN}function T(e){return e&&parseFloat(e.replace(",","."))||0}function qe(e){if(e==="Z")return 0;var t=e.match(ke);if(!t)return 0;var n=t[1]==="+"?-1:1,a=parseInt(t[2]),i=t[3]&&parseInt(t[3])||0;return Be(a,i)?n*(a*I+i*C):NaN}function ze(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 Le=[31,null,31,30,31,30,31,31,30,31,30,31];function O(e){return e%400==0||e%4==0&&e%100}function Ve(e,t,n){return t>=0&&t<=11&&n>=1&&n<=(Le[t]||(O(e)?29:28))}function He(e,t){return t>=1&&t<=(O(e)?366:365)}function $e(e,t,n){return t>=1&&t<=53&&n>=0&&n<=6}function Je(e,t,n){return e===24?t===0&&n===0:n>=0&&n<60&&t>=0&&t<60&&e>=0&&e<25}function Be(e,t){return t>=0&&t<=59}var Qe=(e,t={},n)=>{typeof e=="string"&&(e=Ye(e));const{includeSeconds:a,addSuffix:i=!0}=t;return xe(e,{includeSeconds:a,addSuffix:i,locale:n})};const Ze=(e={})=>{const t=e.name||"Timeago";return c.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=c.ref();c.onBeforeMount(()=>{s()}),c.onBeforeUnmount(()=>{f()});const i=l=>(n.converter||Qe)(l||n.datetime,n.converterOptions||e.converterOptions,n.locale||e.locale),r=c.ref(i()),o=l=>{r.value=i(l)},s=()=>{if(n.autoUpdate){const l=n.autoUpdate===!0?60:n.autoUpdate;a.value=setInterval(()=>{o(n.datetime)},l*1e3)}},f=()=>{a.value&&(clearInterval(a.value),a.value=void 0)};return c.watch(()=>n.autoUpdate,l=>{f(),l&&s()}),c.watch(()=>[n.datetime,n.converter],()=>{o()}),c.watch(()=>n.converterOptions,()=>{o()},{deep:!0}),{timeago:r,updateTimer:a}},render(){return c.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 Ge=(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=Ze(t);e.component(a.name,a)};v.default=Ge,Object.defineProperty(v,"__esModule",{value:!0}),v[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 m(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=m(e),a=m(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=m(e),a=m(t),i=n.getFullYear()-a.getFullYear(),r=n.getMonth()-a.getMonth();return i*12+r}function L(e,t){return h(2,arguments),m(e).getTime()-m(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=m(e);return t.setHours(23,59,59,999),t}function J(e){h(1,arguments);var t=m(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=m(e);return $(t).getTime()===J(t).getTime()}function Z(e,t){h(2,arguments);var n=m(e),a=m(t),i=M(n,a),r=Math.abs(q(n,a)),u;if(r<1)u=0;else{n.getMonth()===1&&n.getDate()>27&&n.setDate(30),n.setMonth(n.getMonth()-i*r);var s=M(n,a)===-i;Q(m(e))&&r===1&&M(e,a)===1&&(s=!1),u=i*(r-Number(s))}return u===0?0:u}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 u=e.defaultFormattingWidth||e.defaultWidth,s=a.width?String(a.width):u;r=e.formattingValues[s]||e.formattingValues[u]}else{var f=e.defaultWidth,l=a.width?String(a.width):e.defaultWidth;r=e.values[l]||e.values[f]}var o=e.argumentCallback?e.argumentCallback(t):t;return r[o]}}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 u=r[0],s=a&&e.parsePatterns[a]||e.parsePatterns[e.defaultParseWidth],f=Array.isArray(s)?we(s,function(d){return d.test(u)}):Me(s,function(d){return d.test(u)}),l;l=e.valueCallback?e.valueCallback(f):f,l=n.valueCallback?n.valueCallback(l):l;var o=t.slice(u.length);return{value:l,rest:o}}}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 u=e.valueCallback?e.valueCallback(r[0]):r[0];u=n.valueCallback?n.valueCallback(u):u;var s=t.slice(i.length);return{value:u,rest:s}}}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 u,s;i>0?(u=m(t),s=m(e)):(u=m(e),s=m(t));var f=B(s,u),l=(T(s)-T(u))/1e3,o=Math.round((f-l)/60),d;if(o<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):o===0?a.formatDistance("lessThanXMinutes",1,r):a.formatDistance("xMinutes",o,r);if(o<45)return a.formatDistance("xMinutes",o,r);if(o<90)return a.formatDistance("aboutXHours",1,r);if(o<Y){var O=Math.round(o/60);return a.formatDistance("aboutXHours",O,r)}else{if(o<Re)return a.formatDistance("xDays",1,r);if(o<W){var p=Math.round(o/Y);return a.formatDistance("xDays",p,r)}else if(o<ke)return d=Math.round(o/W),a.formatDistance("aboutXMonths",d,r)}if(d=Z(s,u),d<12){var c=Math.round(o/W);return a.formatDistance("xMonths",c,r)}else{var P=d%12,y=Math.floor(d/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 u,s;i>0?(u=m(t),s=m(e)):(u=m(e),s=m(t));var f=n.roundingMethod==null?"round":String(n.roundingMethod),l;if(f==="floor")l=Math.floor;else if(f==="ceil")l=Math.ceil;else if(f==="round")l=Math.round;else throw new RangeError("roundingMethod must be 'floor', 'ceil' or 'round'");var o=s.getTime()-u.getTime(),d=o/R,O=T(s)-T(u),p=(o-O)/R,c;if(n.unit==null?d<1?c="second":d<60?c="minute":d<N?c="hour":p<k?c="day":p<A?c="month":c="year":c=String(n.unit),c==="second"){var P=l(o/1e3);return a.formatDistance("xSeconds",P,r)}else if(c==="minute"){var y=l(d);return a.formatDistance("xMinutes",y,r)}else if(c==="hour"){var st=l(d/60);return a.formatDistance("xHours",st,r)}else if(c==="day"){var lt=l(p/N);return a.formatDistance("xDays",lt,r)}else if(c==="month"){var j=l(p/k);return j===12&&n.unit!=="month"?a.formatDistance("xYears",1,r):a.formatDistance("xMonths",j,r)}else if(c==="year"){var ft=l(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 u=Je(i.date,a);r=Qe(u.restDateString,u.year)}if(!r||isNaN(r.getTime()))return new Date(NaN);var s=r.getTime(),f=0,l;if(i.time&&(f=Ze(i.time),isNaN(f)))return new Date(NaN);if(i.timezone){if(l=Be(i.timezone),isNaN(l))return new Date(NaN)}else{var o=new Date(s+f),d=new Date(0);return d.setFullYear(o.getUTCFullYear(),o.getUTCMonth(),o.getUTCDate()),d.setHours(o.getUTCHours(),o.getUTCMinutes(),o.getUTCSeconds(),o.getUTCMilliseconds()),d}return new Date(s+f+l)}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,u=D(n[3]),s=D(n[4]),f=D(n[5])-1;if(a)return nt(t,s,f)?Ke(t,s,f):new Date(NaN);var l=new Date(0);return!et(t,r,u)||!tt(t,i)?new Date(NaN):(l.setUTCFullYear(t,r,Math.max(i,u)),l)}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,{expose:a}){const i=v.ref();v.onBeforeMount(()=>{f()}),v.onBeforeUnmount(()=>{l()});const r=o=>(n.converter||it)(o||n.datetime,n.converterOptions||e.converterOptions,n.locale||e.locale),u=v.ref(r()),s=o=>{u.value=r(o)},f=()=>{if(n.autoUpdate){const o=n.autoUpdate===!0?60:n.autoUpdate;i.value=setInterval(()=>{s(n.datetime)},o*1e3)}},l=()=>{i.value&&(clearInterval(i.value),i.value=void 0)};return v.watch(()=>n.autoUpdate,o=>{l(),o&&f()}),v.watch(()=>[n.datetime,n.converter],()=>{s()}),v.watch(()=>n.converterOptions,()=>{s()},{deep:!0}),a({convert:s}),{timeago:u,updateTimer:i,convert:s}},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.1.2",
"version": "2.2.1-rc1",
"files": [

@@ -34,3 +34,4 @@ "dist"

"distance",
"time"
"time",
"front-end"
],

@@ -49,3 +50,3 @@ "scripts": {

"dependencies": {
"date-fns": "^2.27.0"
"date-fns": "^2.28.0"
},

@@ -56,24 +57,24 @@ "peerDependencies": {

"devDependencies": {
"@release-it/conventional-changelog": "^3.3.0",
"@types/jest": "^27.0.3",
"@types/node": "^16.11.11",
"@typescript-eslint/eslint-plugin": "^5.5.0",
"@typescript-eslint/parser": "^5.5.0",
"@vitejs/plugin-vue": "^1.10.1",
"@vue/compiler-sfc": "^3.2.23",
"@vue/test-utils": "^2.0.0-rc.17",
"eslint": "^8.3.0",
"eslint-config-prettier": "^8.3.0",
"eslint-plugin-vue": "^8.1.1",
"jest": "^27.4.2",
"prettier": "2.5.0",
"release-it": "^14.11.8",
"ts-jest": "^27.0.7",
"ts-node": "^10.4.0",
"typescript": "^4.5.2",
"vite": "^2.6.14",
"vitepress": "^0.20.1",
"vue-eslint-parser": "^8.0.1",
"vue-tsc": "^0.29.8"
"@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",
"eslint-config-prettier": "^8.5.0",
"eslint-plugin-vue": "^8.7.1",
"jest": "^27.5.1",
"prettier": "2.6.2",
"release-it": "^14.14.2",
"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"
}
}

@@ -94,8 +94,8 @@ # ⏳ 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 |
| 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 |

@@ -102,0 +102,0 @@ ### Component

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