Post

4 followers Follow
1
Avatar

Date Calculations

Hi,

I am attempting to do some date calculations and am having an issue with the outputs.

I have two columns - "quote Submitted" and "AP Required"

The first column will not have a date entry until we have actually prepared a quote for a customer. The second column is where I would like a calculation to take place - which would be 7 days from the date the quote is submitted.

I can get the calculation to work, and for the date in the second column to show up in the calendar - my issue is that for every other customer that does not yet have a quote submitted date, the AP required date is showing Jan 31, 1969. I would only like a date to show in the second column if the user has input a date in the first column. I've attached screen shots of what I'm talking about.

Is what I am asking possible?

Thanks for your time.
Ryan

Ryan Goodale

Please sign in to leave a comment.

8 comments

1
Avatar

Hi Ryan,

var date = @Quote Submitted;
date != null ? moment(date).add(7,'d').toDate() : ""

Maybe an error notification shown in the preview. Ignore it, save the template. 

Rainer

Rainer Grabowski 1 vote
Comment actions Permalink
0
Avatar

Thanks for the reply Rainer.......Here are the two errors I came up with - it wouldn't actually allow me to save it - so I'm assuming it's just something small I've done.

Any thoughts on what I've done or, more accurately, what I need to do?

 

Ryan Goodale 0 votes
Comment actions Permalink
0
Avatar

You need to pick a token from the token list which opens as a dropdown when you enter @ followed by a field name. @Quote Submitted must be blue (becoomes bue after picking it from the list). Please read this introduction: 
https://help.podio.com/hc/en-us/articles/201019358-Calculations

And why do you add "AP Required" inbetween the brackets in .toDate()? Remove it. 

Rainer

Rainer Grabowski 0 votes
Comment actions Permalink
0
Avatar

Thanks - the issue was that I simply copy/pasted your text in - I had to delete, and then add, @Quote Submitted for it to work.  Thanks very much for your help

 

Ryan

Ryan Goodale 0 votes
Comment actions Permalink
0
Avatar

I have a similar question:

Let's say I have a field @Last Contacted Date and I want the difference from that and today's date to prioritize my client follow ups. How do I calculate that? I'm a newbie and dont know Momentum or Javascript. Anyone can help?

Tara 0 votes
Comment actions Permalink
0
Avatar

How do modify this to remove the time stamp? This works great, but I prefer just to have the date...

Chris North 0 votes
Comment actions Permalink
0
Avatar

Hi Chris,

in the calculation field change the field settings: Click the little triangle at the left side of the calculation field brick and deselect "show time" (time will be still shown in the preview but not in the item view).

Rainer

Rainer Grabowski 0 votes
Comment actions Permalink