Error using server Parser - toUTCTime

Wappler Version : 3.4.0 (but happened in previous version too)
Operating System : Win10, NodeJS / Docker project

Expected behavior

When you convert a date or time to UTC or Other format options on the server action side, it should convert to the chosen format

Actual behavior

What actually happens?

It does not convert the date/time and the server action (a database update in this case) fails.

Error message:

{status: "500",…}
message: "Parser Error: Formatter "toUTCTime" does not exist, expression {{$_POST.start.toUTCTime()}}"
stack: "Error: Parser Error: Formatter "toUTCTime" does not exist, expression {{$_POST.start.toUTCTime()}}↵    at /opt/node_app/lib/core/parser.js:694:27↵    at /opt/node_app/lib/core/parser.js:661:25↵    at parser (/opt/node_app/lib/core/parser.js:352:19)↵    at parseValue (/opt/node_app/lib/core/parser.js:725:24)↵    at parseValue (/opt/node_app/lib/core/parser.js:716:26)↵    at parseValue (/opt/node_app/lib/core/parser.js:716:26)↵    at Object.parseValue (/opt/node_app/lib/core/parser.js:716:26)↵    at App.parseSQL (/opt/node_app/lib/core/app.js:348:23)↵    at App.update (/opt/node_app/lib/modules/dbupdater.js:38:26)↵    at App._exec (/opt/node_app/lib/core/app.js:255:57)"
status: "500"

This is an image of the server action step. Its a simple UPDATE. The START and END fields in this case are TIME inputs. I have also tried with date, datetime and also the DMX date/time picker inputs. Anytime the formatter is used it fails and throws the above error

How to reproduce

As above. Set up a DB action, such as a DB UPDATE and use a date or time input that uses the toUTCTime() formatter or the toLocalTime() formatter.

The formatters are not missing and seem to work for me.

Do you have only problems with the date specific formatters? Please check the lib/formatters folder if the file date.js exists. Open the file and check if the methods toLocalTime and toUTCTime in it.

It was just those two formatters I’d tried. I’ll check what you’ve mentioned and see what I find.

Hey @patrick. I was able to check this, and it looks like those formatters do not exist
in the file. The only one there is toTimestamp.

Here is an image, condensed for easier viewing.

I did update to latest version… something is missing here though right?

When looking in the windows folder structure, the last modified date for that file is 26/07/2020.

image

I believe Wappler only updates files depending on the file date, the date.js is from 22/07/2020. Not sure why your file is from 26/07/2020, but that is probably the cause that it wasn’t updated. I’m not sure if new files are copied again when you remove the lib folder, perhaps @George knows that.

Here the up-to-date file: date.zip (836 Bytes)

Thanks @patrick. I’ll update this tomorrow morning. Would there be any chance the other formatters are missing functions or hadn’t been updated? Any way of telling without waiting untill something doesn’t work?

Try to rename the lib folder and then start Wappler with that project and see if it recreates the lib folder, it should then have all the latest versions.

Thanks for this. This tip worked. I created a lib - Copy, restarted Wappler and it created a new lib folder.

Based on Wappler detecting which files were new/different, the date.js file and the util.js file had been updated.

All good now.