Calculate a date range

Comments

10 comments

  • tuck

    +1
    I really need this too.

    0
    Comment actions Permalink
  • Daniel Macedo

    I'd like also!

    0
    Comment actions Permalink
  • Jan Richter

    var d1 = moment(@Start);
    var d2 = moment();
    var result = d2.diff(d1, 'days');
    result;

    "@Start" should be replaced with your Start Date Field

    1
    Comment actions Permalink
  • Sam Brooks

    This is fantastic, thank you!

    1
    Comment actions Permalink
  • Francisco Mendoza Garibay

    Thank you!

    0
    Comment actions Permalink
  • Admin - BK

    Dear Jan, whats wrong with my code?

    Its not working.

     

    Thanks for your help.

     

    0
    Comment actions Permalink
  • Jan Richter

    Hej, look at the var d2. You have to set it. It is the ending date: moment(@enddate).

    0
    Comment actions Permalink
  • Admin - BK

    nop. still same problem.

    and also, in these case i dont think that we need a enddate?

    "start date and subtract it from the present date to output total number of days?"

     

    0
    Comment actions Permalink
  • Jan Richter

    Hej, calculation fields are stupid. If you have first just put in a date, the calculation field tries to give out the number as a date. But it can't cause it is a number. Just delete the calculation field, insert a new one, paste the skript and fill in date @A0. After that it should work.

    0
    Comment actions Permalink
  • Admin - BK

    yes i relased that. its working now.

    what a shame :p

    thanks buddy.

    0
    Comment actions Permalink

Please sign in to leave a comment.

Powered by Zendesk