PLEASE NOTE: These forums are no longer utilized and are provided as an archive for informational purposes only. All support issues will be handled via email using our support ticket system. For more detailed information on this change, please see this blog post.

Calc days between two dates ?

  1. daveporter
    Member

    Is there a way to have a read-only field that displays the number of days between two previously entered dates ?

    TIA, Dave

    Posted 12 years ago on Wednesday March 28, 2012 | Permalink
  2. I too have been looking hard for a simple answer to this question - so does anyone have a pre_submission function or other method for calculating the number of days between two selected dates ?

    Thanks, Peter.

    Posted 12 years ago on Wednesday May 2, 2012 | Permalink
  3. kyle
    Member

    Did you see this post?

    start date end date - calculate days

    Posted 12 years ago on Wednesday May 2, 2012 | Permalink
  4. Yes - thanks, but how to you display the value of the #Days field after form displayed, but after date field values selected. i.e. but before submitting. Can the #Days field redraw - with the calculation based on the filter function ? (Pardon my lack of knowledge at this stage) Thanks.

    Posted 12 years ago on Wednesday May 2, 2012 | Permalink
  5. kyle
    Member

    Ah, sorry. You'll need to use Javascript if it has to happen live. I haven't used it yet, but the Moment.js library for working with dates in Javascript is probably your friend here.

    Posted 12 years ago on Wednesday May 2, 2012 | Permalink
  6. Thank you I will look at that option - and the nice .js for this and other purposes.
    But just to check I'm on the right track - the objective is to help make sure a form user has entered the correct booking information for accommodation, as people get confused about check-in/out dates versus quantity of nights they are booking.
    So options would include a user selecting a reservation arrival date, and departure date - and the form then confirming the quantity of nights they are booking.
    Alternatively they could select arrival date and quantity of nights they wish to stay, and the form would display the departure date.
    Or am I missing something obvious - and there's a simpler/more common method used in a form for this sort of confirmation objective ?
    I've already received good replies above which I can action - but just checking I'm not missing a simpler concept. Thanks.

    Posted 12 years ago on Thursday May 3, 2012 | Permalink
  7. kyle
    Member

    Sound about right to me.

    Posted 12 years ago on Thursday May 3, 2012 | Permalink