@zauru-sdk/common 1.0.85 → 1.0.88

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
+ ## [1.0.88](https://github.com/intuitiva/zauru-typescript-sdk/compare/v1.0.87...v1.0.88) (2024-08-29)
7
+
8
+ **Note:** Version bump only for package @zauru-sdk/common
9
+
10
+
11
+
12
+
13
+
14
+ ## [1.0.86](https://github.com/intuitiva/zauru-typescript-sdk/compare/v1.0.85...v1.0.86) (2024-08-02)
15
+
16
+ **Note:** Version bump only for package @zauru-sdk/common
17
+
18
+
19
+
20
+
21
+
6
22
  ## [1.0.85](https://github.com/intuitiva/zauru-typescript-sdk/compare/v1.0.84...v1.0.85) (2024-08-02)
7
23
 
8
24
  **Note:** Version bump only for package @zauru-sdk/common
@@ -332,7 +332,7 @@ function formatDateToUTC(dateString) {
332
332
  }
333
333
  exports.formatDateToUTC = formatDateToUTC;
334
334
  // Función para obtener la fecha formateada en español
335
- const getFormattedDate = (dateString) => {
335
+ const getFormattedDate = (dateString, utc = false) => {
336
336
  const now = dateString ? new Date(dateString) : new Date();
337
337
  const options = {
338
338
  weekday: "long",
@@ -342,8 +342,10 @@ const getFormattedDate = (dateString) => {
342
342
  hour: "numeric",
343
343
  minute: "numeric",
344
344
  hour12: false,
345
- timeZone: "UTC",
346
345
  };
346
+ if (utc) {
347
+ options["timeZone"] = "UTC";
348
+ }
347
349
  return new Intl.DateTimeFormat("es-ES", options).format(now);
348
350
  };
349
351
  exports.getFormattedDate = getFormattedDate;
package/dist/common.d.ts CHANGED
@@ -94,7 +94,7 @@ export declare function extractIdFromForm(s: string): number | null;
94
94
  * @returns
95
95
  */
96
96
  export declare function formatDateToUTC(dateString: string): string;
97
- export declare const getFormattedDate: (dateString?: string) => string;
97
+ export declare const getFormattedDate: (dateString?: string, utc?: boolean) => string;
98
98
  export declare const formatDateToDatePicker: (date: Date) => string;
99
99
  export declare const formatTimeToTimePicker: (timeString: string) => Date;
100
100
  export declare const toFixedIfNeeded: (value: number) => string;
@@ -332,7 +332,7 @@ function formatDateToUTC(dateString) {
332
332
  }
333
333
  exports.formatDateToUTC = formatDateToUTC;
334
334
  // Función para obtener la fecha formateada en español
335
- const getFormattedDate = (dateString) => {
335
+ const getFormattedDate = (dateString, utc = false) => {
336
336
  const now = dateString ? new Date(dateString) : new Date();
337
337
  const options = {
338
338
  weekday: "long",
@@ -342,8 +342,10 @@ const getFormattedDate = (dateString) => {
342
342
  hour: "numeric",
343
343
  minute: "numeric",
344
344
  hour12: false,
345
- timeZone: "UTC",
346
345
  };
346
+ if (utc) {
347
+ options["timeZone"] = "UTC";
348
+ }
347
349
  return new Intl.DateTimeFormat("es-ES", options).format(now);
348
350
  };
349
351
  exports.getFormattedDate = getFormattedDate;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zauru-sdk/common",
3
- "version": "1.0.85",
3
+ "version": "1.0.88",
4
4
  "description": "Funciones de uso común en el desarrollo de webapps en Zauru",
5
5
  "main": "./dist/cjs/index.js",
6
6
  "module": "./dist/esm/index.js",
@@ -21,9 +21,9 @@
21
21
  },
22
22
  "dependencies": {
23
23
  "@remix-run/node": "^2.8.1",
24
- "@zauru-sdk/types": "^1.0.84",
24
+ "@zauru-sdk/types": "^1.0.88",
25
25
  "moment": "^2.30.1",
26
26
  "moment-timezone": "^0.5.45"
27
27
  },
28
- "gitHead": "c7e7996e55df499512587555e89f4602b35d0b5d"
28
+ "gitHead": "353e46a3cbd7087e8a09c5489b8e66baf71a027b"
29
29
  }
package/src/common.ts CHANGED
@@ -383,7 +383,7 @@ export function formatDateToUTC(dateString: string): string {
383
383
  }
384
384
 
385
385
  // Función para obtener la fecha formateada en español
386
- export const getFormattedDate = (dateString?: string) => {
386
+ export const getFormattedDate = (dateString?: string, utc: boolean = false) => {
387
387
  const now = dateString ? new Date(dateString) : new Date();
388
388
  const options = {
389
389
  weekday: "long",
@@ -393,8 +393,11 @@ export const getFormattedDate = (dateString?: string) => {
393
393
  hour: "numeric",
394
394
  minute: "numeric",
395
395
  hour12: false,
396
- timeZone: "UTC",
397
- };
396
+ } as any;
397
+
398
+ if (utc) {
399
+ options["timeZone"] = "UTC";
400
+ }
398
401
 
399
402
  return new Intl.DateTimeFormat("es-ES", options as any).format(now);
400
403
  };