aboutsummaryrefslogtreecommitdiff
path: root/model/Schedule.php
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--model/Schedule.php13
1 files changed, 12 insertions, 1 deletions
diff --git a/model/Schedule.php b/model/Schedule.php
index cc1db55..0b2958e 100644
--- a/model/Schedule.php
+++ b/model/Schedule.php
@@ -85,9 +85,20 @@ class Schedule extends ModelBase
$day['end'] = $dayend;
}
- $dayidx = 0;
+
+ $daysSorted = [];
foreach($schedule->day as $day)
{
+ $daysSorted[] = $day;
+ }
+
+ usort($daysSorted, function($a, $b) {
+ return (int)$a['start'] - (int)$b['start'];
+ });
+
+ $dayidx = 0;
+ foreach($daysSorted as $day)
+ {
$dayidx++;
$daystart = (int)$day['start'];
$dayend = (int)$day['end'];