aziendasanitaria-utils 1.2.13 → 1.2.15
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/package.json +1 -1
- package/src/classi/Assistito.js +8 -4
package/package.json
CHANGED
package/src/classi/Assistito.js
CHANGED
|
@@ -212,7 +212,7 @@ export class Assistito {
|
|
|
212
212
|
const getValue = (data) => {
|
|
213
213
|
const value = data[campo];
|
|
214
214
|
// Controlla se il valore è una stringa vuota o null/undefined
|
|
215
|
-
return value === '' || value === null || value === undefined || (typeof value === 'number' && isNaN(value)) ? null : value;
|
|
215
|
+
return value === '' || value === null || value === undefined || (typeof value === 'number' && isNaN(value)) || (tipoDati[campo] === "date" && typeof value === "string" && value.toLowerCase().includes("illimi")) ? null : value;
|
|
216
216
|
};
|
|
217
217
|
|
|
218
218
|
return getValue(this.#dataFromTs) ??
|
|
@@ -351,7 +351,7 @@ export class Assistito {
|
|
|
351
351
|
|
|
352
352
|
eta(atDate = null) {
|
|
353
353
|
// using moments and consider the date of death if present
|
|
354
|
-
const dataNascita =
|
|
354
|
+
const dataNascita = moment(this.dataNascita, "DD/MM/YYYY");
|
|
355
355
|
const dataDecesso = moment(this.dataDecesso, "DD/MM/YYYY");
|
|
356
356
|
const dataRiferimento = atDate ? moment(atDate, "DD/MM/YYYY") : moment();
|
|
357
357
|
|
|
@@ -368,14 +368,18 @@ export class Assistito {
|
|
|
368
368
|
*
|
|
369
369
|
* @param {Object} [options={}] - Opzioni per la generazione dei dati.
|
|
370
370
|
* @param {boolean} [options.dateToUnix=this.#dateToUnix] - Se true, converte le date in formato Unix.
|
|
371
|
+
* @param {Object} [options.fromAssistitoObject=null] - Oggetto contenente i dati dell'assistito da inizializzare
|
|
371
372
|
* @returns {Object} Oggetto contenente i dati dell'assistito.
|
|
372
373
|
*/
|
|
373
374
|
dati(options = {}) {
|
|
374
|
-
const {
|
|
375
|
+
const {
|
|
376
|
+
dateToUnix = false,
|
|
377
|
+
fromAssistitoObject = null,
|
|
378
|
+
} = options;
|
|
375
379
|
|
|
376
380
|
let out = {
|
|
377
381
|
...Object.values(DATI).reduce((acc, key) => {
|
|
378
|
-
let value = this.#getDatoConFallback(key);
|
|
382
|
+
let value = (fromAssistitoObject && Object.keys(fromAssistitoObject).length>0) ? fromAssistitoObject[key] : this.#getDatoConFallback(key);
|
|
379
383
|
|
|
380
384
|
// Converti le date in Unix se richiesto
|
|
381
385
|
if (dateToUnix && tipoDati[key] === "date" && value && value !== "") {
|