I have a scheduled flow where I want an action to take place if the following code in a filter array is true:
@And(
lessOrEquals(formatDateTime(item()?['DateTimeInput'], 'MM/dd/yyyy h:mm tt'), formatDateTime(convertTimeZone(utcNow(), 'UTC', 'Pacific Standard Time'), 'MM/dd/yyyy h:mm tt')),
greaterOrEquals(formatDateTime(addMinutes(item()?['DateTimeInput'], 30), 'MM/dd/yyyy h:mm tt'), formatDateTime(convertTimeZone(utcNow(), 'UTC', 'Pacific Standard Time'), 'MM/dd/yyyy h:mm tt'))
)
In other words, if the current time is past the time listed in variable "DateTimeInput", AND not yet more than 30 minutes past, trigger the action.
Unfortunately, the function seems to be ignoring the AM/PM part? If "DateTimeInput" is set to '5/22/23 4:30 AM' and I run the flow on 5/22/23 at 4:45 PM, the function returns "true" and the flow proceeds, even though it should return "false" (the greaterOrEquals() statement should be false). The function also returns true in the reverse scenario...if "DateTimeInput" is set to '5/22/23 4:30 PM' and I run the flow on 5/22/23 at 4:45 AM.
I thought maybe it was just comparing the hours/minutes, so I tried converting the time to 24-hour format using "H:mm", and I encountered the same problem.
Is there something I'm missing as to why this doesn't run properly? Is there a better way to write it? Thanks in advance!
Here's my flow setup:
