soderlind / acf-field-date-time-picker

Date and Time Picker field for Advanced Custom Fields v3 and v4
GNU General Public License v2.0
65 stars 27 forks source link

Picker (sometimes) not showing in repeater fields #71

Closed avioli closed 9 years ago

avioli commented 9 years ago

When in repeater field it sometimes works, and sometimes doesn't. It turned out a class name was all that made a difference.

ACF5 Pro: Version 5.1.5 Picker: Version 2.0.18.1

See patch below.

From 241e1fc466de77d95daf25431881bc13f41393f2 Mon Sep 17 00:00:00 2001
From: Evo Stamatov <aviolito+github@gmail.com>
Date: Fri, 9 Jan 2015 16:45:31 +1100
Subject: [PATCH] fix timepicker not working on repeaters sometimes

---
 plugins/acf-field-date-time-picker/js/timepicker.js | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/plugins/acf-field-date-time-picker/js/timepicker.js b/plugins/acf-field-date-time-picker/js/timepicker.js
index 386f025..d3a4381 100644
--- a/plugins/acf-field-date-time-picker/js/timepicker.js
+++ b/plugins/acf-field-date-time-picker/js/timepicker.js
@@ -36,7 +36,7 @@
                                        , has_ampm = (input.attr('data-time_format').search(/t/i) != -1);

                                //don't apply datepicker to clone field
-                               if (input.parents('.acf-row.clone').length) {
+                               if (input.parents('.acf-row.clone,.acf-clone').length) {
                                        return;
                                }

--
1.8.4
ryanjbonnell commented 9 years ago

I can confirm this behavior occurs and the patch fixes the problem.

Tested using WordPress 3.9.2, ACF Pro 5.1.5 and ACF Date and Time Picker 2.0.18.

soderlind commented 9 years ago

Added the patch. Thank you for creating it :)