-
Notifications
You must be signed in to change notification settings - Fork 14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bugfix/issue 1429 (Zeitzone Cronjobs) #1430
base: master
Are you sure you want to change the base?
Conversation
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## master #1430 +/- ##
============================================
+ Coverage 39.76% 39.86% +0.10%
- Complexity 2324 2326 +2
============================================
Files 91 91
Lines 9602 9609 +7
============================================
+ Hits 3818 3831 +13
+ Misses 5784 5778 -6 ☔ View full report in Codecov by Sentry. |
$datetime = date_create( $localDateString, wp_timezone() ); | ||
|
||
if ( $datetime === false ) { | ||
//use this as fallback if date_create fails |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wieso der fallback? Und für welche Fälle? Wieso nicht einfach auch false zurückgeben, anstatt potentiell eine falsche Zeit.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Das ist aus der WordPress Funktion übernommen, ich dachte mir das ist schon gut getestet also übernehme ich das :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Und wenn wir eine falsche Zeit zurückgeben wird zumindest der Job geschedulet, sonst führt das ganze vielleicht zu Fehlern.
* | ||
* @return DateTime | ||
* @throws \Exception | ||
*/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@hansmorb hast du zufällig geschaut ob die Verwendung dieser Methode denn in einer korrekten Umfeld stattfindet? Das Umfeld also nicht annimmt das hier eine umgewandelte UTC-Zeit einer lokalen Zeit rauskommt?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ich denke mal die Methode hat so wie sie existiert schon ihre Berechtigung, schließlich speichern wir ja alle timestamps in lokaler Zeit und nicht in UTC. Mit dieser Methode wird einfach nur ein DateTime Objekt erzeugt. Das ist dann zwar immer noch nicht in UTC aber hat zumindest eine Zeitzone (das war glaube ich für den iCalendar relevant).
Habe jetzt doch nicht wie geplant die get_gmt_from_date ( https://developer.wordpress.org/reference/functions/get_gmt_from_date/ ) genutzt sondern nur die Implementierung kopiert und dafür ein DateTime Objekt statt eines formatierten Strings zurückgegeben. Das hat jetzt bei mir wie erwartet funktioniert. Das ist hier für den einen Case nicht so spannend, aber mit der #1423 kommen zwei neue E-Mails hinzu die diese Funktion nutzen, da wird das schon semi relevant.
closes #1429