Allow base field definitions to render

Created on 21 September 2021, over 3 years ago
Updated 28 April 2025, 14 days ago

Problem/Motivation

Yeah, it looks like the date fields created through ::baseFieldDefinitions() expects the date format to be "U" when there are instances where these fields are of datetime type. We are using civicrm_entity which creates fields using basefielddefinitions.

Steps to reproduce

Have a entity or custom entity that creates datetime fields using ::baseFieldDefinitions().

Proposed resolution

Allow modules that make use of ::baseFieldDefinitions() to have a correct date format.

🐛 Bug report
Status

Fixed

Version

1.0

Component

Code

Created by

🇵🇭Philippines dsdeiz

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.

  • 🇨🇦Canada joelpittet Vancouver

    This is much apperciated, the patch didn't apply so I rewrote it a bit but otherwise it's as you suggested. Default is 'U'.

          $storage_format = match ($datetime_type) {
            DateTimeItem::DATETIME_TYPE_DATE => DateTimeItemInterface::DATE_STORAGE_FORMAT,
            DateTimeItem::DATETIME_TYPE_DATETIME => DateTimeItemInterface::DATETIME_STORAGE_FORMAT,
            default => 'U',
          };
    
    • joelpittet committed c837ffc5 on 8.x-1.x
      Issue #3238239 by dsdeiz, joelpittet: Allow base field definitions to...
Production build 0.71.5 2024