Calculations using dates

Comments

7 comments

  • Bajarang

    @Michael Can you please post a screenshot of your calculation. It will help to see the issue easily.

    0
    Comment actions Permalink
  • Michael Faurest

    Here is picture of the calculation.  Thanks.

    0
    Comment actions Permalink
  • Rainer Grabowski

    Hi Michael,

     

    1. Delete that calculation field (s. here https://help.podio.com/hc/en-us/articles/201019358-Calculations, the paragraph above the video)

    2. Create a new calculation field and enter:

    moment(@Lease End Date).subtract(@Lead Time, "days").toDate()

    That shows the date like a date field, means: it looks like a real date field and you can see in calendars (for checking the field settings click the little triangle at the left hand side of the module). 

    If you want it as text e.g in the the format 09/07/2018:

    moment(@Lease End Date).subtract(@Lead Time, "days").format("MM/DD/YYYY")

    Rainer

    1
    Comment actions Permalink
  • Michael Faurest

    I really appreciate your help but I'm still getting an error.  See the attached.  Am I doing something incorrectly?  The Preview returns "0" and I can't save it because of the error on the bottom left.  Thanks!

    0
    Comment actions Permalink
  • Dirk Spannaus

    @Rainer Great answer, works fine! Is there a way to set the calender entry name? Like prefixing it with "deadline" or similar?

    0
    Comment actions Permalink
  • Rainer Grabowski

    @Michael

    Calculation fields are sometimes very "sensible" when you create them. My recommendation:
    Add a new calc field, enter @created on, pick the token, save the template. Now you can be sure that the calc field is date type.
    Go back into the template, remove @created on and enter your code (it's correct). Now you should the right date.

    @Dirk
    If your field should show the result as a date you can't add anything (a prefix would make it a string).
    The calendar entry name is the first filled field in the item (text or calculation). If your use case and app does it allow, you can add a calculation field at the top with a dynamic calculation, maybe with some IF clauses (if field deadline filled display Deadline + title field, if not name of another date field, or if current is 2 days before Deadline date show Deadline ... or whatever makes sense)

    Rainer 

    0
    Comment actions Permalink
  • James Perfect

    If I may ask, how are you able to reference dates?


    0
    Comment actions Permalink

Please sign in to leave a comment.

Powered by Zendesk