$moment() function in jsonata

Hi all,
I recently discovered that $moment() function is available in Jsonata expression.This is great to have it there.I stumbled upon an issue though and hope you may lend me a hand.

I am trying to subtract a variable duration from a date. The function signature in momentjs should be

when I do the same thing in Jsonata expression I cannot provide the chained function , that is subtract any variables. It works only if I hard coded the values
that is it does not work if I try

it works only if

so my question is : is it something I am doing wrong, or is it that chained methods are unsupported by the Jsonata function in node-red?
I am not really sure how does node-red add functions to the Jsonata library of functions..
thank you

Hi @nileio

I think this is due to the way jsonata references message properties.

I think you'll find this works:

1 Like

did not even cross my mind and indeed it is the solution! it worked beautifully.
Thanks for help @knolleary

1 Like