@vestcards/shared 1.0.2 → 1.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/date.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const m=require("date-fns/locale"),o=require("date-fns"),s=require("date-fns-tz"),a=m.ptBR,u="America/Sao_Paulo";function n(e){return e instanceof Date?e:typeof e=="number"?new Date(e):typeof e=="string"?o.parseISO(e):e}function T(e,t=new Date,r){return o.formatDistance(n(e),n(t),{locale:a,...r})}function d(e,t){return o.formatDistanceToNow(n(e),{locale:a,...t})}function w(e,t,r){return o.format(n(e),t,{locale:a,...r})}function p(e,t=new Date,r){return o.formatRelative(n(e),n(t),{locale:a,...r})}function R(e,t,r=u){const c=s.toZonedTime(n(e),r);return o.format(c,t,{locale:a})}const y=e=>{const t=new Date,r=o.differenceInMinutes(e,t);if(r<1)return"<1m";if(r<10)return`<${Math.ceil(r/10)*10}m`;if(o.differenceInHours(e,t)<1)return"<1h";const i=o.differenceInDays(e,t);if(i<1)return"<1d";if(i<7)return`${i}d`;const f=o.differenceInMonths(e,t);return f<1?`${Math.ceil(i/30)}M`:f<12?`${f}M`:`${o.differenceInYears(e,t)}y`};function b(e,t=new Date,r="às",c=u){const i=s.toZonedTime(n(e),c),f=s.toZonedTime(n(t),c),l=o.formatRelative(i,f,{locale:a}).replace(/às/g,r);return`${l.charAt(0).toUpperCase()}${l.slice(1)}`}function O(e,t){const r=s.toZonedTime(n(e),u);return o.formatDistanceToNow(r,{locale:m.ptBR,...t})}exports.DEFAULT_LOCALE=a;exports.DEFAULT_TZ=u;exports.format=w;exports.formatDateTZ=R;exports.formatDistance=T;exports.formatDistanceToNow=d;exports.formatRelative=p;exports.formatRelativeDate=b;exports.formatRelativeDateToNow=O;exports.formatRelativeReviewDate=y;exports.toDate=n;Object.keys(o).forEach(e=>{e!=="default"&&!Object.prototype.hasOwnProperty.call(exports,e)&&Object.defineProperty(exports,e,{enumerable:!0,get:()=>o[e]})});
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const m=require("date-fns/locale"),o=require("date-fns"),s=require("date-fns-tz"),a=m.ptBR,u="America/Sao_Paulo";function n(e){return e instanceof Date?e:typeof e=="number"?new Date(e):typeof e=="string"?o.parseISO(e):e}function d(e,t=new Date,r){return o.formatDistance(n(e),n(t),{locale:a,...r})}function w(e,t){return o.formatDistanceToNow(n(e),{locale:a,...t})}function D(e,t,r){return o.format(n(e),t,{locale:a,...r})}function p(e,t=new Date,r){return o.formatRelative(n(e),n(t),{locale:a,...r})}function R(e,t,r=u){const c=s.toZonedTime(n(e),r);return D(c,t,{locale:a})}const y=e=>{const t=new Date,r=o.differenceInMinutes(e,t);if(r<1)return"<1m";if(r<10)return`<${Math.ceil(r/10)*10}m`;if(o.differenceInHours(e,t)<1)return"<1h";const i=o.differenceInDays(e,t);if(i<1)return"<1d";if(i<7)return`${i}d`;const f=o.differenceInMonths(e,t);return f<1?`${Math.ceil(i/30)}M`:f<12?`${f}M`:`${o.differenceInYears(e,t)}y`};function b(e,t=new Date,r="às",c=u){const i=s.toZonedTime(n(e),c),f=s.toZonedTime(n(t),c),l=o.formatRelative(i,f,{locale:a}).replace(/às/g,r);return`${l.charAt(0).toUpperCase()}${l.slice(1)}`}function O(e,t){const r=s.toZonedTime(n(e),u);return o.formatDistanceToNow(r,{locale:m.ptBR,...t})}exports.DEFAULT_LOCALE=a;exports.DEFAULT_TZ=u;exports.format=D;exports.formatDateTZ=R;exports.formatDistance=d;exports.formatDistanceToNow=w;exports.formatRelative=p;exports.formatRelativeDate=b;exports.formatRelativeDateToNow=O;exports.formatRelativeReviewDate=y;exports.toDate=n;Object.keys(o).forEach(e=>{e!=="default"&&!Object.prototype.hasOwnProperty.call(exports,e)&&Object.defineProperty(exports,e,{enumerable:!0,get:()=>o[e]})});
package/dist/date.js CHANGED
@@ -1,38 +1,38 @@
1
1
  import { ptBR as u } from "date-fns/locale";
2
- import { parseISO as $, format as l, formatDistance as h, formatDistanceToNow as D, formatRelative as p, differenceInMinutes as T, differenceInHours as d, differenceInDays as R, differenceInMonths as y, differenceInYears as b } from "date-fns";
2
+ import { parseISO as w, format as $, formatDistance as h, formatDistanceToNow as l, formatRelative as D, differenceInMinutes as T, differenceInHours as d, differenceInDays as R, differenceInMonths as y, differenceInYears as b } from "date-fns";
3
3
  export * from "date-fns";
4
4
  import { toZonedTime as c } from "date-fns-tz";
5
5
  const a = u, s = "America/Sao_Paulo";
6
6
  function n(t) {
7
- return t instanceof Date ? t : typeof t == "number" ? new Date(t) : typeof t == "string" ? $(t) : t;
7
+ return t instanceof Date ? t : typeof t == "number" ? new Date(t) : typeof t == "string" ? w(t) : t;
8
8
  }
9
- function A(t, e = /* @__PURE__ */ new Date(), r) {
9
+ function j(t, e = /* @__PURE__ */ new Date(), r) {
10
10
  return h(n(t), n(e), {
11
11
  locale: a,
12
12
  ...r
13
13
  });
14
14
  }
15
- function j(t, e) {
16
- return D(n(t), {
15
+ function L(t, e) {
16
+ return l(n(t), {
17
17
  locale: a,
18
18
  ...e
19
19
  });
20
20
  }
21
- function L(t, e, r) {
22
- return l(n(t), e, {
21
+ function I(t, e, r) {
22
+ return $(n(t), e, {
23
23
  locale: a,
24
24
  ...r
25
25
  });
26
26
  }
27
27
  function N(t, e = /* @__PURE__ */ new Date(), r) {
28
- return p(n(t), n(e), {
28
+ return D(n(t), n(e), {
29
29
  locale: a,
30
30
  ...r
31
31
  });
32
32
  }
33
33
  function v(t, e, r = s) {
34
34
  const f = c(n(t), r);
35
- return l(f, e, {
35
+ return I(f, e, {
36
36
  locale: a
37
37
  });
38
38
  }
@@ -48,22 +48,22 @@ const E = (t) => {
48
48
  return i < 1 ? `${Math.ceil(o / 30)}M` : i < 12 ? `${i}M` : `${b(t, e)}y`;
49
49
  };
50
50
  function S(t, e = /* @__PURE__ */ new Date(), r = "às", f = s) {
51
- const o = c(n(t), f), i = c(n(e), f), m = p(o, i, {
51
+ const o = c(n(t), f), i = c(n(e), f), m = D(o, i, {
52
52
  locale: a
53
53
  }).replace(/às/g, r);
54
54
  return `${m.charAt(0).toUpperCase()}${m.slice(1)}`;
55
55
  }
56
56
  function U(t, e) {
57
57
  const r = c(n(t), s);
58
- return D(r, { locale: u, ...e });
58
+ return l(r, { locale: u, ...e });
59
59
  }
60
60
  export {
61
61
  a as DEFAULT_LOCALE,
62
62
  s as DEFAULT_TZ,
63
- L as format,
63
+ I as format,
64
64
  v as formatDateTZ,
65
- A as formatDistance,
66
- j as formatDistanceToNow,
65
+ j as formatDistance,
66
+ L as formatDistanceToNow,
67
67
  N as formatRelative,
68
68
  S as formatRelativeDate,
69
69
  U as formatRelativeDateToNow,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vestcards/shared",
3
- "version": "1.0.2",
3
+ "version": "1.0.3",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "exports": {