Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
The fields should default to the current date and time.
Comment | File | Size | Author |
---|---|---|---|
#1 | date_popup_authored.868592.patch | 857 bytes | timmillwood |
Comments
Comment #1
timmillwoodHere's a patch for this.
Comment #2
Mark TrappCore (and by extension, Date Popup Authored) doesn't set the default value when you load up the node/add form. This is because it could be a significant length of time between when the node form loads and the user actually submits the form to create the node.
Instead, Core (and Date Popup Authored) sets the date of the node at the time of submission if a date is not supplied. I'd rather not deviate from Core's usage, especially since there's a good reason.
That being said, there are three issues with your patch:
Y-m-d H:i:s O
: this isn't necessarily true. It's set to the site's short format. Date Popup Authored converts the user's value to Core's expected format upon submit.date()
does not take into account the user's time zone: it'll use the server's time zone.#default_value
todate('Y-m-d H:i:s O')
overwrites any previously set values (like when the user edits the node).If the default functionality—setting the post date to the time of submission if the authored field is blank—isn't working for you, please feel free to open a new issue.