You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature request related to a problem? Please describe.
The function that retrieves a date always converts it to the timezone of the site. I want to preserve the original timezone.
Describe the solution you'd like
Suggest a new version of the get_date and other related functions that returns a datetime object. Then the existing functions can call that function and format it.
Describe alternatives you've considered
I've considered copying the function into my own code and reimplenting it, but it seems unnecessary.
The text was updated successfully, but these errors were encountered:
There's way too many DateTime formats used in feeds out there on the internet. Some use american, others european formats. If that wasn't enough, many websites create their own custom formats (for no obvious reason). Tomorrows date can be specified as both 01-11-21, 11-01-21 and 21-11-01. It really depends on what feed you're parsing.
Yes there are standards out there, but not everyone really cares, if their feed uses the right formats or not. Similarly, not all feeds are escaping special characters in the description either, making many feeds to periodically fail parsing or validations.
It also isn't uncommon for websites to specify their local time, with an +0:00 at the end, making it seem like an UTC/GMT-timestamp, even when it's not...
I would highly recommend anyone to parse the raw timestamp value on their own, depending on witch site it comes from. $pubDate = $pie->get_date(null);
Yeah, I know, but the DateTime object needs an input format, to be able to parse the date. If the standardized formats are wrong, for some reason, so is the the date, returned by the DateTime object.
I've seen way too many DateTime objects return just january 1st 1970 (or even false), due to some month/weekday in foreign language (or unknown format in general)
Why don't you just use something like this?
$date = new DateTime($pie->get_date(null));
// or
$date = DateTime::createFromFormat('Y-m-d', $pie->get_date(null), new DateTimeZone('UTC'));
Is your feature request related to a problem? Please describe.
The function that retrieves a date always converts it to the timezone of the site. I want to preserve the original timezone.
Describe the solution you'd like
Suggest a new version of the get_date and other related functions that returns a datetime object. Then the existing functions can call that function and format it.
Describe alternatives you've considered
I've considered copying the function into my own code and reimplenting it, but it seems unnecessary.
The text was updated successfully, but these errors were encountered: