How can I insert time in a date field using a calculation?

  • Profile Image
    SuperDive
    Asked on January 03, 2022 at 05:01 PM

    Hi,

    In my form, I have a date calculation based on which ticket the user purchases (widget). I would like to also insert the time here, so I can integrate my form with Google Calendar.

    The sessions are 8:00 - 9:30 PM.


    Unfortunately, your Google calendar integration only allows me to choose up to 60 minutes duration, otherwise I have to input the value based on my form. When I try to use a form field by adding a Time field to the Date Picker, I cannot properly calculate this (it defaults to 7:00PM every time).

    Please help?

  • Profile Image
    BDAVID
    Answered on January 03, 2022 at 10:12 PM

    Thank you for reaching out to us. Unfortunately, you cannot insert a Time field value in a Date Picker field through conditions.

    I would suggest you to use the Appointment field instead. It would integrate correctly with Google Calendar:

    1641265688_61d3ba1892605_

    So the time will show up, example:

    1641265599_61d3b9bf91bdc_

    You can give your own duration to this field, and set the Intervals:

    1641265511_61d3b9676370b_

    And you can define the dates it should be available:

    1641265557_61d3b995bb3ba_

    To set up a max number of people that can book the same time-slot, you can go to Advance settings to specify that:

    1641265839_61d3baafda537_

    Let us know if you have more questions.

  • Profile Image
    SuperDive
    Answered on January 04, 2022 at 11:50 AM

    If I use the appointment picker, is it still somehow possible to show people how many spots are left that day? That's why I liked the widget (it showed X spots remaining).

  • Profile Image
    Lars_L
    Answered on January 04, 2022 at 02:11 PM

    Hello,

    With a bit of adjustment to the conditions and an extra date field, I was able to accomplish this:

    1641322602_61d4986a5acc6_

    I added a Date Picker field for the end of the session, that we'll use in the integration, but they can both be hidden on the final form.

    1641322663_61d498a747a50_

    And as you notice on them in the screenshot, I enabled the Time Field in their properties:

    1641322700_61d498ccb572c_

    Your current conditions, as seen below, were picking the wrong time during the day when the Time Field is enabled.

    1641322751_61d498ff6d1c2_

    To get it to pick 8PM while in New York time zone, I had to add ".0417" to the amount.

    1641323106_61d49a62e0bd7_

    And then had to do that for each one, and then the Session Date gets filled correctly with the time.

    And when Session Date is filled, I add Session Date + 90 minutes (0.0625 days) to Session End.

    1641323176_61d49aa81f658_

    And for the integration, I used the Session Date and Session End for the start and end time of the calendar event:

    1641323373_61d49b6ddf607_

    One problem with this is if users are in other time zones, it might select another hour. As we don't have the autocorrecting features of the Appointment Field. But if your customers are in your area, that shouldn't be a problem.

    Please give this a try, and let us know if you run into any issues!

    Best regards,
    Lars