DateAdd not working

Hi everyone,
I have a creation 2 variables TimeStart and TimeStop of type TIME.

Inside a loop I have to add minutes to the variables and I’m using the dateAdd function but the value returns undefined.

TimeStart.dateAdd(‘minutes’, $_POST.TxDuration.toNumber())

I just can’t figure out where is the mistake.

What values and what data type do TimeStart and TimeStop return exactly?

Unfortunately I still haven’t figured out how to debug, from the console it doesn’t return values.
I put the value into a database debug field and it returns undefined.

Do I have some more correct way to debug?

Screenshot 2023-05-24 130052

{“identity”:“7B58F842-D8D9-4CF1-AC50-FA6C392B2AEB”,“CreaSlot”:{“affected”:1,“identity”:“313FBE30-314F-43CC-987B-7B24D2F1413B”},“counter”:1}

The get parameter is a string, I tried to transform it into $_POST.TxInizio.toUTCTime() and then apply the dateAdd() function but the value returns null

Hi Teodor I found out what the problem is but I didn’t find the solution.
From the time pitcher I pass the post value of type time but I get a time written like this 10:30
To use the dateAdd function I must instead have the format 10:30:00

I tried with formatDate(HH:mm:ss) but the variable is null.
Can you suggest me a way to get the correct format?

I’m not really sure i understand what you mean. Can you maybe explain this in more details?

Sorry Teodor, I’ll try to explain myself better.
I have a form with a time format input
The post variable of type time receives the example value 10:30 from the form
Now I should add 15 minutes to this time, but I found that to use the dateAddt(‘minutes’,15) I need to have a time format like this 10:30:00 and not 10:30
How can I transform the time format from 10:30 to 10:30:00 ?

You can append :00 like:

{{($_POST.TxInizio+':00').dateAdd('minutes', 15)}}
1 Like