Date and Time Picker Field - Version 2.0.11

Version Description

  • Added option to retrive field values, using the_field() and get_field(), as a timestamp
Download this release

Release Info

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

Code changes from version 2.0.10 to 2.0.11

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.10
7
  Author: Per Soderlind
8
  Author URI: http://soderlind.no
9
  License: GPLv2 or later
@@ -16,59 +16,59 @@ class acf_field_date_time_picker_plugin
16
  /*
17
  * Construct
18
  *
19
- * @description:
20
  * @since: 3.6
21
  * @created: 1/04/13
22
  */
23
-
24
  function __construct()
25
  {
26
  // set text domain
27
  $domain = 'acf-date_time_picker';
28
  $mofile = trailingslashit(dirname(__File__)) . 'lang/' . $domain . '-' . get_locale() . '.mo';
29
  load_textdomain( $domain, $mofile );
30
-
31
-
32
  // version 4+
33
- add_action('acf/register_fields', array($this, 'register_fields'));
 
34
 
35
-
36
  // version 3-
37
  add_action( 'init', array( $this, 'init' ));
38
  }
39
-
40
-
41
  /*
42
  * Init
43
  *
44
- * @description:
45
  * @since: 3.6
46
  * @created: 1/04/13
47
  */
48
-
49
  function init()
50
  {
51
  if(function_exists('register_field'))
52
- {
53
  register_field('acf_field_date_time_picker', dirname(__File__) . '/date_time_picker-v3.php');
54
  }
55
  }
56
-
57
  /*
58
  * register_fields
59
  *
60
- * @description:
61
  * @since: 3.6
62
  * @created: 1/04/13
63
  */
64
-
65
  function register_fields()
66
  {
67
  include_once('date_time_picker-v4.php');
68
  }
69
-
70
  }
71
 
72
  new acf_field_date_time_picker_plugin();
73
-
74
  ?>
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.11
7
  Author: Per Soderlind
8
  Author URI: http://soderlind.no
9
  License: GPLv2 or later
16
  /*
17
  * Construct
18
  *
19
+ * @description:
20
  * @since: 3.6
21
  * @created: 1/04/13
22
  */
23
+
24
  function __construct()
25
  {
26
  // set text domain
27
  $domain = 'acf-date_time_picker';
28
  $mofile = trailingslashit(dirname(__File__)) . 'lang/' . $domain . '-' . get_locale() . '.mo';
29
  load_textdomain( $domain, $mofile );
30
+
31
+
32
  // version 4+
33
+ add_action('acf/register_fields', array($this, 'register_fields'));
34
+
35
 
 
36
  // version 3-
37
  add_action( 'init', array( $this, 'init' ));
38
  }
39
+
40
+
41
  /*
42
  * Init
43
  *
44
+ * @description:
45
  * @since: 3.6
46
  * @created: 1/04/13
47
  */
48
+
49
  function init()
50
  {
51
  if(function_exists('register_field'))
52
+ {
53
  register_field('acf_field_date_time_picker', dirname(__File__) . '/date_time_picker-v3.php');
54
  }
55
  }
56
+
57
  /*
58
  * register_fields
59
  *
60
+ * @description:
61
  * @since: 3.6
62
  * @created: 1/04/13
63
  */
64
+
65
  function register_fields()
66
  {
67
  include_once('date_time_picker-v4.php');
68
  }
69
+
70
  }
71
 
72
  new acf_field_date_time_picker_plugin();
73
+
74
  ?>
date_time_picker-v3.php CHANGED
@@ -35,13 +35,14 @@ class acf_field_date_time_picker extends acf_Field {
35
  , 'show_week_number' => 'false'
36
  , 'picker' => 'slider'
37
  , 'save_as_timestamp' => 'true'
 
38
  );
39
 
40
  $this->settings = array(
41
  'path' => $this->helpers_get_path( __FILE__ )
42
  , 'dir' => $this->helpers_get_dir( __FILE__ )
43
  , 'version' => '2.0.9'
44
- );
45
  }
46
 
47
 
@@ -52,13 +53,13 @@ class acf_field_date_time_picker extends acf_Field {
52
  * @since: 3.6
53
  * @created: 30/01/13
54
  */
55
-
56
  function helpers_get_path( $file ) {
57
  return trailingslashit(dirname($file));
58
  }
59
-
60
-
61
-
62
  /*
63
  * helpers_get_dir
64
  *
@@ -66,36 +67,36 @@ class acf_field_date_time_picker extends acf_Field {
66
  * @since: 3.6
67
  * @created: 30/01/13
68
  */
69
-
70
  function helpers_get_dir( $file ) {
71
  $dir = trailingslashit(dirname($file));
72
  $count = 0;
73
-
74
-
75
  // sanitize for Win32 installs
76
- $dir = str_replace('\\' ,'/', $dir);
77
-
78
-
79
  // if file is in plugins folder
80
- $wp_plugin_dir = str_replace('\\' ,'/', WP_PLUGIN_DIR);
81
  $dir = str_replace($wp_plugin_dir, WP_PLUGIN_URL, $dir, $count);
82
-
83
-
84
  if( $count < 1 )
85
  {
86
  // if file is in wp-content folder
87
- $wp_content_dir = str_replace('\\' ,'/', WP_CONTENT_DIR);
88
  $dir = str_replace($wp_content_dir, WP_CONTENT_URL, $dir, $count);
89
  }
90
-
91
-
92
  if( $count < 1 )
93
  {
94
  // if file is in ??? folder
95
- $wp_dir = str_replace('\\' ,'/', ABSPATH);
96
  $dir = str_replace($wp_dir, site_url('/'), $dir);
97
  }
98
-
99
 
100
  return $dir;
101
  }
@@ -197,7 +198,7 @@ class acf_field_date_time_picker extends acf_Field {
197
  <td>
198
  <?php
199
  $this->parent->create_field( array(
200
- 'type' => 'radio'
201
  , 'name' => 'fields['.$key.'][picker]'
202
  , 'value' => $field['picker']
203
  , 'layout' => 'horizontal'
@@ -229,6 +230,26 @@ class acf_field_date_time_picker extends acf_Field {
229
  ?>
230
  </td>
231
  </tr>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
232
  <?php
233
 
234
  }
@@ -269,7 +290,7 @@ class acf_field_date_time_picker extends acf_Field {
269
  *
270
  * @author Elliot Condon
271
  * @since 2.2.0
272
- *
273
  *-------------------------------------------------------------------------------------*/
274
 
275
  function update_value($post_id, $field, $value) {
@@ -281,7 +302,7 @@ class acf_field_date_time_picker extends acf_Field {
281
  $date = DateTime::createFromFormat(sprintf("%s",$this->js_to_php_timeformat($field['time_format'])), $value);
282
  }
283
  $value = $date->getTimestamp();
284
- }
285
 
286
  parent::update_value($post_id, $field, $value);
287
  }
@@ -299,7 +320,7 @@ class acf_field_date_time_picker extends acf_Field {
299
  *
300
  * @author Elliot Condon
301
  * @since 2.2.0
302
- *
303
  *-------------------------------------------------------------------------------------*/
304
 
305
  function get_value($post_id, $field){
@@ -314,25 +335,40 @@ class acf_field_date_time_picker extends acf_Field {
314
  }
315
  }
316
 
317
- return $value;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
318
  }
319
 
320
- function js_to_php_dateformat($date_format) {
321
- $chars = array(
322
  // Day
323
  'dd' => 'd', 'd' => 'j', 'DD' => 'l', 'D' => 'D', 'o' => 'z',
324
- // Month
325
- 'mm' => 'm', 'm' => 'n', 'MM' => 'F', 'M' => 'M',
326
- // Year
327
- 'yy' => 'Y', 'y' => 'y',
328
- );
329
 
330
- return strtr((string)$date_format, $chars);
331
  }
332
 
333
 
334
  function js_to_php_timeformat($time_format) {
335
-
336
  $chars = array(
337
  //hour
338
  'HH' => 'H', 'H' => 'G', 'hh' => 'h' , 'h' => 'g',
@@ -344,11 +380,11 @@ class acf_field_date_time_picker extends acf_Field {
344
  'TT' => 'A', 'T' => 'A', 'tt' => 'a', 't' => 'a'
345
  );
346
 
347
- return strtr((string)$time_format, $chars);
348
  }
349
 
350
  function isValidTimeStamp($timestamp) { //from http://stackoverflow.com/a/2524761/1434155
351
- return ((string) (int) $timestamp === $timestamp)
352
  && ($timestamp <= PHP_INT_MAX)
353
  && ($timestamp >= ~PHP_INT_MAX);
354
  }
@@ -373,7 +409,7 @@ class acf_field_date_time_picker extends acf_Field {
373
  wp_enqueue_script( 'jquery-ui-timepicker', $this->settings['dir'] . 'js/jquery-ui-timepicker-addon.js', array(
374
  'acf-datepicker',
375
  'jquery-ui-slider'
376
- ), $this->settings['version'], true );
377
 
378
  if ( file_exists( dirname( __FILE__ ) . '/js/localization/jquery-ui-timepicker-' . $js_locale . '.js' ) ) {
379
  wp_enqueue_script( 'timepicker-localization', $this->settings['dir'] . 'js/localization/jquery-ui-timepicker-' . $js_locale . '.js', array(
@@ -387,7 +423,7 @@ class acf_field_date_time_picker extends acf_Field {
387
  wp_enqueue_script( 'timepicker', $this->settings['dir'] . 'js/timepicker.js', array(
388
  'jquery-ui-timepicker'
389
  ), $this->settings['version'], true );
390
- }
391
 
392
  if ( ! $has_locale && $js_locale != 'en' ) {
393
  $timepicker_locale = array(
35
  , 'show_week_number' => 'false'
36
  , 'picker' => 'slider'
37
  , 'save_as_timestamp' => 'true'
38
+ , 'get_as_timestamp' => 'false'
39
  );
40
 
41
  $this->settings = array(
42
  'path' => $this->helpers_get_path( __FILE__ )
43
  , 'dir' => $this->helpers_get_dir( __FILE__ )
44
  , 'version' => '2.0.9'
45
+ );
46
  }
47
 
48
 
53
  * @since: 3.6
54
  * @created: 30/01/13
55
  */
56
+
57
  function helpers_get_path( $file ) {
58
  return trailingslashit(dirname($file));
59
  }
60
+
61
+
62
+
63
  /*
64
  * helpers_get_dir
65
  *
67
  * @since: 3.6
68
  * @created: 30/01/13
69
  */
70
+
71
  function helpers_get_dir( $file ) {
72
  $dir = trailingslashit(dirname($file));
73
  $count = 0;
74
+
75
+
76
  // sanitize for Win32 installs
77
+ $dir = str_replace('\\' ,'/', $dir);
78
+
79
+
80
  // if file is in plugins folder
81
+ $wp_plugin_dir = str_replace('\\' ,'/', WP_PLUGIN_DIR);
82
  $dir = str_replace($wp_plugin_dir, WP_PLUGIN_URL, $dir, $count);
83
+
84
+
85
  if( $count < 1 )
86
  {
87
  // if file is in wp-content folder
88
+ $wp_content_dir = str_replace('\\' ,'/', WP_CONTENT_DIR);
89
  $dir = str_replace($wp_content_dir, WP_CONTENT_URL, $dir, $count);
90
  }
91
+
92
+
93
  if( $count < 1 )
94
  {
95
  // if file is in ??? folder
96
+ $wp_dir = str_replace('\\' ,'/', ABSPATH);
97
  $dir = str_replace($wp_dir, site_url('/'), $dir);
98
  }
99
+
100
 
101
  return $dir;
102
  }
198
  <td>
199
  <?php
200
  $this->parent->create_field( array(
201
+ 'type' => 'radio'
202
  , 'name' => 'fields['.$key.'][picker]'
203
  , 'value' => $field['picker']
204
  , 'layout' => 'horizontal'
230
  ?>
231
  </td>
232
  </tr>
233
+ <tr class="field_option field_option_<?php echo $this->name; ?> timepicker_week_number">
234
+ <td class="label">
235
+ <label for=""><?php _e( "Get field as a timestamp?", $this->domain ); ?></label>
236
+ <p class="description"><?php printf( __( "Most users should leave this untouched, only set it to \"Yes\" if you need get the date and time field as a timestamp using <a href=\"%s\" target=\"_blank\">the_field()</a> or <a href=\"%s\" target=\"_blank\">get_field()</a> ", $this->domain ), "http://www.advancedcustomfields.com/resources/functions/the_field/", "http://www.advancedcustomfields.com/resources/functions/get_field/" );?></p>
237
+ </td>
238
+ <td>
239
+ <?php
240
+ $this->parent->create_field( array(
241
+ 'type' => 'radio'
242
+ , 'name' => 'fields['.$key.'][get_as_timestamp]'
243
+ , 'value' => $field['get_as_timestamp']
244
+ , 'layout' => 'horizontal'
245
+ , 'choices' => array(
246
+ 'true' => __( 'Yes', $this->domain )
247
+ , 'false' => __( 'No', $this->domain )
248
+ )
249
+ ) );
250
+ ?>
251
+ </td>
252
+ </tr>
253
  <?php
254
 
255
  }
290
  *
291
  * @author Elliot Condon
292
  * @since 2.2.0
293
+ *
294
  *-------------------------------------------------------------------------------------*/
295
 
296
  function update_value($post_id, $field, $value) {
302
  $date = DateTime::createFromFormat(sprintf("%s",$this->js_to_php_timeformat($field['time_format'])), $value);
303
  }
304
  $value = $date->getTimestamp();
305
+ }
306
 
307
  parent::update_value($post_id, $field, $value);
308
  }
320
  *
321
  * @author Elliot Condon
322
  * @since 2.2.0
323
+ *
324
  *-------------------------------------------------------------------------------------*/
325
 
326
  function get_value($post_id, $field){
335
  }
336
  }
337
 
338
+ return $value;
339
+ }
340
+
341
+ function get_value_for_api($post_id, $field){
342
+ $field = array_merge($this->defaults, $field);
343
+ $value = parent::get_value($post_id, $field);
344
+
345
+ if ($value != '' && $field['save_as_timestamp'] == 'true' && $field['get_as_timestamp'] != 'true' && $this->isValidTimeStamp($value)) {
346
+ if ( $field['show_date'] == 'true') {
347
+ $value = date(sprintf("%s %s",$this->js_to_php_dateformat($field['date_format']),$this->js_to_php_timeformat($field['time_format'])), $value);
348
+ } else {
349
+ $value = date(sprintf("%s",$this->js_to_php_timeformat($field['time_format'])), $value);
350
+ }
351
+ }
352
+
353
+ return $value;
354
  }
355
 
356
+ function js_to_php_dateformat($date_format) {
357
+ $chars = array(
358
  // Day
359
  'dd' => 'd', 'd' => 'j', 'DD' => 'l', 'D' => 'D', 'o' => 'z',
360
+ // Month
361
+ 'mm' => 'm', 'm' => 'n', 'MM' => 'F', 'M' => 'M',
362
+ // Year
363
+ 'yy' => 'Y', 'y' => 'y',
364
+ );
365
 
366
+ return strtr((string)$date_format, $chars);
367
  }
368
 
369
 
370
  function js_to_php_timeformat($time_format) {
371
+
372
  $chars = array(
373
  //hour
374
  'HH' => 'H', 'H' => 'G', 'hh' => 'h' , 'h' => 'g',
380
  'TT' => 'A', 'T' => 'A', 'tt' => 'a', 't' => 'a'
381
  );
382
 
383
+ return strtr((string)$time_format, $chars);
384
  }
385
 
386
  function isValidTimeStamp($timestamp) { //from http://stackoverflow.com/a/2524761/1434155
387
+ return ((string) (int) $timestamp === $timestamp)
388
  && ($timestamp <= PHP_INT_MAX)
389
  && ($timestamp >= ~PHP_INT_MAX);
390
  }
409
  wp_enqueue_script( 'jquery-ui-timepicker', $this->settings['dir'] . 'js/jquery-ui-timepicker-addon.js', array(
410
  'acf-datepicker',
411
  'jquery-ui-slider'
412
+ ), $this->settings['version'], true );
413
 
414
  if ( file_exists( dirname( __FILE__ ) . '/js/localization/jquery-ui-timepicker-' . $js_locale . '.js' ) ) {
415
  wp_enqueue_script( 'timepicker-localization', $this->settings['dir'] . 'js/localization/jquery-ui-timepicker-' . $js_locale . '.js', array(
423
  wp_enqueue_script( 'timepicker', $this->settings['dir'] . 'js/timepicker.js', array(
424
  'jquery-ui-timepicker'
425
  ), $this->settings['version'], true );
426
+ }
427
 
428
  if ( ! $has_locale && $js_locale != 'en' ) {
429
  $timepicker_locale = array(
date_time_picker-v4.php CHANGED
@@ -32,6 +32,7 @@ class acf_field_date_time_picker extends acf_field
32
  , 'show_week_number' => 'false'
33
  , 'picker' => 'slider'
34
  , 'save_as_timestamp' => 'true'
 
35
  );
36
 
37
 
@@ -204,6 +205,26 @@ class acf_field_date_time_picker extends acf_field
204
  ?>
205
  </td>
206
  </tr>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
207
  <?php
208
  }
209
 
@@ -232,23 +253,8 @@ class acf_field_date_time_picker extends acf_field
232
 
233
  //function load_field_defaults( $field ) { return $field; }
234
 
235
- /*
236
- * load_value()
237
- *
238
- * This filter is appied to the $value after it is loaded from the db
239
- *
240
- * @type filter
241
- * @since 3.6
242
- * @date 23/01/13
243
- *
244
- * @param $value - the value found in the database
245
- * @param $post_id - the $post_id from which the value was loaded from
246
- * @param $field - the field array holding all the field options
247
- *
248
- * @return $value - the value to be saved in te database
249
- */
250
-
251
- function load_value( $value, $post_id, $field ) {
252
  $field = array_merge($this->defaults, $field);
253
  if ($value != '' && $field['save_as_timestamp'] == 'true' && $this->isValidTimeStamp($value)) {
254
  if ( $field['show_date'] == 'true') {
@@ -260,6 +266,19 @@ class acf_field_date_time_picker extends acf_field
260
  return $value;
261
  }
262
 
 
 
 
 
 
 
 
 
 
 
 
 
 
263
 
264
  function js_to_php_dateformat($date_format) {
265
  $chars = array(
32
  , 'show_week_number' => 'false'
33
  , 'picker' => 'slider'
34
  , 'save_as_timestamp' => 'true'
35
+ , 'get_as_timestamp' => 'false'
36
  );
37
 
38
 
205
  ?>
206
  </td>
207
  </tr>
208
+ <tr class="field_option field_option_<?php echo $this->name; ?> timepicker_week_number">
209
+ <td class="label">
210
+ <label for=""><?php _e( "Get field as timestamp?", $this->domain ); ?></label>
211
+ <p class="description"><?php printf( __( "Most users should leave this untouched, only set it to \"Yes\" if you need get the date and time field as a timestamp using <a href=\"%s\" target=\"_blank\">the_field()</a> or <a href=\"%s\" target=\"_blank\">get_field()</a> ", $this->domain ), "http://www.advancedcustomfields.com/resources/functions/the_field/", "http://www.advancedcustomfields.com/resources/functions/get_field/" );?></p>
212
+ </td>
213
+ <td>
214
+ <?php
215
+ do_action('acf/create_field', array(
216
+ 'type' => 'radio'
217
+ , 'name' => 'fields['.$key.'][get_as_timestamp]'
218
+ , 'value' => $field['get_as_timestamp']
219
+ , 'layout' => 'horizontal'
220
+ , 'choices' => array(
221
+ 'true' => __( 'Yes', $this->domain )
222
+ , 'false' => __( 'No', $this->domain )
223
+ )
224
+ ) );
225
+ ?>
226
+ </td>
227
+ </tr>
228
  <?php
229
  }
230
 
253
 
254
  //function load_field_defaults( $field ) { return $field; }
255
 
256
+ function format_value($value, $post_id, $field)
257
+ {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
258
  $field = array_merge($this->defaults, $field);
259
  if ($value != '' && $field['save_as_timestamp'] == 'true' && $this->isValidTimeStamp($value)) {
260
  if ( $field['show_date'] == 'true') {
266
  return $value;
267
  }
268
 
269
+ function format_value_for_api($value, $post_id, $field)
270
+ {
271
+ $field = array_merge($this->defaults, $field);
272
+ if ($value != '' && $field['save_as_timestamp'] == 'true' && $field['get_as_timestamp'] != 'true' && $this->isValidTimeStamp($value)) {
273
+ if ( $field['show_date'] == 'true') {
274
+ $value = date_i18n(sprintf("%s %s",$this->js_to_php_dateformat($field['date_format']),$this->js_to_php_timeformat($field['time_format'])), $value);
275
+ } else {
276
+ $value = date_i18n(sprintf("%s",$this->js_to_php_timeformat($field['time_format'])), $value);
277
+ }
278
+ }
279
+ return $value;
280
+ }
281
+
282
 
283
  function js_to_php_dateformat($date_format) {
284
  $chars = array(
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.4
6
  Tested up to: 3.6
7
- Stable tag: 2.0.10
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -63,7 +63,7 @@ function my_register_fields()
63
 
64
  To set the date and time format when you create the field, you have to create a string using the letters below.
65
 
66
- = Date format =
67
 
68
  `
69
  d day of month (no leading zero)
@@ -80,7 +80,7 @@ y year (two digit)
80
  yy year (four digit)
81
  `
82
 
83
- = Time format =
84
 
85
  `
86
  H Hour with no leading 0 (24 hour)
@@ -103,40 +103,42 @@ TT AM or PM for AM/PM
103
 
104
  * `yy-mm-dd`: 2013-04-12
105
  * `HH:mm`: 24 hour clock, with a leading 0 for hour and minute
106
- * `h:m tt`: 12 hour clock with am/pm, no leading 0
107
 
108
  **How do I format the date and time when I want to use it in my theme?**
109
 
110
  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.
111
 
112
  == Changelog ==
 
 
113
  = 2.0.10 =
114
  * Removed "value" from defaults
115
  = 2.0.9 =
116
  * Thanks to [flahertydaf](http://support.advancedcustomfields.com/forums/topic/custom-fields-get-emptied-when-publishing/page/2/#post-2325), the plugin in now working with the latest ACF version
117
  * Replaced DateTime::createFromFormat (PHP 5 >= 5.3.0), with strtotime
118
  * minor bugfixes
119
- = 2.0.8 =
120
- * Adds option to store the date and time field as a UNIX timestamp or not.
121
  = 2.0.7 =
122
  * Bug fix. 2.0.6 assumed that the stored date and time was in UNIX timestamp format. 2.0.7 will check and only convert if the date and time is.
123
- = 2.0.6 =
124
  * Changed how the Date and Time Picker field is triggered when ACF adds a new Date and Time Picker field to the DOM
125
  * Saves the Date and Time Picker field as an UNIX timestamp to MySQL. Use the PHP [date](http://php.net/manual/en/function.date.php) function when you use it in your theme.
126
  = 2.0.5 =
127
  * When enqueuing JavaScripts, replaced dependecy of jquery-ui-datepicker with acf-datepicker
128
  = 2.0.4 =
129
- * Updated JavaScript [language detection and loading](http://soderlind.no/time-picker-field-for-advanced-custom-fields/#localization)
130
  = 2.0.3 =
131
  * Fixed Repeater field bug
132
  * Added support for including the field in a theme
133
  = 2.0.2 =
134
  * Updated readme.txt
135
  = 2.0.1 =
136
- * Minor fix
137
  = 2.0.0.beta =
138
  * Total rewrite, based on the [acf-field-type-template](https://github.com/elliotcondon/acf-field-type-template). Works with ACF v3 and ACF v4. In this beta you can only add the Date Time Picker field as a plugin (i.e. not as a template field).
139
- = 1.2.0 =
140
  * Updated jquery-ui-timepicker-addon.js to the latest version (1.0.0) and added localization support.
141
  = 1.1.1 =
142
  * Fixed a small bug
4
  Tags: acf, custom field,datepicker,timepicker
5
  Requires at least: 3.4
6
  Tested up to: 3.6
7
+ Stable tag: 2.0.11
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
63
 
64
  To set the date and time format when you create the field, you have to create a string using the letters below.
65
 
66
+ = Date format =
67
 
68
  `
69
  d day of month (no leading zero)
80
  yy year (four digit)
81
  `
82
 
83
+ = Time format =
84
 
85
  `
86
  H Hour with no leading 0 (24 hour)
103
 
104
  * `yy-mm-dd`: 2013-04-12
105
  * `HH:mm`: 24 hour clock, with a leading 0 for hour and minute
106
+ * `h:m tt`: 12 hour clock with am/pm, no leading 0
107
 
108
  **How do I format the date and time when I want to use it in my theme?**
109
 
110
  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.
111
 
112
  == Changelog ==
113
+ = 2.0.11 =
114
+ * Added option to retrive field values, using the_field() and get_field(), as a timestamp
115
  = 2.0.10 =
116
  * Removed "value" from defaults
117
  = 2.0.9 =
118
  * Thanks to [flahertydaf](http://support.advancedcustomfields.com/forums/topic/custom-fields-get-emptied-when-publishing/page/2/#post-2325), the plugin in now working with the latest ACF version
119
  * Replaced DateTime::createFromFormat (PHP 5 >= 5.3.0), with strtotime
120
  * minor bugfixes
121
+ = 2.0.8 =
122
+ * Adds option to store the date and time field as a UNIX timestamp or not.
123
  = 2.0.7 =
124
  * Bug fix. 2.0.6 assumed that the stored date and time was in UNIX timestamp format. 2.0.7 will check and only convert if the date and time is.
125
+ = 2.0.6 =
126
  * Changed how the Date and Time Picker field is triggered when ACF adds a new Date and Time Picker field to the DOM
127
  * Saves the Date and Time Picker field as an UNIX timestamp to MySQL. Use the PHP [date](http://php.net/manual/en/function.date.php) function when you use it in your theme.
128
  = 2.0.5 =
129
  * When enqueuing JavaScripts, replaced dependecy of jquery-ui-datepicker with acf-datepicker
130
  = 2.0.4 =
131
+ * Updated JavaScript [language detection and loading](http://soderlind.no/time-picker-field-for-advanced-custom-fields/#localization)
132
  = 2.0.3 =
133
  * Fixed Repeater field bug
134
  * Added support for including the field in a theme
135
  = 2.0.2 =
136
  * Updated readme.txt
137
  = 2.0.1 =
138
+ * Minor fix
139
  = 2.0.0.beta =
140
  * Total rewrite, based on the [acf-field-type-template](https://github.com/elliotcondon/acf-field-type-template). Works with ACF v3 and ACF v4. In this beta you can only add the Date Time Picker field as a plugin (i.e. not as a template field).
141
+ = 1.2.0 =
142
  * Updated jquery-ui-timepicker-addon.js to the latest version (1.0.0) and added localization support.
143
  = 1.1.1 =
144
  * Fixed a small bug