Skip to content

Commit

Permalink
fix(n8n): fix SI PSI update date
Browse files Browse the repository at this point in the history
  • Loading branch information
cberthou committed Sep 23, 2021
1 parent 19ff5ad commit 23d54c8
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 4 deletions.
3 changes: 0 additions & 3 deletions src/n8n/nodes/SiPsi/SiPsiDownload.node.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,12 +62,9 @@ export class SiPsiDownload implements INodeType {
const otherYearFileRegex = new RegExp(`^${otherYearFile}$`, "i");
const { remoteFile: remoteFile2 } = await downloadOldestFile(client, bucket, otherYearFileRegex);

const date = getSiPsiFileDate(remoteFile1);

return [
this.helpers.returnJsonArray({
files: JSON.stringify([remoteFile1, remoteFile2]),
updateDate: date
})
];
}
Expand Down
2 changes: 1 addition & 1 deletion src/n8n/utils/siPsi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ const downloadRegex = new RegExp(`^ClientsPSI-([A-z]*)-([0-9]*)-([0-9]*)\\.csv$`

const getDateFromFilename = (filename: string) => downloadRegex.exec(filename);

const normalizeDate = (match: string[] | null) => match && match[3] ? format(parse(match[3], "ddMMyyyy", new Date()), "dd-MM-yyyy") : "";
const normalizeDate = (match: string[] | null) => match && match[3] ? format(parse(match[3], "ddMMyyyy", new Date()), "yyyy-MM-dd") : "";

export const getSiPsiFileDate =
pipe(
Expand Down

0 comments on commit 23d54c8

Please sign in to comment.