Entity metadata getter/setter ignores granularity

Created on 5 November 2017, about 7 years ago
Updated 18 December 2023, 11 months ago

Problem/Motivation

As a module user I want to have a consistent behaviour of date fields.

Steps to reproduce

  1. Add a date field to some content type and limit its granularity to year, month, day
  2. Set this field value via metadata wrapper with something like
    $wrapped_node->{$field_name}->value = $timestamp;
    
  3. Fetch value from the field

Expected behaviour: fetched value limited to specified granularity.
Current behaviour: fetched value is the same as was set, not changed in any way

Proposed resolution

Apply field granularity to the date in both date_entity_metadata_struct_getter() and date_entity_metadata_struct_setter().

Remaining tasks

  1. Write test - Done
  2. Write patch - Done
  3. Review
  4. Test
  5. Commit

User interface changes

None.

API changes

None.

Data model changes

None.

🐛 Bug report
Status

Needs review

Version

2.0

Component

Code

Created by

🇳🇿New Zealand RoSk0 Wellington

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.

Production build 0.71.5 2024