Problem/Motivation

InvalidArgumentException: The timestamp must be numeric. in Drupal\Component\Datetime\DateTimePlus::createFromTimestamp()

Steps to reproduce

1. Open the publication_date module
2. Display the Published on field in the display setting of admin/structure/types/manage/CONTENT TYPE/display
3. Create a node with content type d. Do not fill in the data in the Published on field.
4. An error will be reported when clicking preview

Proposed resolution

Add validation on the viewElements method of Drupal\Core\Field\Plugin\Field\FieldFormatter\TimestampFormatter, skip if it is empty

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet

Issue fork drupal-3439347

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

    Comments

    randy Tang created an issue. See original summary.

    randy tang’s picture

    dineshkumarbollu’s picture

    Assigned: Unassigned » dineshkumarbollu
    StatusFileSize
    new41.29 KB

    +1 for error, i will review patch

    dineshkumarbollu’s picture

    StatusFileSize
    new92.1 KB

    Patch applied cleanly and fix the issue, Issue also reported in published_date module see https://www.drupal.org/project/publication_date/issues/3424575

    dineshkumarbollu’s picture

    Assigned: dineshkumarbollu » Unassigned
    cilefen’s picture

    quietone’s picture

    Status: Postponed (maintainer needs more info) » Closed (works as designed)
    Issue tags: +Bug Smash Initiative

    I agree with #6. And there has been no response for more information here for 4 months so I am closing this as works as designed.

    If you show this is a core bug, then add a comment and reopen the issue.

    Thanks!

    charlliequadros’s picture

    StatusFileSize
    new712 bytes

    Patch updated to Drupal version 10.3.1.

    paulmckibben’s picture

    I'm seeing this error on a site running Drupal 10.3.4 when I try to look at revisions for a taxonomy term. The revision in question is returning null for getRevisionCreationTime(), and that is leading to the exception described in this issue. I am not able to reproduce it on a clean Drupal 10 install, which leads me to suspect that the problem of the null revision creation time might be an artifact of upgrading this site over the years from Drupal 8 to 9 to 10.

    I don't know whether this is a one-off or some obscure upgrade bug, so I don't think it's worth reopening the issue. Documenting what I found in case it's helpful to somebody else.

    ordasoft’s picture

    Hello

    With "revision" check, the errors fixed like before proposed:
    file:
    core/lib/Drupal/Core/Entity/Controller/VersionHistoryController.php

    code:

    protected function getRevisionDescription(RevisionableInterface $revision): array {
        $context = [];
        if ($revision instanceof RevisionLogInterface  ) {
    

    replace to code:

    protected function getRevisionDescription(RevisionableInterface $revision): array {
        $context = [];
        if ($revision instanceof RevisionLogInterface && !empty($revision->getRevisionCreationTime() ) ) {

    Regards

    sanjay.maharjan’s picture

    Version: 10.2.x-dev » 10.3.x-dev
    Status: Closed (works as designed) » Patch (to be ported)
    StatusFileSize
    new1019 bytes

    Hi ,
    I got this issue when i upgraded my project to 10.3.x. As suggested by @ordasoft , code changes in #10 worked for me. I have created the patch with changes from #10.

    Regards,

    smustgrave’s picture

    Version: 10.3.x-dev » 11.x-dev
    Status: Patch (to be ported) » Postponed (maintainer needs more info)

    Will give it another chance but clear steps need to be added to the summary for 11.x. Nothing was committed so porting wasn’t an option

    smustgrave’s picture

    Status: Postponed (maintainer needs more info) » Closed (outdated)

    Since steps haven't been provided going to close out again. If still a bug please feel free to re-open, with steps to reproduce

    Thanks all!