Frontman
5 months agoQrew Trainee
Time of Day field values are not in 24-hour format in Pipelines
Hi all. I think I found a bug with Pipelines where using a Time of Day field isn't in 24-hour format even when you set the field settings to 24-hour.
Can anyone think of a possible workaround?
Most APIs use 24-hour format so having Pipelines only output in North American format makes it impossible to pass along the correct time format.
Steps to reproduce:
- Create a Time of Day field.
- In field settings > Value display, enable 24-hour clock.
- Create a pipeline that sends a value in this field.
- Pipelines outputs the field in North American time format (for example, 5:00 PM), instead of 24-hour format (ex: 17:00).
I tried using Jinja to reformat to 24-hour, but Pipelines doesn't support the jinja filters needed to re-format to 24-hour time. Here's the Jinja expression I tried:
{{ time-field|replace(" AM", "").|replace(" PM", "")|stringptime("%I:%M")|strftime("%H:%M") }}
Easiest would be to parse the field then format:
{{ (time.parse(a.time_of_day)).strftime('%H:%M') }}
Above will output 23:30 if a.time_of_day is 11:30 PM