Is there any bug on date filter?

Hello all,

I have a problem, understanding date filter. It was working with test but in my scenario, it does not filter correctly at all.

Please check the screenshot as you can see what is wrong.

Whatever if its earlier or after, it does not compare at all correctly the date.



As you can see, “Date d’arrivée” is 18/09/2023, one bundle has as a date 10/09/2023 which is not later than 18/09/2023. So why does it pass the filter ?

You can see below my filter. I’ve tried many test, it was working correctly so i guess having understood how does it work. But in this case, i don’t know what happens.

Thanks for your help.

Make seems to assume USA date format in most cases. However, if a date makes no sense in USA format it will then try UK/EU format (bizarreley!). So at a guess it is reading 10/09/2023 as 9th October 2023 and 18/09/2023 as 18th September 2023 (as there is no 18th month).

The only fix is to parse the date specifying the format before comparing.

2 Likes

Hey @Vivien_Chantrel

Use format date in Filters.
like this
Screenshot 2024-01-31 194549

result

Screenshot 2024-01-31 193623

in result we will get
Screenshot 2024-01-31 193608

Screenshot 2024-01-31 193729

2 Likes

Should this not be “parseDate” rather than “formatDate”?

3 Likes

@Vivien_Chantrel try pasting the extract below to see what I mean:

image

{
“subflows”: [
{
“flow”: [
{
“id”: 1,
“module”: “util:SetVariables”,
“version”: 1,
“parameters”: {},
“mapper”: {
“variables”: [
{
“name”: “d1”,
“value”: “{{formatDate("10/09/2023"; "DD-MMM-YYYY")}}”
},
{
“name”: “d2”,
“value”: “{{formatDate("18/09/2023"; "DD-MMM-YYYY")}}”
}
],
“scope”: “roundtrip”
},
“metadata”: {
“designer”: {
“x”: 102,
“y”: 177
},
“restore”: {
“expect”: {
“variables”: {
“items”: [
null,
null
]
},
“scope”: {
“label”: “One cycle”
}
}
},
“expect”: [
{
“name”: “variables”,
“type”: “array”,
“label”: “Variables”,
“spec”: [
{
“name”: “name”,
“label”: “Variable name”,
“type”: “text”,
“required”: true
},
{
“name”: “value”,
“label”: “Variable value”,
“type”: “any”
}
]
},
{
“name”: “scope”,
“type”: “select”,
“label”: “Variable lifetime”,
“required”: true,
“validate”: {
“enum”: [
“roundtrip”,
“execution”
]
}
}
],
“interface”: [
{
“name”: “d1”,
“label”: “d1”,
“type”: “any”
},
{
“name”: “d2”,
“label”: “d2”,
“type”: “any”
}
]
}
}
]
}
],
“metadata”: {
“version”: 1
}
}

2 Likes

@ttt
Yes you can but I tried with format date and it is working properly.
It will solve this problem I think

3 Likes

Thanks a lot for your answer.

I appreciate !

I already open a topic about this and I think @Abhishek answered me a that moment. So thanks again for your help. :pray:

Indeed it worked… But I don’t know why it was working before with EU format for so many invoice that I parsed with… It worked for so many of them and those one was not working, probably it was coincidence but…

I’ll use everytime the formatDate() to be sure now to avoid this…

(btw, I did some try with variables modules and it was working so I have no clue what happened.)

Anyway, the lessons is to use always the formatDate(). Won’t forget about it…

Have a great day both !

3 Likes