Instead of my example value "15.04.2023", you could also use expression to reference incoming data as needed in case you need to make this dynamic. For example, if your date is coming through in a field named myDate, you could read it using an expression like this:
However, I am not quite sure how you are using this expression in a Switch node since it doesnât return the actual duration between two dates but a specific string. Perhaps you want to calculate an actual duration instead? In a workflow, this could look like so:
This example would calculate the days between today and whatever date youâre passing on to your switch node, then use the result for the routing decision.
Hope this helps! Let me know if you have any questions on the above
on the left data site, you can see the date format. This is a testdate but in the right format.
Now i need to test this testdate not against the real value of $today but against some other test date to simulate all switch case blocks easily.
How can i change the $today value so that i can test this configuration of nodes with testdata. I dont want to change the node configuration to test - just the values.
You could simply replace $today with DateTime.fromFormat("15.04.2023", "dd.MM.yyyy") if youâd like to test the 15th of April 2023 for example. This will work with any other test date as well of course
What i really mean is to keep the node configuration as is and create a test environement.
So i dont need to change the application (or the node configuration in this case) after i have tested the workflow.
For example: For the HTTP request node, i was able to replace the request URL variable in the .env file. So the app uses requests to localhost instead of the server that we need in production mode:
If you want to read your test date dynamically from an environment variable you could use the very same approach. Assuming your variable is called TEST_DATE and the format is dd.MM.yyyy, youâd need to replace $today with DateTime.fromFormat($env["TEST_DATE"], "dd.MM.yyyy") here.