@greatapps/common 1.1.603 → 1.1.604

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.
@@ -1,10 +1,10 @@
1
1
  function formatShortDate(date) {
2
2
  if (!date) return "--";
3
3
  const d = new Date(date);
4
- const day = String(d.getDate()).padStart(2, "0");
5
- const month = String(d.getMonth() + 1).padStart(2, "0");
6
- if (d.getFullYear() !== (/* @__PURE__ */ new Date()).getFullYear()) {
7
- return `${day}/${month}/${d.getFullYear()}`;
4
+ const day = String(d.getUTCDate()).padStart(2, "0");
5
+ const month = String(d.getUTCMonth() + 1).padStart(2, "0");
6
+ if (d.getUTCFullYear() !== (/* @__PURE__ */ new Date()).getUTCFullYear()) {
7
+ return `${day}/${month}/${d.getUTCFullYear()}`;
8
8
  }
9
9
  return `${day}/${month}`;
10
10
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/infra/utils/date.ts"],"sourcesContent":["export function formatShortDate(date: Date | string | null | undefined): string {\n if (!date) return '--';\n const d = new Date(date);\n const day = String(d.getDate()).padStart(2, '0');\n const month = String(d.getMonth() + 1).padStart(2, '0');\n if (d.getFullYear() !== new Date().getFullYear()) {\n return `${day}/${month}/${d.getFullYear()}`;\n }\n return `${day}/${month}`;\n}\n\nexport function formatDateTime(date: Date | string | null | undefined): string | null {\n if (!date) return null;\n return new Date(date).toLocaleString('pt-BR', {\n day: '2-digit',\n month: '2-digit',\n year: 'numeric',\n hour: '2-digit',\n minute: '2-digit',\n });\n}\n"],"mappings":"AAAO,SAAS,gBAAgB,MAAgD;AAC9E,MAAI,CAAC,KAAM,QAAO;AAClB,QAAM,IAAI,IAAI,KAAK,IAAI;AACvB,QAAM,MAAM,OAAO,EAAE,QAAQ,CAAC,EAAE,SAAS,GAAG,GAAG;AAC/C,QAAM,QAAQ,OAAO,EAAE,SAAS,IAAI,CAAC,EAAE,SAAS,GAAG,GAAG;AACtD,MAAI,EAAE,YAAY,OAAM,oBAAI,KAAK,GAAE,YAAY,GAAG;AAChD,WAAO,GAAG,GAAG,IAAI,KAAK,IAAI,EAAE,YAAY,CAAC;AAAA,EAC3C;AACA,SAAO,GAAG,GAAG,IAAI,KAAK;AACxB;AAEO,SAAS,eAAe,MAAuD;AACpF,MAAI,CAAC,KAAM,QAAO;AAClB,SAAO,IAAI,KAAK,IAAI,EAAE,eAAe,SAAS;AAAA,IAC5C,KAAK;AAAA,IACL,OAAO;AAAA,IACP,MAAM;AAAA,IACN,MAAM;AAAA,IACN,QAAQ;AAAA,EACV,CAAC;AACH;","names":[]}
1
+ {"version":3,"sources":["../../../src/infra/utils/date.ts"],"sourcesContent":["export function formatShortDate(date: Date | string | null | undefined): string {\n if (!date) return '--';\n const d = new Date(date);\n const day = String(d.getUTCDate()).padStart(2, '0');\n const month = String(d.getUTCMonth() + 1).padStart(2, '0');\n if (d.getUTCFullYear() !== new Date().getUTCFullYear()) {\n return `${day}/${month}/${d.getUTCFullYear()}`;\n }\n return `${day}/${month}`;\n}\n\nexport function formatDateTime(date: Date | string | null | undefined): string | null {\n if (!date) return null;\n return new Date(date).toLocaleString('pt-BR', {\n day: '2-digit',\n month: '2-digit',\n year: 'numeric',\n hour: '2-digit',\n minute: '2-digit',\n });\n}\n"],"mappings":"AAAO,SAAS,gBAAgB,MAAgD;AAC9E,MAAI,CAAC,KAAM,QAAO;AAClB,QAAM,IAAI,IAAI,KAAK,IAAI;AACvB,QAAM,MAAM,OAAO,EAAE,WAAW,CAAC,EAAE,SAAS,GAAG,GAAG;AAClD,QAAM,QAAQ,OAAO,EAAE,YAAY,IAAI,CAAC,EAAE,SAAS,GAAG,GAAG;AACzD,MAAI,EAAE,eAAe,OAAM,oBAAI,KAAK,GAAE,eAAe,GAAG;AACtD,WAAO,GAAG,GAAG,IAAI,KAAK,IAAI,EAAE,eAAe,CAAC;AAAA,EAC9C;AACA,SAAO,GAAG,GAAG,IAAI,KAAK;AACxB;AAEO,SAAS,eAAe,MAAuD;AACpF,MAAI,CAAC,KAAM,QAAO;AAClB,SAAO,IAAI,KAAK,IAAI,EAAE,eAAe,SAAS;AAAA,IAC5C,KAAK;AAAA,IACL,OAAO;AAAA,IACP,MAAM;AAAA,IACN,MAAM;AAAA,IACN,QAAQ;AAAA,EACV,CAAC;AACH;","names":[]}
@@ -2,8 +2,8 @@ const GRACE_PERIOD_DAYS = 15;
2
2
  function hasSubscriptionExpired(dateDue) {
3
3
  if (!dateDue) return false;
4
4
  const dueDate = new Date(dateDue);
5
- dueDate.setDate(dueDate.getDate() + GRACE_PERIOD_DAYS);
6
- dueDate.setHours(23, 59, 59, 999);
5
+ dueDate.setUTCDate(dueDate.getUTCDate() + GRACE_PERIOD_DAYS);
6
+ dueDate.setUTCHours(23, 59, 59, 999);
7
7
  return Date.now() > dueDate.getTime();
8
8
  }
9
9
  export {
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/modules/subscriptions/utils/has-subscription-expired.ts"],"sourcesContent":["const GRACE_PERIOD_DAYS = 15;\n\nexport function hasSubscriptionExpired(dateDue: Date | null | undefined) {\n if (!dateDue) return false;\n\n const dueDate = new Date(dateDue);\n dueDate.setDate(dueDate.getDate() + GRACE_PERIOD_DAYS);\n dueDate.setHours(23, 59, 59, 999);\n\n return Date.now() > dueDate.getTime();\n}\n"],"mappings":"AAAA,MAAM,oBAAoB;AAEnB,SAAS,uBAAuB,SAAkC;AACvE,MAAI,CAAC,QAAS,QAAO;AAErB,QAAM,UAAU,IAAI,KAAK,OAAO;AAChC,UAAQ,QAAQ,QAAQ,QAAQ,IAAI,iBAAiB;AACrD,UAAQ,SAAS,IAAI,IAAI,IAAI,GAAG;AAEhC,SAAO,KAAK,IAAI,IAAI,QAAQ,QAAQ;AACtC;","names":[]}
1
+ {"version":3,"sources":["../../../../src/modules/subscriptions/utils/has-subscription-expired.ts"],"sourcesContent":["const GRACE_PERIOD_DAYS = 15;\n\nexport function hasSubscriptionExpired(dateDue: Date | null | undefined) {\n if (!dateDue) return false;\n\n const dueDate = new Date(dateDue);\n dueDate.setUTCDate(dueDate.getUTCDate() + GRACE_PERIOD_DAYS);\n dueDate.setUTCHours(23, 59, 59, 999);\n\n return Date.now() > dueDate.getTime();\n}\n"],"mappings":"AAAA,MAAM,oBAAoB;AAEnB,SAAS,uBAAuB,SAAkC;AACvE,MAAI,CAAC,QAAS,QAAO;AAErB,QAAM,UAAU,IAAI,KAAK,OAAO;AAChC,UAAQ,WAAW,QAAQ,WAAW,IAAI,iBAAiB;AAC3D,UAAQ,YAAY,IAAI,IAAI,IAAI,GAAG;AAEnC,SAAO,KAAK,IAAI,IAAI,QAAQ,QAAQ;AACtC;","names":[]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@greatapps/common",
3
- "version": "1.1.603",
3
+ "version": "1.1.604",
4
4
  "description": "Shared library for GreatApps frontend applications",
5
5
  "main": "./dist/index.mjs",
6
6
  "types": "./src/index.ts",
@@ -1,10 +1,10 @@
1
1
  export function formatShortDate(date: Date | string | null | undefined): string {
2
2
  if (!date) return '--';
3
3
  const d = new Date(date);
4
- const day = String(d.getDate()).padStart(2, '0');
5
- const month = String(d.getMonth() + 1).padStart(2, '0');
6
- if (d.getFullYear() !== new Date().getFullYear()) {
7
- return `${day}/${month}/${d.getFullYear()}`;
4
+ const day = String(d.getUTCDate()).padStart(2, '0');
5
+ const month = String(d.getUTCMonth() + 1).padStart(2, '0');
6
+ if (d.getUTCFullYear() !== new Date().getUTCFullYear()) {
7
+ return `${day}/${month}/${d.getUTCFullYear()}`;
8
8
  }
9
9
  return `${day}/${month}`;
10
10
  }
@@ -4,8 +4,8 @@ export function hasSubscriptionExpired(dateDue: Date | null | undefined) {
4
4
  if (!dateDue) return false;
5
5
 
6
6
  const dueDate = new Date(dateDue);
7
- dueDate.setDate(dueDate.getDate() + GRACE_PERIOD_DAYS);
8
- dueDate.setHours(23, 59, 59, 999);
7
+ dueDate.setUTCDate(dueDate.getUTCDate() + GRACE_PERIOD_DAYS);
8
+ dueDate.setUTCHours(23, 59, 59, 999);
9
9
 
10
10
  return Date.now() > dueDate.getTime();
11
11
  }