Forum Academy Marketplace Showcase Pricing Features

Selecting a time frame?

Hi Everyone,

Not quite sure to what subcategory this belongs so hence i’m posting it in the main “need help” category.

I’m trying to make an app where I can add multiple stores (or locations) and have the user select the opening- and closing times when creating the object.

I need to be able to work the these times at a later stage, such as calculating the time I would need to leave to get there if it is a 1h drive.

How would I best achieve this? What kind of data type am I looking to use and what do I use for input (date selector, text) ?

I was thinking to put opening- and closingtime in their own field as a string/text value. Then use some input mask/validation on the entry field. Using a text field however immediatly blocks me from using a timepicker and requires the user to type it in.

Thanks

1 Like

I would use 2 Date fields on the location, Open time, close time. You just use some formatting only store the time and not the actual date.

You may move on to wanting a whole Opening time data type as you add different times for days of the week and holidays etc.

1 Like

I think you can use dropdown time selector, like Google My Business does, and pull data from options. In your options, have a field that represent the number of hours.

These would be your options.

00:00
01:00
02:00


23:00
24:00

edit:

When it comes to storing and calculating, you can store the number_of_hours field in a number field. So if the time selected is 08:00, you would store selected option’s number_of_hours, which is going to be 8.

Thanks!

I’ll see what I can make of this :wink:

This topic was automatically closed after 70 days. New replies are no longer allowed.