Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Date format mapper - redo #7041

Open
wants to merge 18 commits into
base: main
Choose a base branch
from
Open

Conversation

JoryHogeveen
Copy link
Member

@JoryHogeveen JoryHogeveen commented Mar 27, 2023

Related: #4525
Related: #5675

Description

This is a redo from an earlier PR: #5676
With this PR you can set your own formats when using date fields.

Text from prev PR:

The relates issue noted that using {@post_date} always displays the mysql format (Y-m-d h:i).
This PR sets this to the default formatting settings from WordPress.

This PR also adds a format param to the magic tag: {@post_date._format.Y-m-d}, {@post_date._format.Y m d} and even {@post_date._format.Y.m.d} (note the dots).
Currently this PR only supports this for core-field dates (post_date). But might be a cool feature for other date fields as well.

Would like to have feedback/ideas on how to best implement this.

This PR does NOT change the default behavior. It only adds the option to define a format (or select WP default format).

Testing instructions

  1. Go to '...'
  2. Click on '....'
  3. Scroll down to '....'
  4. See '....'

Screenshots / screencast

Changelog text for these changes

PR checklist

@JoryHogeveen JoryHogeveen added the Type: Feature Features that add entirely new functionality that was not there before label Mar 27, 2023
@JoryHogeveen JoryHogeveen added this to the Pods 2.9.14 milestone Mar 27, 2023
@JoryHogeveen JoryHogeveen self-assigned this Mar 27, 2023
@what-the-diff
Copy link

what-the-diff bot commented Mar 27, 2023

PR Summary

  • 🆕 New method added to Map_Field_Values class
    A new method has been introduced to handle mapping of date field values effectively.
  • 📅 Enhanced date field value mapping
    Now, the method supports special tags like _format and wp, improving the mapping process for date fields.
  • 📌 Support for post type fields
    The update also includes support for post type fields like post_date and post_modified.

Copy link
Member

@sc0ttkclark sc0ttkclark left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some changes here needed but it's very close. Let's be sure to add coverage for all of the available options/logic in the tests/codeception/wpunit/Pods/MappingTest.php file.

@what-the-diff
Copy link

what-the-diff bot commented Mar 29, 2023

PR Summary

  • 🆕 Added a new method to the Map_Field_Values class
    Enhances the functionality of Map_Field_Values by introducing a new method
  • Updated the corresponding test case
    Ensures that the new method works as expected by updating the test_date_fields() test case in the MappingTest class

Co-authored-by: Scott Kingsley Clark <[email protected]>
@what-the-diff
Copy link

what-the-diff bot commented Mar 29, 2023

PR Summary

  • 🗓️ Added a new handler for date fields
    This update adds a new feature to process date fields more effectively.
  • 🧪 Updated test suite to cover the new feature
    The tests have been expanded to ensure that the new date field handler works as expected.

@what-the-diff
Copy link

what-the-diff bot commented Mar 29, 2023

PR Summary

  • 🗓️ Added a new mapping handler for date fields
    This change makes it easier to manage date-related information.
  • 🧪 Updated the test suite for the new feature
    Now includes tests to ensure the date field handling feature works correctly.

@what-the-diff
Copy link

what-the-diff bot commented Mar 29, 2023

PR Summary

  • 🗓️ Added new mapping handler for date fields
    A new handler that helps manage date fields more effectively has been added.
  • 🧪 Updated test suite for new feature
    The test suite has been expanded to include tests ensuring this new date field handler works as expected.

@what-the-diff
Copy link

what-the-diff bot commented Mar 29, 2023

PR Summary

  • 🗓️ Added a new mapping handler for date fields
    Now our app can better understand and handle date information.
  • 🧪 Updated the test suite for the new feature
    Ensures that the new date field mapping handler works as expected.

@what-the-diff
Copy link

what-the-diff bot commented Mar 29, 2023

PR Summary

  • 🗓️ Added a new mapping handler for date fields
    This update makes it easier to work with date fields in the software.
  • 🧪 Updated the test suite for date field mapping
    Ensures the new feature is covered by tests and functions properly.

@what-the-diff
Copy link

what-the-diff bot commented Mar 29, 2023

PR Summary

  • 📆 Added a new mapping handler for date fields
    This update improves how date information is handled in the system
  • 🖼️ Updated image field mapper to use pods_traverse()
    Fixes issues with nested traversal paths and ensures compatibility with PHP 7+ (see Support REST API for Pods ACTs #5126)

Copy link
Member

@sc0ttkclark sc0ttkclark left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me, we could improve with some assertions on an object field but it's good either way

Copy link
Member

@sc0ttkclark sc0ttkclark left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@sc0ttkclark sc0ttkclark changed the base branch from main to release/2.9.14 April 3, 2023 18:15
@JoryHogeveen
Copy link
Member Author

There's a test failure on the first assertion at https://github.com/pods-framework/pods/pull/7041/files#diff-2c2cd009a6ec8c79443141f820e785b79db4f0d63491de1d5a2bf0d978f271fbR620

https://github.com/pods-framework/pods/actions/runs/4554822589/jobs/8033220382?pr=7041#step:15:44

I do not get why the tests are failing, and definitely not why it returns false.
When I test the field locally it works, only the tests (also locally) are failing.

@sc0ttkclark sc0ttkclark changed the base branch from release/2.9.14 to release/3.0 April 25, 2023 02:40
@sc0ttkclark sc0ttkclark modified the milestones: Pods 2.9.14, Pods 3.0 Apr 25, 2023
@sc0ttkclark sc0ttkclark modified the milestones: Pods 3.0, Backlog Jun 25, 2023
Base automatically changed from release/3.0 to main September 13, 2023 14:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Feature Features that add entirely new functionality that was not there before
Projects
Status: 🏗 In progress
Development

Successfully merging this pull request may close these issues.

2 participants