[Solved] Date input for Calendar

Hi. I am using the Full Calendar plugin from Bubble. My data saves a Start date and an end date in the workflow as a date input

image

Even though the input type is Date only and not Date and Time when I save the date in the workflow it ends up with a time as well and the time is alway 12:00 am

image

This creates a problem. If I use the Start Date as the Start Time field and The Last Night as the End Time field the end time always shows as the previous day even though the data field is showing correct. It also leaves gaps in my Calendar and “12a” showing before each Caption which I can only assume to be 12am.

I can only assume that the calendar is reading the time as well and ending the field in the calendar at midnight and therefore not showing the actual Last night as the End Time.

How do I get the Calendar to show the End Date field as the actual date of the Last night and not midnight and therfore not showing the last date on the Calendar plugin. I have tried saving the date field in the workflow changing the hours minutes and seconds to 0 but is still saves in the database as 12:00 am

image

This still gives me the same result in the data table as 12:00am and that date not showing in the Calendar plugin as the actual Last Night

Any suggestions of when I have it wrong here?

Any field of type “date” in Bubble stores a full timestamp, with the default time being 12:00am. When you set a user input to type=date, and don’t supply a time (either by collecting it from the user or appending the time in your workflow action for creating or updating the field), when you store that input’s value in a date field in the database, Bubble will use the default time (12:00am), since it needs to store date values as a full timestamp.

What’s your use case here? There are lots of options depending on what you’re trying to achieve.

  1. Set a date field to “right now” when user clicks button:
    – you don’t actually need to collect anything via user input. Instead, in the workflow, when you create/modify the parent thing on button click, just set the date field = Current date/time, using dynamic data.

  2. Modify the user inputted date and store the modified value:
    – you can use …change hours/mins/seconds to “hard code” a full timestamp. You just happened to pick 0,0,0 which = midnight :wink: Have a look at the relevant reference docs to understand how this works.
    – you can use +(seconds/hours/days) to offset the timestamp you want to store
    – you can use either of the above to set the date field based on an offset of another field’s value: LastNight = DateInputLastNight(AU)'s value add hours (4), for example, would get you to 4:00am, in your example where the default you’re collecting is just the date (and thus Bubble defaults the time to midnight).

2 Likes

Thanks so much @djwideman. i just changed the hours to 12 instead of 0 and all is fixed. Now I understand how the date is saved it make the solution much easier to understand