Can not get this JSON POST to an API to work right

Anyone got any suggestions please

I have a bunch of dates in my mariadb database, when a date has not been supplied for a particular field, I have set the date to default to 2030-01-01 00:00:00

In my JSON POST to this API I am trying to write a condition that says if start_time_local == 2030-01-01 00:00:00 then use a different date field else use itself. It looks like this.

"deliveryDate": "{{query_products_booked[0].ropi_start_time_local == '2030-01-01 00:00:00' ? query_tripletex_customer_id.roi_date_created : query_products_booked[0].ropi_start_time_local}}",

Each time i run this it still hands me back 2030-01-01 00:00:00 instead of the other date which is in 2021

I have tried the following

== '2030-01-01 00:00:00'
== 2030-01-01 00:00:00
== `2030-01-01 00:00:00`
== '2030-01-01T00:00:00.000Z'
== 2030-01-01T00:00:00.000Z
== `2030-01-01T00:00:00.000Z`
.startsWith(2030)
.startsWith('2030')

I am out of ideas as to why i can not get this to be true
2021-09-23_10-34-35

What am I doing wrong, assuming it’s something silly.

I eventually have resorted to

{{query_products_booked[0].ropi_start_time_local.formatDate('yyyy') == 2030 ? query_tripletex_customer_id.roi_date_created : query_products_booked[0].ropi_start_time_local}}

Which does work, but would still like to know why the other way didn’t, if anyone knows.

1 Like