Skip to content

v1.7.2

Choose a tag to compare

@github-actions github-actions released this 27 May 13:47
· 768 commits to main since this release

Fixed — datetime_single / datetime_range in ACF repeater query loops (issue #22)

  • bws_datetime_single_core() and bws_datetime_range_core(): hard ! $post_id bail returned fallback before the field-read layer could resolve loop-row data. Tags inside GB Pro repeater loops (TYPE_OPTION site-options repeaters and TYPE_POST_META flat repeater rows) saw no output. Bail now relaxes when the block instance is in a loop-row context (generateblocks/loopItem set), matching the v1.7.0 pattern used by bws_post_custom_text_core(). Mode 2b reads via bws_read_field() then resolve the date/time values from $loop_item[$key].
  • bws_parse_combined_date_time(): ACF field-config lookups (bws_get_acf_return_format(), bws_parse_acf_date_value()) received $post_id = false in Mode 2b, so get_field_object() couldn't return the configured return_format. Custom return formats fell through to the generic-format parser and could mis-parse non-default storage. Resolves the ACF object_id once at the top of the function via the new bws_resolve_acf_object_id() helper and threads it through both lookups.
  • bws_parse_combined_date_time() time-only inheritance: when ACF return_format lookup failed (flat repeater subfields not findable via the resolved object_id), $date_is_time_only was false even for time-only stored values like "14:30:00". The inheritance branch was skipped, and DateTime::createFromFormat( 'H:i:s', ... ) produced a DateTime at today's date + parsed time instead of the start-field's date. Now falls back to raw-value pattern inspection via new bws_value_looks_time_only() helper when format metadata is unavailable, restoring the documented behavior ("Time-only values inherit date from start").
  • bws_datetime_range_core() with as:time on time-only fields: when both startKey and endKey resolved to time-only ACF stored values (no date component), the time-only-range branch was unreachable — it required $start_result['date'] to be populated, but start-side time-only values land under $start_result['time_only'] (no $inherit_date available for start context). The tag fell through to the diagnostic partial-parts branch, rendering Start time: 4:00 PM; End time: 7:30 PM instead of 4:00 pm–7:30 pm. Time-only branch now accepts either date or time_only from parse results, and runs before partial-parts.

Added

  • bws_resolve_acf_object_id( $instance, $post_id ) in content-helpers.php: single source of truth for resolving the ACF object_id used by get_field_object() / get_field() when the caller has no resolved row entity. Returns the explicit $post_id when set, 'option' for GB Pro TYPE_OPTION rows, the outer page's postId (from context) for TYPE_POST_META rows, or 0 otherwise. Reusable by other ACF-aware helpers (image-helpers, relationship validation).
  • bws_value_looks_time_only( $value ) in datetime-helpers.php: format-agnostic detection for time-only ACF stored values ("14:30:00", "2:30 PM", etc.). Used as fallback in bws_parse_combined_date_time() when ACF return_format lookup fails on repeater subfields.