Skip to content

FlexibleDateTimeCast ​

php
class Zairakai\LaravelTwitch\Dto\EventSub\Casts\FlexibleDateTimeCast implements Cast

Casts Twitch RFC3339 timestamps to Carbon.

Twitch sends variable fractional-second precision (.123Z millisecond, .171067Z microsecond, or none at all) and spatie/laravel-data's default DateTimeInterfaceCast only tries a single fixed format (DATE_ATOM, no fractional seconds) - it rejects every real Twitch example payload. Carbon::parse() handles all ISO8601 variants natively, no format guessing needed.

Source: src/Dto/EventSub/Casts/FlexibleDateTimeCast.php

Methods ​

cast() ​

php
public function cast(DataProperty $property, mixed $value, array $properties, CreationContext $context): Carbon|Uncastable

Documentation of 4.1.4 , built from a03e949 on 4.1.4 by pipeline #2949087255 on 2026-10-11.