Date token descriptions are confusing

Created on 9 August 2023, over 1 year ago
Updated 27 November 2023, 12 months ago

API page: https://api.drupal.org/api/drupal/core%21modules%21system%21system.token...

The date tokens' descriptions all say 'a date':

> 'description' => t("A date in 'short' format. (%date)", [

What date? If you look at hook_tokens(), it's the current date, but the description should make that clear.

๐Ÿ› Bug report
Status

Fixed

Version

10.2 โœจ

Component
Documentationย  โ†’

Last updated 1 day ago

No maintainer
Created by

๐Ÿ‡ฌ๐Ÿ‡งUnited Kingdom joachim

Live updates comments and jobs are added and updated live.
  • Novice

    It would make a good project for someone who is new to the Drupal contribution process. It's preferred over Newbie.

Sign in to follow issues

Comments & Activities

  • Issue created by @joachim
  • First commit to issue fork.
  • Status changed to Closed: works as designed over 1 year ago
  • ๐Ÿ‡ง๐Ÿ‡ทBrazil stephencamilo curitiba

    Hello @joachim,

    Using 'a date' is suitable since the format can be applied to any date, not exclusively the current date.

    I am planning to mark this issue as resolved. However, if you have an alternate input, please don't hesitate to share.

    Thank you!

  • Status changed to Active over 1 year ago
  • @joachim is a prolific core contributor so it probably is adequately described.

  • By โ€œitโ€ I mean โ€œthis issueโ€.

  • ๐Ÿ‡ฌ๐Ÿ‡งUnited Kingdom joachim

    The various date tokens insert the current date, using the particular format -- at least that's what hook_tokens() looks like it's doing.

  • ๐Ÿ‡ฌ๐Ÿ‡งUnited Kingdom FlusteredLondon

    I'm working on this at DrupalCon 2023

  • ๐Ÿ‡ฌ๐Ÿ‡งUnited Kingdom FlusteredLondon

    I tried to work on this, but the existing fork does not install correctly - looks like an issue with composer dependencies.

    Should I ignore the fork and make another?

    ------------------------------

     Problem 1
        - Root composer.json requires drupal/core-recommended == 11.9999999.9999999.9999999-dev -> satisfiable by drupal/core-recommended[11.x-dev].
        - drupal/core-recommended 11.x-dev requires drupal/core 10.2.x-dev -> satisfiable by drupal/core[10.2.x-dev] from composer repo (https://repo.packagist.org) but drupal/core[dev-3380239-date-token-descriptions, 11.x-dev] from path repo (repos/drupal/core) has higher repository priority. The packages from the higher priority repository do not match your constraint and are therefore not installable. That repository is canonical so the lower priority repo's packages are not installable. See https://getcomposer.org/repoprio for details and assistance.
    
    Use the option --with-all-dependencies (-W) to allow upgrades, downgrades and removals for packages currently locked to specific versions.
    Failed to execute command composer update --lock: exit status 2
    Failed to run exec_dir composer update --lock; error=exit status 1
  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia anweshasinha

    Hi,
    I have created a patch for the issue mentioned where I have changed the descriptions in system_token_info(). Could you please review it and provide the feedback.

  • Status changed to RTBC about 1 year ago
  • ๐Ÿ‡ฌ๐Ÿ‡งUnited Kingdom joachim

    Latest patch LGTM. Thanks!

  • ๐Ÿ‡บ๐Ÿ‡ธUnited States xjm

    Please remember to queue tests and verify there's a passing run before RTBCing stuff. I am queuing tests now.

  • Open in Jenkins โ†’ Open on Drupal.org โ†’
    Environment: PHP 8.1 & MariaDB 10.3.22
    last update about 1 year ago
    Build Successful
  • Status changed to Needs work about 1 year ago
  • ๐Ÿ‡บ๐Ÿ‡ธUnited States xjm

    Actually, this is not quite committable yet. It needs a small grammar fix for each string:

    +++ b/core/modules/system/system.tokens.inc
    @@ -57,27 +57,27 @@ function system_token_info() {
    -    'description' => t("A date in 'short' format. (%date)", ['%date' => $date_formatter->format($request_time, 'short')]),
    +    'description' => t("Current date in 'short' format. (%date)", ['%date' => $date_formatter->format($request_time, 'short')]),
    

    All of these need to begin with "the".

    While you are making the above changes, we recommend that you convert this patch to a merge request โ†’ . Merge requests are preferred over patches. Be sure to hide the old patch files as well. (Converting an issue to a merge request without other improvements is not recommended and will not receive credit.)

  • Status changed to Needs review about 1 year ago
  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia pradhumanjainOSL

    Made changes as per comment #12.

  • Status changed to Needs work about 1 year ago
  • The Needs Review Queue Bot โ†’ tested this issue.

    While you are making the above changes, we recommend that you convert this patch to a merge request โ†’ . Merge requests are preferred over patches. Be sure to hide the old patch files as well. (Converting an issue to a merge request without other contributions to the issue will not receive credit.)

  • First commit to issue fork.
  • @sourabhjain opened merge request.
  • Status changed to Needs review about 1 year ago
  • ๐Ÿ‡บ๐Ÿ‡ธUnited States xjm

    Remember to hide old patch files when converting to an MR. Thanks!

  • First commit to issue fork.
  • Status changed to Needs work about 1 year ago
  • ๐Ÿ‡บ๐Ÿ‡ธUnited States smustgrave

    Rebasing as the MR didn't have the gitlab stuff.

    Reroll was incorrect it seems feedback from #12 was left out, which was included in #13.

    Just a reminder this is still a novice tagged issue.

  • Status changed to RTBC about 1 year ago
  • ๐Ÿ‡บ๐Ÿ‡ธUnited States smustgrave

    Edit seems it was addressed, not sure it wasn't showing up at first..

  • ๐Ÿ‡บ๐Ÿ‡ธUnited States xjm

    Thank @stephencamilo for your assistance on this issue.

    Please take note of the paragraph in #14:

    Converting an issue to a merge request without other contributions to the issue will not receive credit.

    Simple rerolls, rebases, merges, or conversions to merge requests no longer receive issue credit. Only updates that address a merge conflict or that include other fixes will be credited. For merge conflicts, the merge conflict that was resolved must be documented in the text of an issue comment.

    In general, we ask that contributors not convert issues to merge requests unless they are making other fixes. To receive credit for contributing to this issue, assist with other outstanding tasks or unaddressed feedback, or provide a review. Thanks!

    See the issue credit guidelines โ†’ for more information.

  • ๐Ÿ‡บ๐Ÿ‡ธUnited States xjm

    Crediting @joachim for the initial issue report, @anweshasinha for the original patch, @pradhumanjain2311 for improvements, @smustgrave for fixing the MR, and myself and @cilefen for issue management.

    In the future, when using a patch workflow, provide interdiffs โ†’ for your patches. That allows reviewers to evaluate your changes. (Or, better, use merge requests so interdiffs are not needed.) Thanks!

  • Status changed to Needs work about 1 year ago
  • ๐Ÿ‡บ๐Ÿ‡ธUnited States xjm

    OK, this looks pretty good now. I reviewed it locally with git diff --color-words to validate that all the changes are just this improvement.

    I also checked to see if there were any other instances of this wording in core. There are two other strings, but in those cases they're referring to generic dates:

    [ayrton:maintainer | Wed 13:39:41] $ grep -r -C2 "A date in"
    ./core/modules/update/src/ProjectSecurityData.php-   *
    ./core/modules/update/src/ProjectSecurityData.php-   * Two types of constants are supported:
    ./core/modules/update/src/ProjectSecurityData.php:   * - SECURITY_COVERAGE_END_DATE_[VERSION_MAJOR]_[VERSION_MINOR]: A date in
    ./core/modules/update/src/ProjectSecurityData.php-   *   'Y-m-d' or 'Y-m' format.
    ./core/modules/update/src/ProjectSecurityData.php-   * - SECURITY_COVERAGE_ENDING_WARN_DATE_[VERSION_MAJOR]_[VERSION_MINOR]: A
    --
    ./core/modules/views/src/Plugin/views/filter/Date.php-        '#title' => $this->t('Value type'),
    ./core/modules/views/src/Plugin/views/filter/Date.php-        '#options' => [
    ./core/modules/views/src/Plugin/views/filter/Date.php:          'date' => $this->t('A date in any machine readable format. CCYY-MM-DD HH:MM:SS is preferred.'),
    ./core/modules/views/src/Plugin/views/filter/Date.php-          'offset' => $this->t('An offset from the current time such as "@example1" or "@example2"', ['@example1' => '+1 day', '@example2' => '-2 hours -30 minutes']),
    ./core/modules/views/src/Plugin/views/filter/Date.php-        ],
    Binary file ./vendor/phpstan/phpstan/phpstan.phar matches

    Finally, I read core/modules/system/system.tokens.inc and confirmed that there are no other issues with date token info that I can see.

    However, there is still a small problem on the MR. It says "The Current date". "Current" should be lowercase: "The current date."

  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia sourabhjain

    Hi @xjm @smustgrave
    I intentionally deferred work on these issues. All the updates were made on November 14, 2023, and I've been addressing them sequentially in the Drupal issue queue without initially considering the tags assigned to each. I acknowledge this oversight and apologize for any confusion. Moving forward, I will ensure to prioritize and address issues based on their respective tags.

  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia keshav patel

    Keshav Patel โ†’ made their first commit to this issueโ€™s fork.

  • Status changed to Needs review 12 months ago
  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia keshav patel

    Changes made as per comment #24 in MR. Please review.

  • Status changed to RTBC 12 months ago
  • ๐Ÿ‡บ๐Ÿ‡ธUnited States smustgrave

    Current has been lowercased

    • xjm โ†’ committed c6ad6e20 on 11.x
      Issue #3380239 by smustgrave, pradhumanjain2311, FlusteredLondon, xjm,...
    • xjm โ†’ committed 245659c6 on 10.2.x
      Issue #3380239 by smustgrave, pradhumanjain2311, FlusteredLondon, xjm,...
  • ๐Ÿ‡บ๐Ÿ‡ธUnited States xjm

    Reviewed locally one last time with git diff --color-words.

    Committed to 11.x and 10.2.x as a minor-only UI string improvement. Thanks!

  • Status changed to Fixed 12 months ago
  • ๐Ÿ‡ฌ๐Ÿ‡งUnited Kingdom alexpott ๐Ÿ‡ช๐Ÿ‡บ๐ŸŒ
  • Automatically closed - issue fixed for 2 weeks with no activity.

Production build 0.71.5 2024