Breaking Change in Date Formatters?

Recently updated to Wappler 5.1.1.
One of our date time function is now returning a different value.
'2022-09-01 09:09:09'.addMinutes(4) resulted in 2022-09-01 09:09:13 as output.
But now, it returns 2022-09-01T09:09:13 as output - which has broken our logic of using split-by-space to get just the time value.
Can someone from Wappler (@patrick) please confirm if this breaking change is part of version 5 update?
I tried doing code-diff on formatter JS file, and found references to this in date function, but not sure.

P.S. I understand that using split is not the best way to do this, but this is old code, which we have identified when it broke.

Another breaking change discovered:
Before v5, when a page with pagination is loaded, and there is no query.offset available, using toNumber() would return 0.
Now it returns NaN. We use this value to show serial number.
Now we had to change the expression to query.offset.default(0).toNumber() in about 50 places, in just one project.

I don’t believe the functions have really changed. I will check if there were indeed some changes.

The easiest fix for now is just overriding those formatters, make sure to add the script after the dmxFormatter.js include.

dmx.Formatters('string', {
  toNumber: function(val) {
    var n = Number(val);
    return isNaN(n) ? 0 : n;
1 Like

There was indeed a change in the date formatters, I’ve changed it back to use the space again. The toNumber() wasn’t changed as far I could see. (7.5 KB)

1 Like

Thanks for the formatter code and the space fix. :slight_smile:

Fixed in Wappler 5.1.4

This topic was automatically closed after 47 hours. New replies are no longer allowed.