I want to use services to generate a PDF once every month. The date is dependent on user input. For example, one user can write in a text field that it wants the PDF every month on the 6th.
How can I build a cron expression based on the input? As I see it now, cron expressions can only be hard coded.
Hi @SinanMaric, this is an interesting question that touches both on vanilla JavaScript and on Create specifics There are surely several ways to achieve it and the best implementation will depend on how much flexibility your users will get when setting up their preferences.
Assuming that you store information about when a PDF should be generated as a datetime property, you could have a service running daily and checking if the PDF generation date === Date Today. This way you work your way around cron expressions altogether.
An alternative would be converting a Date object into a cron expression with a JS function which could look something like that: