@zauru-sdk/common 1.0.85 → 1.0.86
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 +8 -0
- package/dist/cjs/common.js +4 -2
- package/dist/common.d.ts +1 -1
- package/dist/esm/common.js +4 -2
- package/package.json +2 -2
- package/src/common.ts +6 -3
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,14 @@
|
|
|
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.86](https://github.com/intuitiva/zauru-typescript-sdk/compare/v1.0.85...v1.0.86) (2024-08-02)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @zauru-sdk/common
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
6
14
|
## [1.0.85](https://github.com/intuitiva/zauru-typescript-sdk/compare/v1.0.84...v1.0.85) (2024-08-02)
|
|
7
15
|
|
|
8
16
|
**Note:** Version bump only for package @zauru-sdk/common
|
package/dist/cjs/common.js
CHANGED
|
@@ -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;
|
package/dist/esm/common.js
CHANGED
|
@@ -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.
|
|
3
|
+
"version": "1.0.86",
|
|
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",
|
|
@@ -25,5 +25,5 @@
|
|
|
25
25
|
"moment": "^2.30.1",
|
|
26
26
|
"moment-timezone": "^0.5.45"
|
|
27
27
|
},
|
|
28
|
-
"gitHead": "
|
|
28
|
+
"gitHead": "8d882374100d308c1c07c996dd092e68ab9d44dd"
|
|
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
|
-
|
|
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
|
};
|