BUG - adding minutes to datetime field

Hi Everyone,

Wappler Version: 3.0.3
Operating System: Windows 10

Expected behavior

What do you think should happen?

Tried to add minutes to a datetime field but its not adding them correctly every time

Actual behavior

What actually happens?

image

The left column is the datetime field and I added + no of mins that should be added, this is how I have it in wappler:

Appointmentdate.toISODate()+'-'+Appointmenttime.toISOTime()+' -- '+' + '+Duration+'mins

The right column has the result which is only right when the hour has no minutes: Appointmenttime.addMinutes(Duration).formatDate('yyyy-MM-dd HH:mm:ss')

I think this is most probably a bug, as I have tried many ways around to fix it but couldn't manage, can anybody confirm if its happening on your projects as well?

Regards,

I tested the addMinutes formatter and it worked correctly. Are you sure the Appointmentdate is a correct date and Duration is a correct number?

I noticed a strange behavior when the Duration is a string instead of a number. Try the following expression:

Appointmenttime.addMinutes(+Duration).formatDate('yyyy-MM-dd HH:mm:ss')

The + in front of Duration will convert it in a number.

Ok the problem was I think that Duration is a string instead of a number.

I tried adding + in front of Duration but still didn’t work.

I managed to get it working by adding Duration.toNumber() and now it works perfect.

Thanks!

1 Like

Yes, i also had this issue, with strange behaviour occurring.

Changed the duration input (which was already a ‘number’ input type) with toNumber() and it worked as expected.