@zauru-sdk/common 2.0.75 → 2.0.78

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/CHANGELOG.md CHANGED
@@ -3,6 +3,22 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## [2.0.78](https://github.com/intuitiva/zauru-typescript-sdk/compare/v2.0.77...v2.0.78) (2024-12-17)
7
+
8
+ **Note:** Version bump only for package @zauru-sdk/common
9
+
10
+
11
+
12
+
13
+
14
+ ## [2.0.77](https://github.com/intuitiva/zauru-typescript-sdk/compare/v2.0.76...v2.0.77) (2024-12-13)
15
+
16
+ **Note:** Version bump only for package @zauru-sdk/common
17
+
18
+
19
+
20
+
21
+
6
22
  ## [2.0.75](https://github.com/intuitiva/zauru-typescript-sdk/compare/v2.0.74...v2.0.75) (2024-12-11)
7
23
 
8
24
  **Note:** Version bump only for package @zauru-sdk/common
@@ -347,11 +347,18 @@ const getFormattedDate = (dateString, withHours = true) => {
347
347
  let date;
348
348
  if (dateString) {
349
349
  // Detectar el formato de la fecha
350
- if (/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}/.test(dateString)) {
351
- // Formato ISO (UTC)
352
- date = new Date(dateString);
353
- // Ajustar a la hora local
354
- date = new Date(date.getTime() - date.getTimezoneOffset() * 60000);
350
+ if (/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(\.\d+)?Z?$/.test(dateString)) {
351
+ // Formato ISO (UTC o local)
352
+ if (dateString.endsWith("Z")) {
353
+ // ISO con UTC (Z)
354
+ date = new Date(dateString); // El constructor ya maneja UTC
355
+ }
356
+ else {
357
+ // ISO sin UTC (hora local)
358
+ date = new Date(dateString);
359
+ // Ajustar a la hora local
360
+ date = new Date(date.getTime() - date.getTimezoneOffset() * 60000);
361
+ }
355
362
  }
356
363
  else if (/^\d{4}-\d{2}-\d{2}$/.test(dateString)) {
357
364
  // Formato YYYY-MM-DD
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zauru-sdk/common",
3
- "version": "2.0.75",
3
+ "version": "2.0.78",
4
4
  "description": "Funciones de uso común en el desarrollo de webapps en Zauru",
5
5
  "main": "./dist/esm/index.js",
6
6
  "module": "./dist/esm/index.js",
@@ -20,9 +20,9 @@
20
20
  },
21
21
  "dependencies": {
22
22
  "@remix-run/node": "^2.8.1",
23
- "@zauru-sdk/types": "^2.0.70",
23
+ "@zauru-sdk/types": "^2.0.78",
24
24
  "moment": "^2.30.1",
25
25
  "moment-timezone": "^0.5.45"
26
26
  },
27
- "gitHead": "dae59deee8ae0ab2dc88da53987850842bcec008"
27
+ "gitHead": "3fa94199738bbc2e4144bd618bc85eb12bae2925"
28
28
  }
package/src/common.ts CHANGED
@@ -389,11 +389,17 @@ export const getFormattedDate = (
389
389
 
390
390
  if (dateString) {
391
391
  // Detectar el formato de la fecha
392
- if (/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}/.test(dateString)) {
393
- // Formato ISO (UTC)
394
- date = new Date(dateString);
395
- // Ajustar a la hora local
396
- date = new Date(date.getTime() - date.getTimezoneOffset() * 60000);
392
+ if (/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(\.\d+)?Z?$/.test(dateString)) {
393
+ // Formato ISO (UTC o local)
394
+ if (dateString.endsWith("Z")) {
395
+ // ISO con UTC (Z)
396
+ date = new Date(dateString); // El constructor ya maneja UTC
397
+ } else {
398
+ // ISO sin UTC (hora local)
399
+ date = new Date(dateString);
400
+ // Ajustar a la hora local
401
+ date = new Date(date.getTime() - date.getTimezoneOffset() * 60000);
402
+ }
397
403
  } else if (/^\d{4}-\d{2}-\d{2}$/.test(dateString)) {
398
404
  // Formato YYYY-MM-DD
399
405
  date = new Date(`${dateString}T00:00:00`); // Hora local