nshkrsh
December 12, 2021, 6:46am
1
Wappler 4.4.3
NodeJS 14
PostgreSQL 11
in API, we have a query that brings back date in this format: ‘2021-12-15T06:30:00.000Z’
added a condition to compare this date to NOW_UTC, the resultant check is
query.next_time > NOW_UTC ('2021-12-15T06:30:00.000Z' > '2021-12-12T06:41:56Z')
but this is returned back as FALSE!!! It should be TRUE.
did the same check on client side with this:
dmx.parse("'2021-12-15T06:30:00.000Z' > '2021-12-12T06:40:02Z'")
this was returned TRUE - as expected.
Please fix the server side issue with date comparison.
thank you.
Teodor
December 12, 2021, 7:12am
2
Is this your actual expression?
query.next_time > NOW_UTC ('2021-12-15T06:30:00.000Z' > '2021-12-12T06:41:56Z')
nshkrsh
December 12, 2021, 7:15am
3
actual expr on cond is
query.next_time > NOW_UTC
at run time the values getting replaced are:
'2021-12-15T06:30:00.000Z' > '2021-12-12T06:41:56Z'
Teodor
December 12, 2021, 7:26am
4
nshkrsh:
2021-12-15T06:30:00.000Z
I just tested this and it seems to work correctly:
results in:
nshkrsh
December 12, 2021, 7:32am
5
in my case, the date is coming from a sql query from postgresql DB.
i tried the config that you shared - it worked - but when the date is coming from DB via query, it does not work!
Teodor
December 12, 2021, 7:33am
6
Can you output the date from your database in a setvalue step and check the exact value it returns please?
nshkrsh
December 12, 2021, 7:34am
7
2021-12-15T06:30:00.000Z
this is exactly what the DB returns - had checked by enabling output.
nshkrsh
December 12, 2021, 7:36am
8
in the DB, the col type is timestamp, the data on that field is
2021-12-15 12:00:00.000
Teodor
December 12, 2021, 7:38am
9
Can you post a screenshot of the exact output for this field from your dev tools?
patrick
December 13, 2021, 1:57pm
12
Could you test with this update, unzip to lib/core.
app.zip (4.2 KB)
nshkrsh
January 17, 2022, 4:29pm
13
sorry for checking late on this. had done a workaround for prod release.
have checked this file now. it is does fix the problem. thank you.
am hoping this will be part of the next release.