Normalization of date fields for CSL

Created on 17 March 2021, almost 4 years ago
Updated 13 June 2024, 6 months ago

Problem/Motivation

Date fields, eg. bibcite_date, do not render correctly when using `date-part` elements in CSL.

Currently the "date-parts" data is filled out by placing the scalar value of the field in an array. This data is passed to the citeproc-php processor, which is expects date-parts to be multi-dimensional array with ["yyyy", "mm", "dd"].

Proposed resolution

  • Update the field description for bibcite_date to indicate that the entry format should follow yyyy/mm/dd, as used in academicpuma/citeproc-php
  • Explode the stored string with the delimiter "/" when creating the "date-parts" data, instead of placing the scalar in the date-parts sections
πŸ› Bug report
Status

Needs review

Component

Code

Created by

πŸ‡¨πŸ‡¦Canada kienan

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • πŸ‡ΊπŸ‡ΈUnited States dalemoore

    I'm currently doing a review of this module to determine if I want to use it for my own new website (I'm about to start on my Ph.D. dissertation and am building a place to document the process!), or try to roll my own custom built solution, and so far the only hangup I have is that dates don't use proper Drupal date fields. Other than that, it's an amazing body of work. Are there still issues with dates like this? I wish we could capture the day along with the month and year for publication date, for instance, if that info is available. I haven't tested how this module interacts with Views, but I am hoping that we can setup filters to filter them by date as well wherever needed, and choose per bundle what date format we want. I remember in the past having difficulty with that in Views when dates are text fields...

  • Status changed to Needs work 6 months ago
  • πŸ‡ΊπŸ‡ΈUnited States DamienMcKenna NH, USA

    Any site that uses data from D7 migrated using bibcite_migrate and the format will be either "mm/yyyy" or "mm/dd/yyyy".

    The current code is:

        return [
          'date-parts' => [
            array_reverse(explode('/', $value)),
          ],
          'literal' => $value,
        ];
    

    I think it'd be worth building some settings to control this, because it's all really vague.

  • Status changed to Needs review 6 months ago
  • Open in Jenkins β†’ Open on Drupal.org β†’
    Core: 10.2.1 + Environment: PHP 7.3 & MySQL 5.7
    last update 6 months ago
    Patch Failed to Apply
  • πŸ‡ΊπŸ‡ΈUnited States DamienMcKenna NH, USA

    A simple patch that changes the logic to work with dates in the format "mm/dd/yyyy" for compatibility with migrated data.

    This should be configurable globally to control the format.

  • Open in Jenkins β†’ Open on Drupal.org β†’
    Core: 10.2.1 + Environment: PHP 7.3 & MySQL 5.7
    last update 6 months ago
    Patch Failed to Apply
  • πŸ‡ΊπŸ‡ΈUnited States DamienMcKenna NH, USA

    This updates the date field description to note that the date should be in the format mm/yyyy or mm/dd/yyyy.

Production build 0.71.5 2024