Ritu Singh
Problem:
I have a booking site and I want the booking to be permanent only by hours (I don't want minutes) an example of John booked from 8 to 10 o'clock And I don't want 8:10 to 10: 30 pm Can I remove the minutes from DateTimeInput format that the user cannot choose them and selects only the hour look at the picture here
Or any other way to do this
Solution:
You can create a class that takes input in type time: class timeInput(forms.timeInput): input_type = 'time'
and use this inside your booking form input like this:
bookingTime=forms.TimeField(widget=timeInput(attrs={step:'3600'}) (here the attribute u wanna give is in hours, so 1hr=3600secs u can take as this in the step attribute)
Answered by: >FiNa
Credit: >Stackoverflow
Suggested reads:
>Make Xdebug stop at breakpoints in PhpStorm using Docker
>Creating a service in Laravel using app(FQCN)
>How is the value of the path column under the wagtailcore_page table populated?
>Fix my form calling the wrong Django view error