Now at a later point in the same workflow, I try to format the date for display purposes, depending on conversation language, so there’s multiple branches doing a different formatting each. Since event_start is a Date (tried Datetime as well), I assumed I can use a Format data step like this:
But this step fails when the workflow runs. Its kinda hard to debug, because the log just says “Action failed” without any more details. I assume that somehow the format of event_start does not match the expectations of the Format data step.
Before I now replace the Format data step by another custom code, I would be curious whether I’m doing something wrong or whether this is indeed not possible this way
It looks like you’re encountering an issue with formatting a date in your workflow. Ensure that the date format returned by your custom code matches the expected format for the Format data step. The Format data step might require a specific date format (e.g., ISO 8601).
I worked around it with custom code. Works, but I would sure like to understand why the formatting action fails… would be much more convenient to just use the native formatting action!
The return type is declared as Date (using DateTime, makes no difference). And displays as “2024-06-12” when I test the step (see the screenshot in my original post above).
This output I seen directly feed into the format-date action.
From the above a gather that this might be an issue of the data format. I assumed that any “Date” would fit into a format date step and I can’t find any explicit requirement on the date format of such a step. If there is, I’d appreciate a pointer!
@svamann you said that it doesn’t matter if you use Date or DateTime, but there is a differentiation in the backend - how is start_date defined? Is it a date picker (date) or DateTime?
@Jnix284 it’s a date picker. Choosing either Date or DateTime for the custom code output does not make an observable difference in the output I see when testing the custom code action (it’s “yyyy-mm-dd” in both cases) and in the error I see from the format date action. There may, of course, be a difference in what happens under the hood.
Thanks for the link, it explains the output format of the API, which matches what I see when testing my custom code action. Is there also documentation on the expected input format of the format date action?
I always thought it’s just not possible to create DateTime custom properties at all, now I learned it’s possible via the API! Thanks for this insight
I just figured this out at last. The custom code (Python in my case) needs to return the date as a timestamp in milliseconds and ensure that it is an integer. As in
int(mydatetime.timestamp() * 1000)
Then returning this from the custom code as a “Date” and using it in a Format Date action or writing it to a DatePicker property does work.