Adding days to a date field to calculate a future date
Hi,
Can anyone help me with this? Here's the requirements. add 17 days to an existing date field and posting the answer to a second (calculated) date field.
Start date: 7/11/2014
Days to add: 10
New date: 7/21/2014
Thank you, thank you!
-
Hey Parsons,
Can this answer help you: https://help.podio.com/hc/communities/public/questions/202652916-Calculating-a-new-date-X-days?
Cheers,
Sara - Podio -
Sara Høeg Højlund-Rasmussen, the link above does not exist, did it move? And if so, could you please point me to the new link?
Thank you!
-
Hey Matt,
I think there are many expamples in this community. The code is:var date = @Date field;
var daysToAdd = 10;
moment(date).add(daysToAdd,"days").toDate()That returns the result as a date (= calculation field looks like a date field).
If you want it as text:moment(date).add(daysToAdd,"days").tz("America/New_York").format("MM/DD/YYYY")
returns e.g.: 10/20/2021
.tz() defines the timezone for the calculated date (in my example it's Eastern Time). If you want it in your timezone you can use the same one as in your personale Podio settings.
More about how to handle dates in Podio with the integrated date js.library "moment": https://momentjs.com/docs/Rainer
-
Hey Rainer Grabowski
I used the above code
But the problem I am facing is when I hard code a number i get the required result.
Here the vendor invoice receipt date = 01/03/2023
and when I use a variable I dont get the correct result
I have used new calculation fields multiple time
I have also made sure the variable is numeric
please see image
Please sign in to leave a comment.
Comments
4 comments