Skip to content

Commit

Permalink
🐛 fix breaking changes with carbon 3
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
MrKrisKrisu committed Dec 31, 2024
1 parent 64a4b4f commit a7ab27c
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,7 @@ public static function refreshDistanceAndPoints(Status $status, bool $resetPolyl
public static function calculateCheckinDuration(Checkin $checkin, bool $update = true): int {
$departure = $checkin->manual_departure ?? $checkin->originStopover->departure ?? $checkin->departure;
$arrival = $checkin->manual_arrival ?? $checkin->destinationStopover->arrival ?? $checkin->arrival;
$duration = $arrival->diffInMinutes($departure);
$duration = $departure->diffInMinutes($arrival);
//don't use eloquent here, because it would trigger the observer (and this function) again
if ($update) {
DB::table('train_checkins')->where('id', $checkin->id)->update(['duration' => $duration]);
Expand Down

0 comments on commit a7ab27c

Please sign in to comment.