Fix Carbon parsing for JS date strings with timezone names
This commit is contained in:
@@ -162,8 +162,11 @@ class AttendanceSyncController extends Controller
|
||||
return \Carbon\Carbon::createFromTimestamp($dateStr);
|
||||
}
|
||||
|
||||
// Remove JS-specific timezone names like "(China Standard Time)" to prevent Carbon parse errors
|
||||
$cleanDateStr = trim(explode('(', $dateStr)[0]);
|
||||
|
||||
try {
|
||||
return \Carbon\Carbon::parse($dateStr);
|
||||
return \Carbon\Carbon::parse($cleanDateStr);
|
||||
} catch (\Exception $e) {
|
||||
return null;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user