Problem/Motivation
In #2993165: Date Only field shows incorrect default value when UTC date is different than user's date we discovered that the documentation on \Drupal\Component\Datetime\DateTimePlus::setDefaultDateTime() should be improved.
This task was created to do this.
I think we should reconsider the documentation of \Drupal\Component\Datetime\DateTimePlus::setDefaultDateTime() - on its own this method leads to this problem. It's called from a few places in core but this is the only place where the timezone on the date might not be UTC. The other runtime place is \Drupal\datetime\DateTimeComputed::getValue() - fwiw I'm not sure if implementation is correct. Dates and timezone stuff is hard to reason about. But this should be in a follow-up to improve the docs on setDefaultDateTime
Thus spoketh @alexpott in #2993165-58: Date Only field shows incorrect default value when UTC date is different than user's date
Comments
Comment #2
alexpottI'm not sure how to fix the docs here - it is really complex but I think this method is very easy to use wrongly.