Answer the question
In order to leave comments, you need to log in
How to check if a time is in an interval?
class StopTime(models.Model):
time_from = models.TimeField(verbose_name="Время от")
time_to = models.TimeField(verbose_name="Время до")
type= models.ForeignKey(Type)
Answer the question
In order to leave comments, you need to log in
so all intervals should start from 0 and end with 24. That is, you need to split your interval into two subintervals if the first value is greater than the second. Time to translate the absolute minutes of the day (how many minutes have passed since 00:00) - it will be easier to compare.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question