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

ACF Date Time Picker field nested under ACF Pro Repeater field returns epoch datetime when value is more than 10 days in the future or past #248

Open
2 of 3 tasks
PhillipVanWyk opened this issue Jan 3, 2025 · 0 comments

Comments

@PhillipVanWyk
Copy link

Description

ACF Date Time Picker fields nested inside a ACF Pro Repeater field resolves as the epoch date/time (1970-01-01T00:00:00+00:00) in WPGraphQL queries when the Date Time Picker field's value date is more than 10 days in the past or future relative to the current date and time.

Dates within 10 days in the past or future, resolves with the correct date and time. Date Time Picker fields that are not nested inside a Repeater field resolves with the correct date/time for all future or past date/time values.

This bug appears to be similar to issue #212, though in that case it's a Date Picker field nested in a Flexible Content field.

Date Time Picker saved with value greater than 10 days in the future:
future-date-time

Resolved as the epoch date/time:
resolve-epoch

Date Time Picker saved within 10 days in the future:
future-date-ten-day

Resolved as correct date/time:
resolve-correct

Steps to reproduce

  1. Create ACF Field group and assign it to post type of Page.
  2. Add "Repeater" field and add a "Date Time Picker" sub-field.
  3. On the post edit screen, add a new row int he repeater field and select a date/time value greater than 10 days in the past or future relative to the current date/time.
  4. Query the post, repeater field, and date time picker field using GraphiQL IDE.

PHP or JSON export of the ACF Field Group(s)

[
{
"key": "group_67782ed4aa68d",
"title": "Field Group",
"fields": [
{
"key": "field_67782ed4ac72a",
"label": "Repeater Field",
"name": "repeaterWithPicker",
"aria-label": "",
"type": "repeater",
"instructions": "",
"required": 0,
"conditional_logic": 0,
"wrapper": {
"width": "",
"class": "",
"id": ""
},
"layout": "block",
"pagination": 0,
"min": 0,
"max": 0,
"collapsed": "",
"button_label": "Add Row",
"show_in_graphql": 1,
"graphql_description": "",
"graphql_field_name": "repeaterWithPicker",
"graphql_non_null": 0,
"rows_per_page": 20,
"sub_fields": [
{
"key": "field_67782ed4ad28f",
"label": "Date Time Picker",
"name": "nestedDatetimePicker",
"aria-label": "",
"type": "date_time_picker",
"instructions": "",
"required": 0,
"conditional_logic": 0,
"wrapper": {
"width": "",
"class": "",
"id": ""
},
"display_format": "F j, Y g:i a",
"return_format": "d/m/Y g:i a",
"first_day": 1,
"allow_in_bindings": 0,
"show_in_graphql": 1,
"graphql_description": "",
"graphql_field_name": "nestedDateTimePicker",
"graphql_non_null": 0,
"parent_repeater": "field_67782ed4ac72a"
}
]
}
],
"location": [
[
{
"param": "post_type",
"operator": "==",
"value": "post"
}
]
],
"menu_order": 0,
"position": "normal",
"style": "default",
"label_placement": "top",
"instruction_placement": "label",
"hide_on_screen": "",
"active": true,
"description": "",
"show_in_rest": 0,
"show_in_graphql": 1,
"graphql_field_name": "groupWithRepeater",
"map_graphql_types_from_location_rules": 0,
"graphql_types": ""
}
]

Additional context

No response

WPGraphQL Version

1.29.3

WPGraphQL For ACF Version

2.4.1

ACF (Advanced Custom Fields) Version. Free or Pro?

ACF Pro Ver. 6.3.11

WordPress Version

6.7.1

PHP Version

8.1.29

Additional enviornment details

No response

Please confirm that you have searched existing issues in the repo.

  • Yes

Please confirm that you have disabled ALL plugins except for WPGraphQL, WPGraphQL For ACF, ACF, etc.

  • Yes
  • My issue is with compatibility with a specific WordPress plugin, and I have listed all my installed plugins (and version info) above.
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

No branches or pull requests

1 participant