@zauru-sdk/common 1.0.69 → 1.0.71

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,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.71](https://github.com/intuitiva/zauru-typescript-sdk/compare/v1.0.70...v1.0.71) (2024-06-14)
7
+
8
+ **Note:** Version bump only for package @zauru-sdk/common
9
+
10
+
11
+
12
+
13
+
6
14
  ## [1.0.69](https://github.com/intuitiva/zauru-typescript-sdk/compare/v1.0.68...v1.0.69) (2024-05-30)
7
15
 
8
16
  **Note:** Version bump only for package @zauru-sdk/common
@@ -283,16 +283,23 @@ const getPayeeInfoOptions = (payees) => {
283
283
  });
284
284
  };
285
285
  exports.getPayeeInfoOptions = getPayeeInfoOptions;
286
- const parsedBaculoFormValue = (value) => {
286
+ const parsedBaculoFormValue = (value, config = {
287
+ falseValue: "No",
288
+ trueValue: "Si",
289
+ }) => {
287
290
  if (value === "false") {
288
- return "No";
291
+ return config.falseValue;
289
292
  }
290
293
  else if (value === "true") {
291
- return "Si";
294
+ return config.trueValue;
292
295
  }
293
296
  else if (exports.DESTINOS_MUESTRA_OPTIONS.some((x) => x.value === value)) {
294
297
  return exports.DESTINOS_MUESTRA_OPTIONS.find((x) => x.value === value)?.label;
295
298
  }
299
+ else if ((0, moment_1.default)(value, "YYYY-MM-DD", true).isValid()) {
300
+ // Valida y convierte la fecha
301
+ return (0, moment_1.default)(value).format("DD/MM/YYYY");
302
+ }
296
303
  return capitalLetter(value);
297
304
  };
298
305
  exports.parsedBaculoFormValue = parsedBaculoFormValue;
package/dist/common.d.ts CHANGED
@@ -83,7 +83,10 @@ export declare const getPayeeInfoIdOptions: (payees: PayeeGraphQL[]) => (SelectF
83
83
  export declare const getPayeeInfoOptions: (payees: PayeeGraphQL[]) => (SelectFieldOption & {
84
84
  id: number;
85
85
  })[];
86
- export declare const parsedBaculoFormValue: (value: any) => string | undefined;
86
+ export declare const parsedBaculoFormValue: (value: any, config?: {
87
+ trueValue: string;
88
+ falseValue: string;
89
+ }) => string | undefined;
87
90
  export declare function extractIdFromForm(s: string): number | null;
88
91
  /**
89
92
  * Formatea una fecha de tipo YYYY-MM-DD a 2023-08-07T20:56:00.540245
@@ -283,16 +283,23 @@ const getPayeeInfoOptions = (payees) => {
283
283
  });
284
284
  };
285
285
  exports.getPayeeInfoOptions = getPayeeInfoOptions;
286
- const parsedBaculoFormValue = (value) => {
286
+ const parsedBaculoFormValue = (value, config = {
287
+ falseValue: "No",
288
+ trueValue: "Si",
289
+ }) => {
287
290
  if (value === "false") {
288
- return "No";
291
+ return config.falseValue;
289
292
  }
290
293
  else if (value === "true") {
291
- return "Si";
294
+ return config.trueValue;
292
295
  }
293
296
  else if (exports.DESTINOS_MUESTRA_OPTIONS.some((x) => x.value === value)) {
294
297
  return exports.DESTINOS_MUESTRA_OPTIONS.find((x) => x.value === value)?.label;
295
298
  }
299
+ else if ((0, moment_1.default)(value, "YYYY-MM-DD", true).isValid()) {
300
+ // Valida y convierte la fecha
301
+ return (0, moment_1.default)(value).format("DD/MM/YYYY");
302
+ }
296
303
  return capitalLetter(value);
297
304
  };
298
305
  exports.parsedBaculoFormValue = parsedBaculoFormValue;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zauru-sdk/common",
3
- "version": "1.0.69",
3
+ "version": "1.0.71",
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": "46dd382e956e8b34c2a65ef078d8fddb2cdd434c"
28
+ "gitHead": "14735e4cb251cbbb8484920003e813b1da124663"
29
29
  }
package/src/common.ts CHANGED
@@ -326,13 +326,22 @@ export const getPayeeInfoOptions = (
326
326
  });
327
327
  };
328
328
 
329
- export const parsedBaculoFormValue = (value: any) => {
329
+ export const parsedBaculoFormValue = (
330
+ value: any,
331
+ config: { trueValue: string; falseValue: string } = {
332
+ falseValue: "No",
333
+ trueValue: "Si",
334
+ }
335
+ ) => {
330
336
  if (value === "false") {
331
- return "No";
337
+ return config.falseValue;
332
338
  } else if (value === "true") {
333
- return "Si";
339
+ return config.trueValue;
334
340
  } else if (DESTINOS_MUESTRA_OPTIONS.some((x) => x.value === value)) {
335
341
  return DESTINOS_MUESTRA_OPTIONS.find((x) => x.value === value)?.label;
342
+ } else if (moment(value, "YYYY-MM-DD", true).isValid()) {
343
+ // Valida y convierte la fecha
344
+ return moment(value).format("DD/MM/YYYY");
336
345
  }
337
346
 
338
347
  return capitalLetter(value);