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

Restrict to convert meta value into date if year is greater than 2099 #2828

Merged
merged 3 commits into from
Jun 14, 2022

Conversation

burhandodhy
Copy link
Contributor

Description of the Change

prepare_date_meta_values converts the meta into date even they are not. This PR adds the restriction that will check that if the meta year is greater than 2099 than don't convert into datetime format

Closes #2769

Changelog Entry

Fixed: Meta values that are not date are converted into date format

Credits

Props @burhandodhy

@felipeelia felipeelia added this to the 4.2.1 milestone Jun 7, 2022
@felipeelia felipeelia self-assigned this Jun 7, 2022
includes/classes/Indexable.php Outdated Show resolved Hide resolved
@felipeelia felipeelia assigned burhandodhy and unassigned felipeelia Jun 7, 2022
Comment on lines 726 to 735
/**
* Filter the maximum year limit for date conversion.
*
* @hook ep_max_year_limit
* @param {int} $year Maximum year limit.
* @return {int} Maximum year limit.
*/
// Use default date if year is greater than max limit. EP has limitation that doesn't allow to have year greater than 2099.
// @see https://github.com/10up/ElasticPress/issues/2769
$max_year = apply_filters( 'ep_max_year_limit', 2099 );
Copy link
Member

Choose a reason for hiding this comment

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

This is looking better @burhandodhy, thanks. Some changes are still needed though.

  1. The Use default... text and the @see tag should be part of the "docblock", i.e., instead of having // in front of them, they should be part of the comment with /**. Here is an example of a docblock with an additional comment.
  2. Can you please add a @since tag with 4.2.1?
    Thanks!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks for pointing out the mistake. Feeback is addressed.

@felipeelia felipeelia merged commit 68b0b4a into develop Jun 14, 2022
@felipeelia felipeelia deleted the fix/2769 branch June 14, 2022 14:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

BUG: values that are not dates can get formatted as if they were
2 participants