gtfs-php-sdk icon indicating copy to clipboard operation
gtfs-php-sdk copied to clipboard

No time in returned DateTime object and no TimeZone management

Open marcdeldem opened this issue 8 months ago • 0 comments

For CalendarDate, getDate returns a DateTime without settings the time in the DateTime object. So the time used to create the DateTime object is therefore the current time. Perhaps, settings the time to 00:00:00 would be better (adding '!' in the mask format)

public function getDate() : DateTime
{
    return DateTime::createFromFormat("!Ymd", $this->date);
}

Same problem for CalendarEntry :

public function getStartDate(): DateTime
{
    return DateTime::createFromFormat("!Ymd", $this->start_date);
}

public function getEndDate(): DateTime
{
    return DateTime::createFromFormat("!Ymd", $this->end_date);
}

And there is no TimeZone management. But Agency object contains a TimeZone that could be used.

marcdeldem avatar Mar 30 '25 10:03 marcdeldem