Skip to content

Commit

Permalink
fix(T247): Rimozione limite data SCD 20241111
Browse files Browse the repository at this point in the history
  • Loading branch information
lcucuzzella authored and sgravinadxc committed Nov 28, 2024
1 parent 6e30ff2 commit b24259a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 2 additions & 0 deletions fe-piattaforma/src/hooks/useFileProcessor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,7 @@ export function useFileProcessor(file: File | undefined, removeFile: () => void)
);
const errors = validateFields(
filteredRecord,
'csv',
isValidFiscalCode
);
checkMapValues(record, errors);
Expand Down Expand Up @@ -275,6 +276,7 @@ export function useFileProcessor(file: File | undefined, removeFile: () => void)
const { rejectedTypes } = generateServiceName(filteredRecord.SE3);
const errors = validateFields(
filteredRecord,
'xlsx',
isValidFiscalCode
);
checkMapValues(record, errors);
Expand Down
3 changes: 2 additions & 1 deletion fe-piattaforma/src/utils/csvUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ export function encryptDocumentAndDetermineType(

export const validateFields = (
record: CSVRecord,
extension: string,
validateFiscalCode: (fiscalCode: string) => boolean
): string[] => {
const errors: string[] = [];
Expand Down Expand Up @@ -142,7 +143,7 @@ export const validateFields = (
const parsedDate = new Date(record.SE1);
if(!isValidDateFormat(record.SE1) || !isValidDate(record.SE1)){ //valido tramite regex
errors.push("La data inserita per il servizio non e' valida.");
} else if (parsedDate > maxDate) {
} else if (parsedDate > maxDate && extension === 'csv') {
errors.push("La data del servizio e' successiva al 31 Ottobre 2024.");
}
}
Expand Down

0 comments on commit b24259a

Please sign in to comment.