Date and Time Picker Field - Version 2.0.18

Version Description

  • Thanks to kamilgrzegorczyk, Fixing clone field issue in repeater
Download this release

Release Info

Developer PerS
Plugin Icon 128x128 Date and Time Picker Field
Version 2.0.18
Comparing to
See all releases

Code changes from version 2.0.16 to 2.0.18

acf-date_time_picker.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: Advanced Custom Fields: Date and Time Picker
4
  Plugin URI: https://github.com/soderlind/acf-field-date-time-picker
5
  Description: Date and Time Picker field for Advanced Custom Fields
6
- Version: 2.0.16
7
  Author: Per Soderlind
8
  Author URI: http://soderlind.no
9
  License: GPLv2 or later
3
  Plugin Name: Advanced Custom Fields: Date and Time Picker
4
  Plugin URI: https://github.com/soderlind/acf-field-date-time-picker
5
  Description: Date and Time Picker field for Advanced Custom Fields
6
+ Version: 2.0.18
7
  Author: Per Soderlind
8
  Author URI: http://soderlind.no
9
  License: GPLv2 or later
date_time_picker-v5.php CHANGED
@@ -153,11 +153,13 @@ class acf_field_date_time_picker extends acf_field
153
  function render_field( $field ) {
154
 
155
  if ( $field['show_date'] !== 'true' ) {
156
- echo '<input type="text" value="' . $field['value'] . '" name="' . $field['name'] . '" class="ps_timepicker" value="" data-picker="' . $field['picker'] . '" data-time_format="' . $field['time_format'] . '" title="' . $field['label'] . '" />';
157
- } else {
158
- echo '<input type="text" value="' . $field['value'] . '" name="' . $field['name'] . '" class="ps_timepicker" value="" data-picker="' . $field['picker'] . '" data-date_format="' . $field['date_format'] . '" data-time_format="' . $field['time_format'] . '" data-show_week_number="' . $field['show_week_number'] . '" title="' . $field['label'] . '" />';
159
- }
160
- }
 
 
161
 
162
  function format_value($value, $post_id, $field)
163
  {
153
  function render_field( $field ) {
154
 
155
  if ( $field['show_date'] !== 'true' ) {
156
+ $value = $field['save_as_timestamp'] && $this->isValidTimeStamp($field['value']) ? date_i18n(sprintf("%s",$this->js_to_php_timeformat($field['time_format'])), $field['value']) : $field['value'];
157
+ echo '<input type="text" value="' . $value . '" name="' . $field['name'] . '" class="ps_timepicker" value="" data-picker="' . $field['picker'] . '" data-time_format="' . $field['time_format'] . '" title="' . $field['label'] . '" />';
158
+ } else {
159
+ $value = $field['save_as_timestamp'] && $this->isValidTimeStamp($field['value']) ? $value = date_i18n(sprintf("%s %s", $this->js_to_php_dateformat($field['date_format']),$this->js_to_php_timeformat($field['time_format'])), $field['value']) : $field['value'];
160
+ echo '<input type="text" value="' . $value . '" name="' . $field['name'] . '" class="ps_timepicker" value="" data-picker="' . $field['picker'] . '" data-date_format="' . $field['date_format'] . '" data-time_format="' . $field['time_format'] . '" data-show_week_number="' . $field['show_week_number'] . '" title="' . $field['label'] . '" />';
161
+ }
162
+ }
163
 
164
  function format_value($value, $post_id, $field)
165
  {
js/timepicker.js CHANGED
@@ -35,10 +35,10 @@
35
  , time_format = input.attr('data-time_format')
36
  , has_ampm = (input.attr('data-time_format').search(/t/i) != -1);
37
 
38
- /*if( acf.helpers.is_clone_field(input) )
39
- {
40
  return;
41
- }*/
42
 
43
 
44
  input.addClass('active').attr("placeholder", (is_timeonly) ? time_format : date_format + ' ' + time_format).datetimepicker({
@@ -150,4 +150,4 @@
150
  });
151
  });
152
  }
153
- })(jQuery);
35
  , time_format = input.attr('data-time_format')
36
  , has_ampm = (input.attr('data-time_format').search(/t/i) != -1);
37
 
38
+ //don't apply datepicker to clone field
39
+ if (input.parents('.acf-row.clone').length) {
40
  return;
41
+ }
42
 
43
 
44
  input.addClass('active').attr("placeholder", (is_timeonly) ? time_format : date_format + ' ' + time_format).datetimepicker({
150
  });
151
  });
152
  }
153
+ })(jQuery);
readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate link: http://soderlind.no/donate/
4
  Tags: acf, custom field,datepicker,timepicker
5
  Requires at least: 3.6
6
  Tested up to: 3.9
7
- Stable tag: 2.0.16
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -112,6 +112,10 @@ TT AM or PM for AM/PM
112
  The Date and Time Picker field is saved as an UNIX timestamp. Use the PHP [date](http://php.net/manual/en/function.date.php) function when you use it in your theme.
113
 
114
  == Changelog ==
 
 
 
 
115
  = 2.0.16 =
116
  * Fix Undefined property: acf_field_date_time_picker::$domain
117
  = 2.0.15 =
4
  Tags: acf, custom field,datepicker,timepicker
5
  Requires at least: 3.6
6
  Tested up to: 3.9
7
+ Stable tag: 2.0.18
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
112
  The Date and Time Picker field is saved as an UNIX timestamp. Use the PHP [date](http://php.net/manual/en/function.date.php) function when you use it in your theme.
113
 
114
  == Changelog ==
115
+ = 2.0.18 =
116
+ * Thanks to [kamilgrzegorczyk](https://github.com/kamilgrzegorczyk), Fixing clone field issue in repeater
117
+ = 2.0.17 =
118
+ * Thanks to [leocaseiro](https://github.com/leocaseiro), Fix Backend Timestamp handling: `render_field` and Tested Up WordPress 4.0
119
  = 2.0.16 =
120
  * Fix Undefined property: acf_field_date_time_picker::$domain
121
  = 2.0.15 =