Skip to content

Commit a7ab27c

Browse files
committed
🐛 fix breaking changes with carbon 3
Laravel 11 supports both Carbon 2 and Carbon 3. Carbon is a date manipulation library utilized extensively by Laravel and packages throughout the ecosystem. If you upgrade to Carbon 3, be aware that diffIn* methods now return floating-point numbers and may return negative values to indicate time direction, which is a significant change from Carbon 2. Review Carbon's change log and documentation for detailed information on how to handle these and other changes.
1 parent 64a4b4f commit a7ab27c

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

app/Http/Controllers/Backend/Transport/TrainCheckinController.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -309,7 +309,7 @@ public static function refreshDistanceAndPoints(Status $status, bool $resetPolyl
309309
public static function calculateCheckinDuration(Checkin $checkin, bool $update = true): int {
310310
$departure = $checkin->manual_departure ?? $checkin->originStopover->departure ?? $checkin->departure;
311311
$arrival = $checkin->manual_arrival ?? $checkin->destinationStopover->arrival ?? $checkin->arrival;
312-
$duration = $arrival->diffInMinutes($departure);
312+
$duration = $departure->diffInMinutes($arrival);
313313
//don't use eloquent here, because it would trigger the observer (and this function) again
314314
if ($update) {
315315
DB::table('train_checkins')->where('id', $checkin->id)->update(['duration' => $duration]);

0 commit comments

Comments
 (0)