Parse files and process them based on creation date

Hello everybody,
I have a nodered flow that allows me to grab files from an 'orders_json' folder, convert them to csv and drop them into an 'order_csv' folder.
For technical questions I cannot empty the files deposited progressively in my Json folder.
In my specific case, I would have to be able to parse only the files uploaded in the last 24 hours.

At the beginning of my flow with the node 'File Lister', I have the possibility of recovering the date of creation of the file.

The idea is to have this condition:
If the creation date of my file is between today's date (Ex: 11-05-23) and yesterday's date (Ex: 10-05-23) then I process my file. If not, I do not process my file.

I tried several ways, tests by creating a function or with a switch and an expression in JSONata. But I haven't found the solution yet.
I also watched some tutorials but they seem complex for a function that could be quite simple.

If any of you have a solution, I would greatly appreciate it.

Thank's a lot for your help

Alexandre

To make it easier to compare the dates consider using toLocaleString() or Moment.js to format them as in your examples:

if you only wish to go by date and not time.

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.