Skip to main content
This module contains all time and schedule-related models used for managing opening hours, time-based restrictions, and scheduling operations.

Basic Time Models

TimeDTO

Model for representing time of day.
FieldTypeRequiredDescription
hournumberYesHour in 24-hour format (0-23)
minutenumberYesMinutes (0-59)
Examples:
  • { hour: 9, minute: 30 } represents 9:30 AM
  • { hour: 14, minute: 15 } represents 2:15 PM
  • { hour: 23, minute: 59 } represents 11:59 PM

DaysOfWeekDTO

Model for specifying which days of the week something applies to.
FieldTypeRequiredDescription
mondaybooleanYesWhether Monday is included
tuesdaybooleanYesWhether Tuesday is included
wednesdaybooleanYesWhether Wednesday is included
thursdaybooleanYesWhether Thursday is included
fridaybooleanYesWhether Friday is included
saturdaybooleanYesWhether Saturday is included
sundaybooleanYesWhether Sunday is included
Example:
{
  "monday": true,
  "tuesday": true,
  "wednesday": true,
  "thursday": true,
  "friday": true,
  "saturday": false,
  "sunday": false
}
This represents weekdays only (Monday through Friday).

Schedule Models

TimeRangeDTO

Model for defining a time range within a day.
FieldTypeRequiredDescription
fromstringYesStart time in “HH:mm” format
tostringYesEnd time in “HH:mm” format
Examples:
  • { from: "09:00", to: "17:00" } represents 9:00 AM to 5:00 PM
  • { from: "12:00", to: "14:00" } represents noon to 2:00 PM
  • { from: "18:30", to: "22:00" } represents 6:30 PM to 10:00 PM
Time ranges use 24-hour format strings for consistency and to avoid AM/PM confusion.

DayScheduleDTO

Model for defining operating hours for each day of the week.
FieldTypeRequiredDescription
mondayTimeRangeDTO[]NoMonday operating time ranges
tuesdayTimeRangeDTO[]NoTuesday operating time ranges
wednesdayTimeRangeDTO[]NoWednesday operating time ranges
thursdayTimeRangeDTO[]NoThursday operating time ranges
fridayTimeRangeDTO[]NoFriday operating time ranges
saturdayTimeRangeDTO[]NoSaturday operating time ranges
sundayTimeRangeDTO[]NoSunday operating time ranges
Features:
  • Multiple Ranges: Each day can have multiple time ranges (e.g., lunch and dinner service)
  • Closed Days: Days with no time ranges are considered closed
  • Flexible Hours: Different days can have completely different schedules
Example:
{
  "monday": [
    { "from": "11:00", "to": "14:00" },
    { "from": "17:00", "to": "22:00" }
  ],
  "tuesday": [
    { "from": "11:00", "to": "14:00" },
    { "from": "17:00", "to": "22:00" }
  ],
  "wednesday": null,
  "thursday": [
    { "from": "11:00", "to": "22:00" }
  ]
}
This schedule shows:
  • Monday & Tuesday: Open for lunch (11:00-14:00) and dinner (17:00-22:00)
  • Wednesday: Closed
  • Thursday: Open continuously (11:00-22:00)

Operating Hours Models

OpeningHoursDTO

Model for comprehensive operating hours with separate pickup and delivery schedules.
FieldTypeRequiredDescription
pickupDayScheduleDTONoPickup/collection operating hours
deliveryDayScheduleDTONoDelivery service operating hours
Use Cases:

Separate Service Hours

Locations can have different hours for pickup and delivery:
  • Pickup: When customers can collect orders in-store
  • Delivery: When delivery service is available

Extended Delivery Hours

Some locations offer delivery beyond their pickup hours:
{
  "pickup": {
    "monday": [{ "from": "10:00", "to": "22:00" }]
  },
  "delivery": {
    "monday": [{ "from": "11:00", "to": "23:00" }]
  }
}

Limited Delivery Areas

Delivery might be available fewer days than pickup:
{
  "pickup": {
    "monday": [{ "from": "09:00", "to": "20:00" }],
    "sunday": [{ "from": "12:00", "to": "18:00" }]
  },
  "delivery": {
    "monday": [{ "from": "11:00", "to": "19:00" }],
    "sunday": null
  }
}

Preparation Time Models

AveragePreparationTimeDTO

Model for average order preparation time.
FieldTypeRequiredDescription
hournumberYesHours component (0-23)
minutenumberYesMinutes component (0-59)
Examples:
  • { hour: 0, minute: 15 } represents 15 minutes
  • { hour: 0, minute: 30 } represents 30 minutes
  • { hour: 1, minute: 0 } represents 1 hour
Usage:
  • Order Timing: Calculate when orders will be ready
  • Customer Expectations: Inform customers of wait times
  • Capacity Planning: Manage order scheduling
  • Delivery Estimates: Factor into delivery time calculations

Time-Based Operations

Schedule Validation

The time models support various scheduling operations:
  1. Current Status: Is the location currently open for pickup/delivery?
  2. Next Opening: When will the location next be open?
  3. Service Availability: Which services are currently available?
  4. Schedule Conflicts: Are there any scheduling issues?

Time Zone Considerations

All time schedules are interpreted in the location’s local timezone:
  • Locations specify their timezone in LocationDTO
  • All time calculations use the location’s timezone
  • Customer communications show local times

Holiday Handling

The schedule models can be extended for holiday operations:
  • Special holiday hours can override regular schedules
  • Closed days can be specified for holidays
  • Limited service during holiday periods

Business Rules

Minimum Operating Windows

  • Each time range should have a reasonable duration
  • Consider minimum preparation times
  • Account for setup and cleanup time

Service Coordination

  • Delivery hours should align with preparation capacity
  • Pickup hours should consider staff availability
  • Multiple locations should coordinate for consistency

Customer Communication

  • Clear indication when services are unavailable
  • Advance notice of schedule changes
  • Real-time status updates
Time schedules are critical for customer experience and operational efficiency. They should be regularly reviewed and updated based on actual business operations.