mirror of
https://github.com/DanielnetoDotCom/YouPHPTube
synced 2025-10-03 09:49:28 +02:00
Refactor getDate method to remove unnecessary whitespace and improve readability
This commit is contained in:
parent
cb00dabd5e
commit
e6f3ce9e00
1 changed files with 3 additions and 3 deletions
|
@ -99,7 +99,7 @@ class EpgParser {
|
||||||
*/
|
*/
|
||||||
public function getDate(string $date) {
|
public function getDate(string $date) {
|
||||||
$date = str_replace(' 0000', ' +0000', $date);
|
$date = str_replace(' 0000', ' +0000', $date);
|
||||||
|
|
||||||
// Handle ISO 8601 format with milliseconds: "2025-09-22T00:00:00.000 +0000"
|
// Handle ISO 8601 format with milliseconds: "2025-09-22T00:00:00.000 +0000"
|
||||||
try {
|
try {
|
||||||
$dt = \DateTime::createFromFormat('Y-m-d\TH:i:s.u P', $date, new DateTimeZone('UTC'));
|
$dt = \DateTime::createFromFormat('Y-m-d\TH:i:s.u P', $date, new DateTimeZone('UTC'));
|
||||||
|
@ -112,7 +112,7 @@ class EpgParser {
|
||||||
} catch (\Error $e) {
|
} catch (\Error $e) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Handle compact format with space-separated timezone: "20250924004920 0000"
|
// Handle compact format with space-separated timezone: "20250924004920 0000"
|
||||||
try {
|
try {
|
||||||
$dt = \DateTime::createFromFormat('YmdHis O', $date, new DateTimeZone('UTC'));
|
$dt = \DateTime::createFromFormat('YmdHis O', $date, new DateTimeZone('UTC'));
|
||||||
|
@ -125,7 +125,7 @@ class EpgParser {
|
||||||
} catch (\Error $e) {
|
} catch (\Error $e) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$dt = \DateTime::createFromFormat('YmdHis P', $date, new DateTimeZone('UTC'));
|
$dt = \DateTime::createFromFormat('YmdHis P', $date, new DateTimeZone('UTC'));
|
||||||
$dt->setTimezone(new DateTimeZone($this->targetTimeZone));
|
$dt->setTimezone(new DateTimeZone($this->targetTimeZone));
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue