Date and Time Picker Field - Version 2.0.9

Version Description

  • Thanks to flahertydaf, the plugin in now working with the latest ACF version
  • Replaced DateTime::createFromFormat (PHP 5 >
Download this release

Release Info

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

Code changes from version 2.0.8 to 2.0.9

Files changed (40) hide show
  1. acf-date_time_picker.php +1 -1
  2. date_time_picker-v3.php +4 -5
  3. date_time_picker-v4.php +69 -46
  4. js/jquery-ui-timepicker-addon.js +390 -181
  5. js/localization/jquery-ui-timepicker-af.js +1 -0
  6. js/localization/jquery-ui-timepicker-bg.js +1 -0
  7. js/localization/jquery-ui-timepicker-ca.js +1 -0
  8. js/localization/jquery-ui-timepicker-cs.js +1 -0
  9. js/localization/jquery-ui-timepicker-de.js +1 -0
  10. js/localization/jquery-ui-timepicker-el.js +1 -0
  11. js/localization/jquery-ui-timepicker-es.js +1 -0
  12. js/localization/jquery-ui-timepicker-et.js +1 -0
  13. js/localization/jquery-ui-timepicker-eu.js +1 -0
  14. js/localization/jquery-ui-timepicker-fi.js +1 -0
  15. js/localization/jquery-ui-timepicker-fr.js +1 -0
  16. js/localization/jquery-ui-timepicker-gl.js +1 -0
  17. js/localization/jquery-ui-timepicker-he.js +1 -0
  18. js/localization/jquery-ui-timepicker-hu.js +1 -0
  19. js/localization/jquery-ui-timepicker-id.js +1 -0
  20. js/localization/jquery-ui-timepicker-it.js +4 -3
  21. js/localization/jquery-ui-timepicker-ja.js +1 -0
  22. js/localization/jquery-ui-timepicker-ko.js +1 -0
  23. js/localization/jquery-ui-timepicker-lt.js +1 -0
  24. js/localization/jquery-ui-timepicker-nl.js +1 -0
  25. js/localization/jquery-ui-timepicker-no.js +1 -0
  26. js/localization/jquery-ui-timepicker-pl.js +1 -0
  27. js/localization/jquery-ui-timepicker-pt-BR.js +2 -1
  28. js/localization/jquery-ui-timepicker-pt.js +1 -0
  29. js/localization/jquery-ui-timepicker-ro.js +1 -0
  30. js/localization/jquery-ui-timepicker-ru.js +1 -0
  31. js/localization/jquery-ui-timepicker-sk.js +1 -0
  32. js/localization/jquery-ui-timepicker-sv.js +6 -5
  33. js/localization/jquery-ui-timepicker-th.js +1 -0
  34. js/localization/jquery-ui-timepicker-tr.js +1 -0
  35. js/localization/jquery-ui-timepicker-uk.js +1 -0
  36. js/localization/jquery-ui-timepicker-vi.js +1 -0
  37. js/localization/jquery-ui-timepicker-zh-CN.js +1 -0
  38. js/localization/jquery-ui-timepicker-zh-TW.js +1 -0
  39. js/timepicker.js +1 -1
  40. readme.txt +7 -3
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.8
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.9
7
  Author: Per Soderlind
8
  Author URI: http://soderlind.no
9
  License: GPLv2 or later
date_time_picker-v3.php CHANGED
@@ -41,7 +41,7 @@ class acf_field_date_time_picker extends acf_Field {
41
  $this->settings = array(
42
  'path' => $this->helpers_get_path( __FILE__ )
43
  , 'dir' => $this->helpers_get_dir( __FILE__ )
44
- , 'version' => '2.0.8'
45
  );
46
  }
47
 
@@ -247,12 +247,11 @@ class acf_field_date_time_picker extends acf_Field {
247
 
248
  function create_field( $field ) {
249
  $field = array_merge( $this->defaults, $field );
250
- extract( $field, EXTR_SKIP ); //Declare each item in $field as its own variable i.e.: $name, $value, $label, $time_format, $date_format and $show_week_number
251
 
252
- if ( $show_date != 'true' ) {
253
- echo '<input type="text" name="' . $name . '" class="time_picker" value="' . $value . '" data-picker="' . $picker . '" data-time_format="' . $time_format . '" title="' . $label . '" />';
254
  } else {
255
- echo '<input type="text" name="' . $name . '" class="time_picker" value="' . $value . '" data-picker="' . $picker . '" data-date_format="' . $date_format . '" data-time_format="' . $time_format . '" data-show_week_number="' . $show_week_number . '" title="' . $label . '" />';
256
  }
257
  }
258
 
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
 
247
 
248
  function create_field( $field ) {
249
  $field = array_merge( $this->defaults, $field );
 
250
 
251
+ if ( $field['show_date'] != 'true' ) {
252
+ 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'] . '" />';
253
  } else {
254
+ 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'] . '" />';
255
  }
256
  }
257
 
date_time_picker-v4.php CHANGED
@@ -7,7 +7,7 @@ class acf_field_date_time_picker extends acf_field
7
  , $defaults // will hold default field options
8
  , $domain // holds the language domain
9
  , $lang;
10
-
11
  /*
12
  * __construct
13
  *
@@ -16,7 +16,7 @@ class acf_field_date_time_picker extends acf_field
16
  * @since 3.6
17
  * @date 23/01/13
18
  */
19
-
20
  function __construct()
21
  {
22
  // vars
@@ -27,30 +27,30 @@ class acf_field_date_time_picker extends acf_field
27
  $this->defaults = array(
28
  'value' => ''
29
  , 'label' => __( 'Choose Time', $this->domain )
30
- , 'time_format' => 'hh:mm'
31
  , 'show_date' => 'true'
32
- , 'date_format' => 'yy-mm-dd'
33
  , 'show_week_number' => 'false'
34
  , 'picker' => 'slider'
35
  , 'save_as_timestamp' => 'true'
36
  );
37
 
38
-
39
-
40
  // do not delete!
41
  parent::__construct();
42
-
43
-
44
  // settings
45
  $this->settings = array(
46
  'path' => apply_filters('acf/helpers/get_path', __FILE__)
47
  , 'dir' => apply_filters('acf/helpers/get_dir', __FILE__)
48
- , 'version' => '2.0.8'
49
  );
50
 
51
  }
52
-
53
-
54
  /*
55
  * create_options()
56
  *
@@ -63,7 +63,7 @@ class acf_field_date_time_picker extends acf_field
63
  *
64
  * @param $field - an array holding all the field's data
65
  */
66
-
67
  function create_options( $field )
68
  {
69
  $field = array_merge($this->defaults, $field);
@@ -100,6 +100,22 @@ class acf_field_date_time_picker extends acf_field
100
  , 'name' => 'fields[' . $key . '][date_format]'
101
  , 'value' => $field['date_format']
102
  ) );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
103
  ?>
104
  </td>
105
  </tr>
@@ -115,6 +131,19 @@ class acf_field_date_time_picker extends acf_field
115
  , 'name' => 'fields[' . $key . '][time_format]'
116
  , 'value' => $field['time_format']
117
  ) );
 
 
 
 
 
 
 
 
 
 
 
 
 
118
  ?>
119
  </td>
120
  </tr>
@@ -155,7 +184,7 @@ class acf_field_date_time_picker extends acf_field
155
  ) );
156
  ?>
157
  </td>
158
- </tr>
159
  <tr class="field_option field_option_<?php echo $this->name; ?> timepicker_week_number">
160
  <td class="label">
161
  <label for=""><?php _e( "Save as timestamp?", $this->domain ); ?></label>
@@ -192,18 +221,18 @@ class acf_field_date_time_picker extends acf_field
192
  * @since 3.6
193
  * @date 23/01/13
194
  */
195
-
196
  function create_field( $field ) {
197
- $field = array_merge( $this->defaults, $field );
198
- extract( $field, EXTR_SKIP ); //Declare each item in $field as its own variable i.e.: $name, $value, $label, $time_format, $date_format and $show_week_number
199
 
200
- if ( $show_date != 'true' ) {
201
- echo '<input type="text" value="' . $value . '" name="' . $name . '" class="ps_timepicker" value="" data-picker="' . $picker . '" data-time_format="' . $time_format . '" title="' . $label . '" />';
202
  } else {
203
- echo '<input type="text" value="' . $value . '" name="' . $name . '" class="ps_timepicker" value="" data-picker="' . $picker . '" data-date_format="' . $date_format . '" data-time_format="' . $time_format . '" data-show_week_number="' . $show_week_number . '" title="' . $label . '" />';
204
  }
205
  }
206
-
 
 
207
  /*
208
  * load_value()
209
  *
@@ -224,32 +253,31 @@ class acf_field_date_time_picker extends acf_field
224
  $field = array_merge($this->defaults, $field);
225
  if ($value != '' && $field['save_as_timestamp'] == 'true' && $this->isValidTimeStamp($value)) {
226
  if ( $field['show_date'] == 'true') {
227
- $value = date(sprintf("%s %s",$this->js_to_php_dateformat($field['date_format']),$this->js_to_php_timeformat($field['time_format'])), $value);
228
- //$value = sprintf("%s %s",$this->js_day_to_strftimeformat($field['date_format']),$this->js_time_to_strftimeformat($field['time_format']));
229
  } else {
230
- $value = date(sprintf("%s",$this->js_to_php_timeformat($field['time_format'])), $value);
231
  }
232
  }
233
  return $value;
234
  }
235
 
236
 
237
- function js_to_php_dateformat($date_format) {
238
- $chars = array(
239
  // Day
240
  'dd' => 'd', 'd' => 'j', 'DD' => 'l','D' => 'D', 'o' => 'z',
241
- // Month
242
- 'mm' => 'm', 'm' => 'n', 'MM' => 'F', 'M' => 'M',
243
- // Year
244
- 'yy' => 'Y', 'y' => 'y',
245
- );
246
 
247
- return strtr((string)$date_format, $chars);
248
  }
249
 
250
 
251
  function js_to_php_timeformat($time_format) {
252
-
253
  $chars = array(
254
  //hour
255
  'HH' => 'H', 'H' => 'G', 'hh' => 'h' , 'h' => 'g',
@@ -261,12 +289,12 @@ class acf_field_date_time_picker extends acf_field
261
  'TT' => 'A', 'T' => 'A', 'tt' => 'a', 't' => 'a'
262
  );
263
 
264
- return strtr((string)$time_format, $chars);
265
  }
266
 
267
 
268
  function isValidTimeStamp($timestamp) { //from http://stackoverflow.com/a/2524761/1434155
269
- return ((string) (int) $timestamp === $timestamp)
270
  && ($timestamp <= PHP_INT_MAX)
271
  && ($timestamp >= ~PHP_INT_MAX);
272
  }
@@ -289,16 +317,11 @@ class acf_field_date_time_picker extends acf_field
289
  function update_value( $value, $post_id, $field ) {
290
  $field = array_merge($this->defaults, $field);
291
  if ($value != '' && $field['save_as_timestamp'] == 'true') {
292
- if ( $field['show_date'] == 'true') {
293
- $date = DateTime::createFromFormat(sprintf("%s %s",$this->js_to_php_dateformat($field['date_format']),$this->js_to_php_timeformat($field['time_format'])), $value);
294
- } else {
295
- $date = DateTime::createFromFormat(sprintf("%s",$this->js_to_php_timeformat($field['time_format'])), $value);
296
- }
297
- return $date->getTimestamp();
298
  }
299
  return $value;
300
  }
301
-
302
 
303
 
304
  /*
@@ -323,7 +346,7 @@ class acf_field_date_time_picker extends acf_field
323
  wp_enqueue_script( 'jquery-ui-timepicker', $this->settings['dir'] . 'js/jquery-ui-timepicker-addon.js', array(
324
  'acf-datepicker',
325
  'jquery-ui-slider'
326
- ), $this->settings['version'], true );
327
 
328
  if ( file_exists( $this->settings['path'] . '/js/localization/jquery-ui-timepicker-' . $js_locale . '.js' ) ) {
329
  wp_enqueue_script( 'timepicker-localization', $this->settings['dir'] . 'js/localization/jquery-ui-timepicker-' . $js_locale . '.js', array(
@@ -337,7 +360,7 @@ class acf_field_date_time_picker extends acf_field
337
  wp_enqueue_script( 'timepicker', $this->settings['dir'] . 'js/timepicker.js', array(
338
  'jquery-ui-timepicker'
339
  ), $this->settings['version'], true );
340
- }
341
 
342
  if ( ! $has_locale && $js_locale != 'en' ) {
343
  $timepicker_locale = array(
@@ -372,7 +395,7 @@ class acf_field_date_time_picker extends acf_field
372
 
373
  wp_enqueue_style('jquery-style', $this->settings['dir'] . 'css/jquery-ui.css',array(
374
  'acf-datepicker'
375
- ),$this->settings['version']);
376
  wp_enqueue_style('timepicker', $this->settings['dir'] . 'css/jquery-ui-timepicker-addon.css',array(
377
  'jquery-style'
378
  ),$this->settings['version']);
@@ -390,11 +413,11 @@ class acf_field_date_time_picker extends acf_field
390
 
391
  return $NewArray;
392
  }
393
-
394
  function get_js_locale($locale) {
395
  $dir_path = $this->settings['path'] . 'js/localization/';
396
  $exclude_list = array(".", "..");
397
- $languages = $this->ps_preg_filter("/jquery-ui-timepicker-(.*?)\.js/","$1",array_diff(scandir($dir_path), $exclude_list));
398
 
399
  $locale = strtolower(str_replace("_", "-", $locale));
400
 
7
  , $defaults // will hold default field options
8
  , $domain // holds the language domain
9
  , $lang;
10
+
11
  /*
12
  * __construct
13
  *
16
  * @since 3.6
17
  * @date 23/01/13
18
  */
19
+
20
  function __construct()
21
  {
22
  // vars
27
  $this->defaults = array(
28
  'value' => ''
29
  , 'label' => __( 'Choose Time', $this->domain )
30
+ , 'time_format' => 'h:mm tt'
31
  , 'show_date' => 'true'
32
+ , 'date_format' => 'm/d/y'
33
  , 'show_week_number' => 'false'
34
  , 'picker' => 'slider'
35
  , 'save_as_timestamp' => 'true'
36
  );
37
 
38
+
39
+
40
  // do not delete!
41
  parent::__construct();
42
+
43
+
44
  // settings
45
  $this->settings = array(
46
  'path' => apply_filters('acf/helpers/get_path', __FILE__)
47
  , 'dir' => apply_filters('acf/helpers/get_dir', __FILE__)
48
+ , 'version' => '2.0.9'
49
  );
50
 
51
  }
52
+
53
+
54
  /*
55
  * create_options()
56
  *
63
  *
64
  * @param $field - an array holding all the field's data
65
  */
66
+
67
  function create_options( $field )
68
  {
69
  $field = array_merge($this->defaults, $field);
100
  , 'name' => 'fields[' . $key . '][date_format]'
101
  , 'value' => $field['date_format']
102
  ) );
103
+ /*
104
+ do_action('acf/create_field', array(
105
+ 'type' => 'select',
106
+ 'name' => 'fields['.$key.'][date_format]',
107
+ 'value' => $field['date_format'],
108
+ 'choices' => array(
109
+ 'm/d/y' => 'm/d/y (5/27/13)'
110
+ , 'mm/dd/yy' => 'mm/dd/yy (05/27/2013)'
111
+ , 'yy/mm/dd' => 'yy/mm/dd (2013/05/27)'
112
+ , 'yy-mm-dd' => 'yy-mm-dd (2013-05-27)'
113
+ , 'dd.mm.yy' => 'dd.mm.yy (27.05.2013)'
114
+ , 'dd-mm-yy' => 'dd-mm-yy (27-05-2013)'
115
+ , 'yy-M-dd' => 'yy-M-dd (2013-May-27)'
116
+ )
117
+ ));
118
+ */
119
  ?>
120
  </td>
121
  </tr>
131
  , 'name' => 'fields[' . $key . '][time_format]'
132
  , 'value' => $field['time_format']
133
  ) );
134
+ /*
135
+ do_action('acf/create_field', array(
136
+ 'type' => 'select',
137
+ 'name' => 'fields['.$key.'][time_format]',
138
+ 'value' => $field['time_format'],
139
+ 'choices' => array(
140
+ 'h:mm tt' => 'h:mm tt (9:59 am)'
141
+ , 'hh:mm tt' => 'hh:mm tt (09:59 am)'
142
+ , 'H:mm' => 'H:mm (9:59)'
143
+ , 'HH:mm' => 'HH:mm (09:59)'
144
+ )
145
+ ));
146
+ */
147
  ?>
148
  </td>
149
  </tr>
184
  ) );
185
  ?>
186
  </td>
187
+ </tr>
188
  <tr class="field_option field_option_<?php echo $this->name; ?> timepicker_week_number">
189
  <td class="label">
190
  <label for=""><?php _e( "Save as timestamp?", $this->domain ); ?></label>
221
  * @since 3.6
222
  * @date 23/01/13
223
  */
224
+
225
  function create_field( $field ) {
 
 
226
 
227
+ if ( $field['show_date'] !== 'true' ) {
228
+ 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'] . '" />';
229
  } else {
230
+ 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'] . '" />';
231
  }
232
  }
233
+
234
+ function load_field_defaults( $field ) { return $field; }
235
+
236
  /*
237
  * load_value()
238
  *
253
  $field = array_merge($this->defaults, $field);
254
  if ($value != '' && $field['save_as_timestamp'] == 'true' && $this->isValidTimeStamp($value)) {
255
  if ( $field['show_date'] == 'true') {
256
+ $value = date_i18n(sprintf("%s %s",$this->js_to_php_dateformat($field['date_format']),$this->js_to_php_timeformat($field['time_format'])), $value);
 
257
  } else {
258
+ $value = date_i18n(sprintf("%s",$this->js_to_php_timeformat($field['time_format'])), $value);
259
  }
260
  }
261
  return $value;
262
  }
263
 
264
 
265
+ function js_to_php_dateformat($date_format) {
266
+ $chars = array(
267
  // Day
268
  'dd' => 'd', 'd' => 'j', 'DD' => 'l','D' => 'D', 'o' => 'z',
269
+ // Month
270
+ 'mm' => 'm', 'm' => 'n', 'MM' => 'F', 'M' => 'M',
271
+ // Year
272
+ 'yy' => 'Y', 'y' => 'y',
273
+ );
274
 
275
+ return strtr((string)$date_format, $chars);
276
  }
277
 
278
 
279
  function js_to_php_timeformat($time_format) {
280
+
281
  $chars = array(
282
  //hour
283
  'HH' => 'H', 'H' => 'G', 'hh' => 'h' , 'h' => 'g',
289
  'TT' => 'A', 'T' => 'A', 'tt' => 'a', 't' => 'a'
290
  );
291
 
292
+ return strtr((string)$time_format, $chars);
293
  }
294
 
295
 
296
  function isValidTimeStamp($timestamp) { //from http://stackoverflow.com/a/2524761/1434155
297
+ return ((string) (int) $timestamp === $timestamp)
298
  && ($timestamp <= PHP_INT_MAX)
299
  && ($timestamp >= ~PHP_INT_MAX);
300
  }
317
  function update_value( $value, $post_id, $field ) {
318
  $field = array_merge($this->defaults, $field);
319
  if ($value != '' && $field['save_as_timestamp'] == 'true') {
320
+ $value = strtotime( $value );
 
 
 
 
 
321
  }
322
  return $value;
323
  }
324
+
325
 
326
 
327
  /*
346
  wp_enqueue_script( 'jquery-ui-timepicker', $this->settings['dir'] . 'js/jquery-ui-timepicker-addon.js', array(
347
  'acf-datepicker',
348
  'jquery-ui-slider'
349
+ ), $this->settings['version'], true );
350
 
351
  if ( file_exists( $this->settings['path'] . '/js/localization/jquery-ui-timepicker-' . $js_locale . '.js' ) ) {
352
  wp_enqueue_script( 'timepicker-localization', $this->settings['dir'] . 'js/localization/jquery-ui-timepicker-' . $js_locale . '.js', array(
360
  wp_enqueue_script( 'timepicker', $this->settings['dir'] . 'js/timepicker.js', array(
361
  'jquery-ui-timepicker'
362
  ), $this->settings['version'], true );
363
+ }
364
 
365
  if ( ! $has_locale && $js_locale != 'en' ) {
366
  $timepicker_locale = array(
395
 
396
  wp_enqueue_style('jquery-style', $this->settings['dir'] . 'css/jquery-ui.css',array(
397
  'acf-datepicker'
398
+ ),$this->settings['version']);
399
  wp_enqueue_style('timepicker', $this->settings['dir'] . 'css/jquery-ui-timepicker-addon.css',array(
400
  'jquery-style'
401
  ),$this->settings['version']);
413
 
414
  return $NewArray;
415
  }
416
+
417
  function get_js_locale($locale) {
418
  $dir_path = $this->settings['path'] . 'js/localization/';
419
  $exclude_list = array(".", "..");
420
+ $languages = $this->ps_preg_filter("/jquery-ui-timepicker-(.*?)\.js/","$1",array_diff(scandir($dir_path), $exclude_list));
421
 
422
  $locale = strtolower(str_replace("_", "-", $locale));
423
 
js/jquery-ui-timepicker-addon.js CHANGED
@@ -1,8 +1,8 @@
1
  /*
2
  * jQuery timepicker addon
3
  * By: Trent Richardson [http://trentrichardson.com]
4
- * Version 1.2
5
- * Last Modified: 02/02/2013
6
  *
7
  * Copyright 2013 Trent Richardson
8
  * You may use this project under MIT or GPL licenses.
@@ -27,7 +27,7 @@
27
  */
28
  $.extend($.ui, {
29
  timepicker: {
30
- version: "1.2"
31
  }
32
  });
33
 
@@ -52,37 +52,41 @@
52
  minuteText: 'Minute',
53
  secondText: 'Second',
54
  millisecText: 'Millisecond',
 
55
  timezoneText: 'Time Zone',
56
  isRTL: false
57
  };
58
  this._defaults = { // Global defaults for all the datetime picker instances
59
  showButtonPanel: true,
60
  timeOnly: false,
61
- showHour: true,
62
- showMinute: true,
63
- showSecond: false,
64
- showMillisec: false,
65
- showTimezone: false,
 
66
  showTime: true,
67
  stepHour: 1,
68
  stepMinute: 1,
69
  stepSecond: 1,
70
  stepMillisec: 1,
 
71
  hour: 0,
72
  minute: 0,
73
  second: 0,
74
  millisec: 0,
 
75
  timezone: null,
76
- useLocalTimezone: false,
77
- defaultTimezone: "+0000",
78
  hourMin: 0,
79
  minuteMin: 0,
80
  secondMin: 0,
81
  millisecMin: 0,
 
82
  hourMax: 23,
83
  minuteMax: 59,
84
  secondMax: 59,
85
  millisecMax: 999,
 
86
  minDateTime: null,
87
  maxDateTime: null,
88
  onSelect: null,
@@ -90,6 +94,7 @@
90
  minuteGrid: 0,
91
  secondGrid: 0,
92
  millisecGrid: 0,
 
93
  alwaysSetTime: true,
94
  separator: ' ',
95
  altFieldTimeOnly: true,
@@ -99,7 +104,6 @@
99
  pickerTimeFormat: null,
100
  pickerTimeSuffix: null,
101
  showTimepicker: true,
102
- timezoneIso8601: false,
103
  timezoneList: null,
104
  addSliderAccess: false,
105
  sliderAccessArgs: null,
@@ -119,27 +123,31 @@
119
  minute_slider: null,
120
  second_slider: null,
121
  millisec_slider: null,
 
122
  timezone_select: null,
123
  hour: 0,
124
  minute: 0,
125
  second: 0,
126
  millisec: 0,
 
127
  timezone: null,
128
- defaultTimezone: "+0000",
129
  hourMinOriginal: null,
130
  minuteMinOriginal: null,
131
  secondMinOriginal: null,
132
  millisecMinOriginal: null,
 
133
  hourMaxOriginal: null,
134
  minuteMaxOriginal: null,
135
  secondMaxOriginal: null,
136
  millisecMaxOriginal: null,
 
137
  ampm: '',
138
  formattedDate: '',
139
  formattedTime: '',
140
  formattedDateTime: '',
141
  timezoneList: null,
142
- units: ['hour','minute','second','millisec'],
 
143
  control: null,
144
 
145
  /*
@@ -155,11 +163,11 @@
155
  /*
156
  * Create a new Timepicker instance
157
  */
158
- _newInst: function($input, o) {
159
  var tp_inst = new Timepicker(),
160
  inlineSettings = {},
161
- fns = {},
162
- overrides, i;
163
 
164
  for (var attrName in this._defaults) {
165
  if(this._defaults.hasOwnProperty(attrName)){
@@ -173,6 +181,7 @@
173
  }
174
  }
175
  }
 
176
  overrides = {
177
  beforeShow: function (input, dp_inst) {
178
  if ($.isFunction(tp_inst._defaults.evnts.beforeShow)) {
@@ -197,10 +206,11 @@
197
  };
198
  for (i in overrides) {
199
  if (overrides.hasOwnProperty(i)) {
200
- fns[i] = o[i] || null;
201
  }
202
  }
203
- tp_inst._defaults = $.extend({}, this._defaults, inlineSettings, o, overrides, {
 
204
  evnts:fns,
205
  timepicker: tp_inst // add timepicker as a property of datepicker: $.datepicker._get(dp_inst, 'timepicker');
206
  });
@@ -211,9 +221,15 @@
211
  return val.toUpperCase();
212
  });
213
 
 
 
 
 
 
 
214
  // controlType is string - key to our this._controls
215
  if(typeof(tp_inst._defaults.controlType) === 'string'){
216
- if($.fn[tp_inst._defaults.controlType] === undefined){
217
  tp_inst._defaults.controlType = 'select';
218
  }
219
  tp_inst.control = tp_inst._controls[tp_inst._defaults.controlType];
@@ -223,20 +239,24 @@
223
  tp_inst.control = tp_inst._defaults.controlType;
224
  }
225
 
226
- if (tp_inst._defaults.timezoneList === null) {
227
- var timezoneList = ['-1200', '-1100', '-1000', '-0930', '-0900', '-0800', '-0700', '-0600', '-0500', '-0430', '-0400', '-0330', '-0300', '-0200', '-0100', '+0000',
228
- '+0100', '+0200', '+0300', '+0330', '+0400', '+0430', '+0500', '+0530', '+0545', '+0600', '+0630', '+0700', '+0800', '+0845', '+0900', '+0930',
229
- '+1000', '+1030', '+1100', '+1130', '+1200', '+1245', '+1300', '+1400'];
230
-
231
- if (tp_inst._defaults.timezoneIso8601) {
232
- timezoneList = $.map(timezoneList, function(val) {
233
- return val == '+0000' ? 'Z' : (val.substring(0, 3) + ':' + val.substring(3));
234
- });
 
 
235
  }
236
- tp_inst._defaults.timezoneList = timezoneList;
237
  }
 
238
 
239
- tp_inst.timezone = tp_inst._defaults.timezone;
 
 
240
  tp_inst.hour = tp_inst._defaults.hour < tp_inst._defaults.hourMin? tp_inst._defaults.hourMin :
241
  tp_inst._defaults.hour > tp_inst._defaults.hourMax? tp_inst._defaults.hourMax : tp_inst._defaults.hour;
242
  tp_inst.minute = tp_inst._defaults.minute < tp_inst._defaults.minuteMin? tp_inst._defaults.minuteMin :
@@ -245,11 +265,13 @@
245
  tp_inst._defaults.second > tp_inst._defaults.secondMax? tp_inst._defaults.secondMax : tp_inst._defaults.second;
246
  tp_inst.millisec = tp_inst._defaults.millisec < tp_inst._defaults.millisecMin? tp_inst._defaults.millisecMin :
247
  tp_inst._defaults.millisec > tp_inst._defaults.millisecMax? tp_inst._defaults.millisecMax : tp_inst._defaults.millisec;
 
 
248
  tp_inst.ampm = '';
249
  tp_inst.$input = $input;
250
 
251
- if (o.altField) {
252
- tp_inst.$altInput = $(o.altField).css({
253
  cursor: 'pointer'
254
  }).focus(function() {
255
  $input.trigger("focus");
@@ -337,9 +359,12 @@
337
  tp_inst = this,
338
  litem = '',
339
  uitem = '',
 
340
  max = {},
341
  gridSize = {},
342
- size = null;
 
 
343
 
344
  // Prevent displaying twice
345
  if ($dp.find("div.ui-timepicker-div").length === 0 && o.showTimepicker) {
@@ -348,25 +373,27 @@
348
  '<dd class="ui_tpicker_time"' + ((o.showTime) ? '' : noDisplay) + '></dd>';
349
 
350
  // Create the markup
351
- for(var i=0,l=this.units.length; i<l; i++){
352
  litem = this.units[i];
353
  uitem = litem.substr(0,1).toUpperCase() + litem.substr(1);
 
 
354
  // Added by Peter Medeiros:
355
  // - Figure out what the hour/minute/second max should be based on the step values.
356
  // - Example: if stepMinute is 15, then minMax is 45.
357
  max[litem] = parseInt((o[litem+'Max'] - ((o[litem+'Max'] - o[litem+'Min']) % o['step'+uitem])), 10);
358
  gridSize[litem] = 0;
359
 
360
- html += '<dt class="ui_tpicker_'+ litem +'_label"' + ((o['show'+uitem]) ? '' : noDisplay) + '>' + o[litem +'Text'] + '</dt>' +
361
- '<dd class="ui_tpicker_'+ litem +'"><div class="ui_tpicker_'+ litem +'_slider"' + ((o['show'+uitem]) ? '' : noDisplay) + '></div>';
362
 
363
- if (o['show'+uitem] && o[litem+'Grid'] > 0) {
364
  html += '<div style="padding-left: 1px"><table class="ui-tpicker-grid-label"><tr>';
365
 
366
  if(litem == 'hour'){
367
  for (var h = o[litem+'Min']; h <= max[litem]; h += parseInt(o[litem+'Grid'], 10)) {
368
  gridSize[litem]++;
369
- var tmph = $.datepicker.formatTime(useAmpm(o.pickerTimeFormat || o.timeFormat)? 'hht':'HH', {hour:h}, o);
370
  html += '<td data-for="'+litem+'">' + tmph + '</td>';
371
  }
372
  }
@@ -383,8 +410,9 @@
383
  }
384
 
385
  // Timezone
386
- html += '<dt class="ui_tpicker_timezone_label"' + ((o.showTimezone) ? '' : noDisplay) + '>' + o.timezoneText + '</dt>';
387
- html += '<dd class="ui_tpicker_timezone" ' + ((o.showTimezone) ? '' : noDisplay) + '></dd>';
 
388
 
389
  // Create the elements from string
390
  html += '</dl></div>';
@@ -397,15 +425,16 @@
397
  }
398
 
399
  // add sliders, adjust grids, add events
400
- for(var i=0,l=tp_inst.units.length; i<l; i++){
401
  litem = tp_inst.units[i];
402
  uitem = litem.substr(0,1).toUpperCase() + litem.substr(1);
 
403
 
404
  // add the slider
405
  tp_inst[litem+'_slider'] = tp_inst.control.create(tp_inst, $tp.find('.ui_tpicker_'+litem+'_slider'), litem, tp_inst[litem], o[litem+'Min'], max[litem], o['step'+uitem]);
406
 
407
  // adjust the grid and add click event
408
- if (o['show'+uitem] && o[litem+'Grid'] > 0) {
409
  size = 100 * gridSize[litem] * o[litem+'Grid'] / (max[litem] - o[litem+'Min']);
410
  $tp.find('.ui_tpicker_'+litem+' table').css({
411
  width: size + "%",
@@ -434,8 +463,7 @@
434
 
435
  tp_inst._onTimeChange();
436
  tp_inst._onSelectHandler();
437
- })
438
- .css({
439
  cursor: 'pointer',
440
  width: (100 / gridSize[litem]) + '%',
441
  textAlign: 'center',
@@ -451,22 +479,20 @@
451
  return $("<option />").val(typeof val == "object" ? val.value : val).text(typeof val == "object" ? val.label : val);
452
  }));
453
  if (typeof(this.timezone) != "undefined" && this.timezone !== null && this.timezone !== "") {
454
- var local_date = new Date(this.inst.selectedYear, this.inst.selectedMonth, this.inst.selectedDay, 12);
455
- var local_timezone = $.timepicker.timeZoneOffsetString(local_date);
456
  if (local_timezone == this.timezone) {
457
- selectLocalTimeZone(tp_inst);
458
  } else {
459
  this.timezone_select.val(this.timezone);
460
  }
461
  } else {
462
  if (typeof(this.hour) != "undefined" && this.hour !== null && this.hour !== "") {
463
- this.timezone_select.val(o.defaultTimezone);
464
  } else {
465
- selectLocalTimeZone(tp_inst);
466
  }
467
  }
468
  this.timezone_select.change(function() {
469
- tp_inst._defaults.useLocalTimezone = false;
470
  tp_inst._onTimeChange();
471
  tp_inst._onSelectHandler();
472
  });
@@ -517,6 +543,7 @@
517
  }
518
  // end slideAccess integration
519
 
 
520
  }
521
  },
522
 
@@ -536,11 +563,12 @@
536
  var minDateTime = $.datepicker._get(dp_inst, 'minDateTime'),
537
  minDateTimeDate = new Date(minDateTime.getFullYear(), minDateTime.getMonth(), minDateTime.getDate(), 0, 0, 0, 0);
538
 
539
- if (this.hourMinOriginal === null || this.minuteMinOriginal === null || this.secondMinOriginal === null || this.millisecMinOriginal === null) {
540
  this.hourMinOriginal = o.hourMin;
541
  this.minuteMinOriginal = o.minuteMin;
542
  this.secondMinOriginal = o.secondMin;
543
  this.millisecMinOriginal = o.millisecMin;
 
544
  }
545
 
546
  if (dp_inst.settings.timeOnly || minDateTimeDate.getTime() == dp_date.getTime()) {
@@ -554,26 +582,36 @@
554
  if (this.second <= this._defaults.secondMin) {
555
  this.second = this._defaults.secondMin;
556
  this._defaults.millisecMin = minDateTime.getMilliseconds();
557
- } else {
558
- if (this.millisec < this._defaults.millisecMin) {
559
  this.millisec = this._defaults.millisecMin;
 
 
 
 
 
 
560
  }
 
561
  this._defaults.millisecMin = this.millisecMinOriginal;
 
562
  }
563
  } else {
564
  this._defaults.secondMin = this.secondMinOriginal;
565
  this._defaults.millisecMin = this.millisecMinOriginal;
 
566
  }
567
  } else {
568
  this._defaults.minuteMin = this.minuteMinOriginal;
569
  this._defaults.secondMin = this.secondMinOriginal;
570
  this._defaults.millisecMin = this.millisecMinOriginal;
 
571
  }
572
  } else {
573
  this._defaults.hourMin = this.hourMinOriginal;
574
  this._defaults.minuteMin = this.minuteMinOriginal;
575
  this._defaults.secondMin = this.secondMinOriginal;
576
  this._defaults.millisecMin = this.millisecMinOriginal;
 
577
  }
578
  }
579
 
@@ -581,11 +619,12 @@
581
  var maxDateTime = $.datepicker._get(dp_inst, 'maxDateTime'),
582
  maxDateTimeDate = new Date(maxDateTime.getFullYear(), maxDateTime.getMonth(), maxDateTime.getDate(), 0, 0, 0, 0);
583
 
584
- if (this.hourMaxOriginal === null || this.minuteMaxOriginal === null || this.secondMaxOriginal === null) {
585
  this.hourMaxOriginal = o.hourMax;
586
  this.minuteMaxOriginal = o.minuteMax;
587
  this.secondMaxOriginal = o.secondMax;
588
  this.millisecMaxOriginal = o.millisecMax;
 
589
  }
590
 
591
  if (dp_inst.settings.timeOnly || maxDateTimeDate.getTime() == dp_date.getTime()) {
@@ -599,26 +638,36 @@
599
  if (this.second >= this._defaults.secondMax) {
600
  this.second = this._defaults.secondMax;
601
  this._defaults.millisecMax = maxDateTime.getMilliseconds();
602
- } else {
603
- if (this.millisec > this._defaults.millisecMax) {
604
  this.millisec = this._defaults.millisecMax;
 
 
 
 
 
 
605
  }
 
606
  this._defaults.millisecMax = this.millisecMaxOriginal;
 
607
  }
608
  } else {
609
  this._defaults.secondMax = this.secondMaxOriginal;
610
  this._defaults.millisecMax = this.millisecMaxOriginal;
 
611
  }
612
  } else {
613
  this._defaults.minuteMax = this.minuteMaxOriginal;
614
  this._defaults.secondMax = this.secondMaxOriginal;
615
  this._defaults.millisecMax = this.millisecMaxOriginal;
 
616
  }
617
  } else {
618
  this._defaults.hourMax = this.hourMaxOriginal;
619
  this._defaults.minuteMax = this.minuteMaxOriginal;
620
  this._defaults.secondMax = this.secondMaxOriginal;
621
  this._defaults.millisecMax = this.millisecMaxOriginal;
 
622
  }
623
  }
624
 
@@ -627,6 +676,7 @@
627
  minMax = parseInt((this._defaults.minuteMax - ((this._defaults.minuteMax - this._defaults.minuteMin) % this._defaults.stepMinute)), 10),
628
  secMax = parseInt((this._defaults.secondMax - ((this._defaults.secondMax - this._defaults.secondMin) % this._defaults.stepSecond)), 10),
629
  millisecMax = parseInt((this._defaults.millisecMax - ((this._defaults.millisecMax - this._defaults.millisecMin) % this._defaults.stepMillisec)), 10);
 
630
 
631
  if (this.hour_slider) {
632
  this.control.options(this, this.hour_slider, 'hour', { min: this._defaults.hourMin, max: hourMax });
@@ -644,6 +694,10 @@
644
  this.control.options(this, this.millisec_slider, 'millisec', { min: this._defaults.millisecMin, max: millisecMax });
645
  this.control.value(this, this.millisec_slider, 'millisec', this.millisec - (this.millisec % this._defaults.stepMillisec));
646
  }
 
 
 
 
647
  }
648
 
649
  },
@@ -657,6 +711,7 @@
657
  minute = (this.minute_slider) ? this.control.value(this, this.minute_slider, 'minute') : false,
658
  second = (this.second_slider) ? this.control.value(this, this.second_slider, 'second') : false,
659
  millisec = (this.millisec_slider) ? this.control.value(this, this.millisec_slider, 'millisec') : false,
 
660
  timezone = (this.timezone_select) ? this.timezone_select.val() : false,
661
  o = this._defaults,
662
  pickerTimeFormat = o.pickerTimeFormat || o.timeFormat,
@@ -674,6 +729,9 @@
674
  if (typeof(millisec) == 'object') {
675
  millisec = false;
676
  }
 
 
 
677
  if (typeof(timezone) == 'object') {
678
  timezone = false;
679
  }
@@ -690,14 +748,17 @@
690
  if (millisec !== false) {
691
  millisec = parseInt(millisec, 10);
692
  }
 
 
 
693
 
694
  var ampm = o[hour < 12 ? 'amNames' : 'pmNames'][0];
695
 
696
  // If the update was done in the input field, the input field should not be updated.
697
  // If the update was done using the sliders, update the input field.
698
- var hasChanged = (hour != this.hour || minute != this.minute || second != this.second || millisec != this.millisec
699
  || (this.ampm.length > 0 && (hour < 12) != ($.inArray(this.ampm.toUpperCase(), this.amNames) !== -1))
700
- || ((this.timezone === null && timezone != this.defaultTimezone) || (this.timezone !== null && timezone != this.timezone)));
701
 
702
  if (hasChanged) {
703
 
@@ -713,6 +774,9 @@
713
  if (millisec !== false) {
714
  this.millisec = millisec;
715
  }
 
 
 
716
  if (timezone !== false) {
717
  this.timezone = timezone;
718
  }
@@ -723,7 +787,7 @@
723
 
724
  this._limitMinMaxDateTime(this.inst, true);
725
  }
726
- if (useAmpm(o.timeFormat)) {
727
  this.ampm = ampm;
728
  }
729
 
@@ -761,7 +825,8 @@
761
  */
762
  _updateDateTime: function(dp_inst) {
763
  dp_inst = this.inst || dp_inst;
764
- var dt = $.datepicker._daylightSavingAdjust(new Date(dp_inst.selectedYear, dp_inst.selectedMonth, dp_inst.selectedDay)),
 
765
  dateFmt = $.datepicker._get(dp_inst, 'dateFormat'),
766
  formatCfg = $.datepicker._getFormatConfig(dp_inst),
767
  timeAvailable = dt !== null && this.timeDefined;
@@ -769,7 +834,7 @@
769
  var formattedDateTime = this.formattedDate;
770
 
771
  // if a slider was changed but datepicker doesn't have a value yet, set it
772
- if(dp_inst.lastVal==""){
773
  dp_inst.currentYear=dp_inst.selectedYear;
774
  dp_inst.currentMonth=dp_inst.selectedMonth;
775
  dp_inst.currentDay=dp_inst.selectedDay;
@@ -794,7 +859,7 @@
794
 
795
  if (!this._defaults.showTimepicker) {
796
  this.$input.val(this.formattedDate);
797
- } else if (this.$altInput && this._defaults.altFieldTimeOnly === true) {
798
  this.$altInput.val(this.formattedTime);
799
  this.$input.val(this.formattedDate);
800
  } else if (this.$altInput) {
@@ -802,12 +867,26 @@
802
  var altFormattedDateTime = '',
803
  altSeparator = this._defaults.altSeparator ? this._defaults.altSeparator : this._defaults.separator,
804
  altTimeSuffix = this._defaults.altTimeSuffix ? this._defaults.altTimeSuffix : this._defaults.timeSuffix;
 
 
 
 
 
 
 
 
 
 
 
 
 
805
 
806
- if (this._defaults.altFormat) altFormattedDateTime = $.datepicker.formatDate(this._defaults.altFormat, (dt === null ? new Date() : dt), formatCfg);
807
- else altFormattedDateTime = this.formattedDate;
808
- if (altFormattedDateTime) altFormattedDateTime += altSeparator;
809
- if (this._defaults.altTimeFormat) altFormattedDateTime += $.datepicker.formatTime(this._defaults.altTimeFormat, this, this._defaults) + altTimeSuffix;
810
- else altFormattedDateTime += this.formattedTime + altTimeSuffix;
 
811
  this.$altInput.val(altFormattedDateTime);
812
  } else {
813
  this.$input.val(formattedDateTime);
@@ -861,8 +940,9 @@
861
  if(tp_inst._defaults.isRTL){
862
  if(typeof(opts) == 'string'){
863
  if(opts == 'min' || opts == 'max'){
864
- if(val !== undefined)
865
  return obj.slider(opts, val*-1);
 
866
  return Math.abs(obj.slider(opts));
867
  }
868
  return obj.slider(opts);
@@ -870,24 +950,29 @@
870
  var min = opts.min,
871
  max = opts.max;
872
  opts.min = opts.max = null;
873
- if(min !== undefined)
874
  opts.max = min * -1;
875
- if(max !== undefined)
 
876
  opts.min = max * -1;
 
877
  return obj.slider(opts);
878
  }
879
- if(typeof(opts) == 'string' && val !== undefined)
880
  return obj.slider(opts, val);
 
881
  return obj.slider(opts);
882
  },
883
  value: function(tp_inst, obj, unit, val){
884
  if(tp_inst._defaults.isRTL){
885
- if(val !== undefined)
886
  return obj.slider('value', val*-1);
 
887
  return Math.abs(obj.slider('value'));
888
  }
889
- if(val !== undefined)
890
  return obj.slider('value', val);
 
891
  return obj.slider('value');
892
  }
893
  },
@@ -895,15 +980,15 @@
895
  select: {
896
  create: function(tp_inst, obj, unit, val, min, max, step){
897
  var sel = '<select class="ui-timepicker-select" data-unit="'+ unit +'" data-min="'+ min +'" data-max="'+ max +'" data-step="'+ step +'">',
898
- ul = tp_inst._defaults.timeFormat.indexOf('t') !== -1? 'toLowerCase':'toUpperCase',
899
- m = 0;
900
 
901
  for(var i=min; i<=max; i+=step){
902
  sel += '<option value="'+ i +'"'+ (i==val? ' selected':'') +'>';
903
- if(unit == 'hour' && useAmpm(tp_inst._defaults.pickerTimeFormat || tp_inst._defaults.timeFormat))
904
- sel += $.datepicker.formatTime("hh TT", {hour:i}, tp_inst._defaults);
905
- else if(unit == 'millisec' || i >= 10) sel += i;
906
- else sel += '0'+ i.toString();
 
907
  sel += '</option>';
908
  }
909
  sel += '</select>';
@@ -921,17 +1006,19 @@
921
  var o = {},
922
  $t = obj.children('select');
923
  if(typeof(opts) == 'string'){
924
- if(val === undefined)
925
  return $t.data(opts);
 
926
  o[opts] = val;
927
  }
928
- else o = opts;
929
  return tp_inst.control.create(tp_inst, obj, $t.data('unit'), $t.val(), o.min || $t.data('min'), o.max || $t.data('max'), o.step || $t.data('step'));
930
  },
931
  value: function(tp_inst, obj, unit, val){
932
  var $t = obj.children('select');
933
- if(val !== undefined)
934
  return $t.val(val);
 
935
  return $t.val();
936
  }
937
  }
@@ -991,6 +1078,7 @@
991
  if (parseRes.timeObj) {
992
  var t = parseRes.timeObj;
993
  parseRes.date.setHours(t.hour, t.minute, t.second, t.millisec);
 
994
  }
995
 
996
  return parseRes.date;
@@ -1000,7 +1088,8 @@
1000
  * Public utility to parse time
1001
  */
1002
  $.datepicker.parseTime = function(timeFormat, timeString, options) {
1003
- var o = extendRemove(extendRemove({}, $.timepicker._defaults), options || {});
 
1004
 
1005
  // Strict parse requires the timeString to match the timeFormat exactly
1006
  var strictParse = function(f, s, o){
@@ -1022,12 +1111,13 @@
1022
 
1023
  // figure out position of time elements.. cause js cant do named captures
1024
  var getFormatPositions = function(timeFormat) {
1025
- var finds = timeFormat.toLowerCase().match(/(h{1,2}|m{1,2}|s{1,2}|l{1}|t{1,2}|z|'.*?')/g),
1026
  orders = {
1027
  h: -1,
1028
  m: -1,
1029
  s: -1,
1030
  l: -1,
 
1031
  t: -1,
1032
  z: -1
1033
  };
@@ -1043,13 +1133,14 @@
1043
  };
1044
 
1045
  var regstr = '^' + f.toString()
1046
- .replace(/([hH]{1,2}|mm?|ss?|[tT]{1,2}|[lz]|'.*?')/g, function (match) {
1047
  var ml = match.length;
1048
  switch (match.charAt(0).toLowerCase()) {
1049
  case 'h': return ml === 1? '(\\d?\\d)':'(\\d{'+ml+'})';
1050
  case 'm': return ml === 1? '(\\d?\\d)':'(\\d{'+ml+'})';
1051
  case 's': return ml === 1? '(\\d?\\d)':'(\\d{'+ml+'})';
1052
  case 'l': return '(\\d?\\d?\\d)';
 
1053
  case 'z': return '(z|[-+]\\d\\d:?\\d\\d|\\S+)?';
1054
  case 't': return getPatternAmpm(o.amNames, o.pmNames);
1055
  default: // literal escaped in quotes
@@ -1068,7 +1159,8 @@
1068
  hour: 0,
1069
  minute: 0,
1070
  second: 0,
1071
- millisec: 0
 
1072
  };
1073
 
1074
  if (treg) {
@@ -1103,31 +1195,11 @@
1103
  if (order.l !== -1) {
1104
  resTime.millisec = Number(treg[order.l]);
1105
  }
 
 
 
1106
  if (order.z !== -1 && treg[order.z] !== undefined) {
1107
- var tz = treg[order.z].toUpperCase();
1108
- switch (tz.length) {
1109
- case 1:
1110
- // Z
1111
- tz = o.timezoneIso8601 ? 'Z' : '+0000';
1112
- break;
1113
- case 5:
1114
- // +hhmm
1115
- if (o.timezoneIso8601) {
1116
- tz = tz.substring(1) == '0000' ? 'Z' : tz.substring(0, 3) + ':' + tz.substring(3);
1117
- }
1118
- break;
1119
- case 6:
1120
- // +hh:mm
1121
- if (!o.timezoneIso8601) {
1122
- tz = tz == 'Z' || tz.substring(1) == '00:00' ? '+0000' : tz.replace(/:/, '');
1123
- } else {
1124
- if (tz.substring(1) == '00:00') {
1125
- tz = 'Z';
1126
- }
1127
- }
1128
- break;
1129
- }
1130
- resTime.timezone = tz;
1131
  }
1132
 
1133
 
@@ -1155,7 +1227,8 @@
1155
  minute: d.getMinutes(),
1156
  second: d.getSeconds(),
1157
  millisec: d.getMilliseconds(),
1158
- timezone: $.timepicker.timeZoneOffsetString(d)
 
1159
  };
1160
  }
1161
  catch(err){
@@ -1170,7 +1243,7 @@
1170
  }; // end looseParse
1171
 
1172
  if(typeof o.parse === "function"){
1173
- return o.parse(timeFormat, timeString, o)
1174
  }
1175
  if(o.parse === 'loose'){
1176
  return looseParse(timeFormat, timeString, o);
@@ -1192,7 +1265,7 @@
1192
  minute: 0,
1193
  second: 0,
1194
  millisec: 0,
1195
- timezone: '+0000'
1196
  }, time);
1197
 
1198
  var tmptime = format,
@@ -1203,7 +1276,7 @@
1203
  ampmName = options.pmNames[0];
1204
  }
1205
 
1206
- tmptime = tmptime.replace(/(?:HH?|hh?|mm?|ss?|[tT]{1,2}|[lz]|('.*?'|".*?"))/g, function(match) {
1207
  switch (match) {
1208
  case 'HH':
1209
  return ('0' + hour).slice(-2);
@@ -1223,8 +1296,12 @@
1223
  return time.second;
1224
  case 'l':
1225
  return ('00' + time.millisec).slice(-3);
 
 
1226
  case 'z':
1227
- return time.timezone === null? options.defaultTimezone : time.timezone;
 
 
1228
  case 'T':
1229
  return ampmName.charAt(0).toUpperCase();
1230
  case 'TT':
@@ -1285,12 +1362,6 @@
1285
  var tp_inst = this._get(inst, 'timepicker');
1286
  if (tp_inst) {
1287
  tp_inst._addTimePicker(inst);
1288
-
1289
- // if (tp_inst._defaults.useLocalTimezone) { //checks daylight saving with the new date.
1290
- // var date = new Date(inst.selectedYear, inst.selectedMonth, inst.selectedDay, 12);
1291
- // selectLocalTimeZone(tp_inst, date);
1292
- // tp_inst._onTimeChange();
1293
- // }
1294
  }
1295
  }
1296
  };
@@ -1305,7 +1376,8 @@
1305
 
1306
  if (tp_inst) {
1307
  if ($.datepicker._get(inst, 'constrainInput')) {
1308
- var ampm = useAmpm(tp_inst._defaults.timeFormat),
 
1309
  dateChars = $.datepicker._possibleChars($.datepicker._get(inst, 'dateFormat')),
1310
  datetimeChars = tp_inst._defaults.timeFormat.toString()
1311
  .replace(/[hms]/g, '')
@@ -1317,7 +1389,7 @@
1317
  .replace(/t/g, ampm ? 'ap' : '') +
1318
  " " + tp_inst._defaults.separator +
1319
  tp_inst._defaults.timeSuffix +
1320
- (tp_inst._defaults.showTimezone ? tp_inst._defaults.timezoneList.join('') : '') +
1321
  (tp_inst._defaults.amNames.join('')) + (tp_inst._defaults.pmNames.join('')) +
1322
  dateChars,
1323
  chr = String.fromCharCode(event.charCode === undefined ? event.keyCode : event.charCode);
@@ -1348,9 +1420,12 @@
1348
 
1349
  altFormattedDateTime += $.datepicker.formatTime(altTimeFormat, tp_inst, tp_inst._defaults) + altTimeSuffix;
1350
  if(!tp_inst._defaults.timeOnly && !tp_inst._defaults.altFieldTimeOnly && date !== null){
1351
- if(tp_inst._defaults.altFormat)
1352
  altFormattedDateTime = $.datepicker.formatDate(tp_inst._defaults.altFormat, date, formatCfg) + altSeparator + altFormattedDateTime;
1353
- else altFormattedDateTime = tp_inst.formattedDate + altSeparator + altFormattedDateTime;
 
 
 
1354
  }
1355
  $(altField).val(altFormattedDateTime);
1356
  }
@@ -1390,7 +1465,7 @@
1390
  $dp = inst.dpDiv;
1391
  this._base_gotoToday(id);
1392
  var tp_inst = this._get(inst, 'timepicker');
1393
- selectLocalTimeZone(tp_inst);
1394
  var now = new Date();
1395
  this._setTime(inst, now);
1396
  $('.ui-datepicker-today', $dp).click();
@@ -1441,6 +1516,7 @@
1441
  tp_inst.minute = date ? date.getMinutes() : defaults.minute;
1442
  tp_inst.second = date ? date.getSeconds() : defaults.second;
1443
  tp_inst.millisec = date ? date.getMilliseconds() : defaults.millisec;
 
1444
 
1445
  //check if within min/max times..
1446
  tp_inst._limitMinMaxDateTime(inst, true);
@@ -1469,8 +1545,10 @@
1469
  tp_inst._parseTime(date, withDate);
1470
  tp_date = new Date();
1471
  tp_date.setHours(tp_inst.hour, tp_inst.minute, tp_inst.second, tp_inst.millisec);
 
1472
  } else {
1473
  tp_date = new Date(date.getTime());
 
1474
  }
1475
  if (tp_date.toString() == 'Invalid Date') {
1476
  tp_date = undefined;
@@ -1491,7 +1569,34 @@
1491
  return;
1492
  }
1493
 
1494
- var tp_date = (date instanceof Date) ? new Date(date.getTime()) : date;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1495
 
1496
  this._updateDatepicker(inst);
1497
  this._base_setDateDatepicker.apply(this, arguments);
@@ -1519,6 +1624,18 @@
1519
  var date = this._getDate(inst);
1520
  if (date && tp_inst._parseTime($(target).val(), tp_inst.timeOnly)) {
1521
  date.setHours(tp_inst.hour, tp_inst.minute, tp_inst.second, tp_inst.millisec);
 
 
 
 
 
 
 
 
 
 
 
 
1522
  }
1523
  return date;
1524
  }
@@ -1538,8 +1655,12 @@
1538
  // Hack! The error message ends with a colon, a space, and
1539
  // the "extra" characters. We rely on that instead of
1540
  // attempting to perfectly reproduce the parsing algorithm.
1541
- date = this._base_parseDate(format, value.substring(0,value.length-(err.length-err.indexOf(':')-2)), settings);
1542
- $.timepicker.log("Error parsing the date string: " + err + "\ndate string = " + value + "\ndate format = " + format);
 
 
 
 
1543
  }
1544
  return date;
1545
  };
@@ -1639,6 +1760,7 @@
1639
  }
1640
  return this._base_optionDatepicker.call($.datepicker, target, name_clone || name, value);
1641
  };
 
1642
  /*
1643
  * jQuery isEmptyObject does not check hasOwnProperty - if someone has added to the object prototype,
1644
  * it will return false for all objects
@@ -1667,11 +1789,24 @@
1667
  };
1668
 
1669
  /*
1670
- * Determine by the time format if should use ampm
1671
- * Returns true if should use ampm, false if not
1672
  */
1673
- var useAmpm = function(timeFormat){
1674
- return (timeFormat.indexOf('t') !== -1 && timeFormat.indexOf('h') !== -1);
 
 
 
 
 
 
 
 
 
 
 
 
 
1675
  };
1676
 
1677
  /*
@@ -1683,7 +1818,7 @@
1683
  hour = hour - 12;
1684
  }
1685
 
1686
- if (hour == 0) {
1687
  hour = 12;
1688
  }
1689
 
@@ -1741,7 +1876,7 @@
1741
  * Internal function to parse datetime interval
1742
  * Returns: {date: Date, timeObj: Object}, where
1743
  * date - parsed date without time (type Date)
1744
- * timeObj = {hour: , minute: , second: , millisec: } - parsed time. Optional
1745
  */
1746
  var parseDateTimeInternal = function(dateFormat, timeFormat, dateTimeString, dateSettings, timeSettings) {
1747
  var date;
@@ -1768,15 +1903,10 @@
1768
  /*
1769
  * Internal function to set timezone_select to the local timezone
1770
  */
1771
- var selectLocalTimeZone = function(tp_inst, date) {
1772
  if (tp_inst && tp_inst.timezone_select) {
1773
- tp_inst._defaults.useLocalTimezone = true;
1774
  var now = typeof date !== 'undefined' ? date : new Date();
1775
- var tzoffset = $.timepicker.timeZoneOffsetString(now);
1776
- if (tp_inst._defaults.timezoneIso8601) {
1777
- tzoffset = tzoffset.substring(0, 3) + ':' + tzoffset.substring(3);
1778
- }
1779
- tp_inst.timezone_select.val(tzoffset);
1780
  }
1781
  };
1782
 
@@ -1787,14 +1917,60 @@
1787
 
1788
  /**
1789
  * Get the timezone offset as string from a date object (eg '+0530' for UTC+5.5)
1790
- * @param date
 
1791
  * @return string
1792
  */
1793
- $.timepicker.timeZoneOffsetString = function(date) {
1794
- var off = date.getTimezoneOffset() * -1,
 
 
 
 
1795
  minutes = off % 60,
1796
- hours = (off - minutes) / 60;
1797
- return (off >= 0 ? '+' : '-') + ('0' + (hours * 101).toString()).slice(-2) + ('0' + (minutes * 101).toString()).slice(-2);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1798
  };
1799
 
1800
  /**
@@ -1820,8 +1996,8 @@
1820
  * @param string method Can be used to specify the type of picker to be added
1821
  * @return jQuery
1822
  */
1823
- $.timepicker.dateTimeRange = function(startTime, endTime, options) {
1824
- $.timepicker.dateRange(startTime, endTime, options, 'datetimepicker');
1825
  };
1826
 
1827
  /**
@@ -1831,12 +2007,10 @@
1831
  * @param Element endTime
1832
  * @param obj options Options for the `timepicker()` call. Also supports `reformat`,
1833
  * a boolean value that can be used to reformat the input values to the `dateFormat`.
1834
- * @param string method Can be used to specify the type of picker to be added
1835
  * @return jQuery
1836
  */
1837
- $.timepicker.dateRange = function(startTime, endTime, options, method) {
1838
- method = method || 'datepicker';
1839
- $.timepicker.handleRange(method, startTime, endTime, options);
1840
  };
1841
 
1842
  /**
@@ -1850,52 +2024,73 @@
1850
  * @return jQuery
1851
  */
1852
  $.timepicker.handleRange = function(method, startTime, endTime, options) {
 
 
 
 
 
 
 
1853
  $.fn[method].call(startTime, $.extend({
1854
  onClose: function(dateText, inst) {
1855
- checkDates(this, endTime, dateText);
1856
  },
1857
  onSelect: function(selectedDateTime) {
1858
- selected(this, endTime, 'minDate');
1859
  }
1860
  }, options, options.start));
1861
  $.fn[method].call(endTime, $.extend({
1862
  onClose: function(dateText, inst) {
1863
- checkDates(this, startTime, dateText);
1864
  },
1865
  onSelect: function(selectedDateTime) {
1866
- selected(this, startTime, 'maxDate');
1867
  }
1868
  }, options, options.end));
1869
- // timepicker doesn't provide access to its 'timeFormat' option,
1870
- // nor could I get datepicker.formatTime() to behave with times, so I
1871
- // have disabled reformatting for timepicker
1872
- if (method != 'timepicker' && options.reformat) {
1873
- $([startTime, endTime]).each(function() {
1874
- var format = $(this)[method].call($(this), 'option', 'dateFormat'),
1875
- date = new Date($(this).val());
1876
- if ($(this).val() && date) {
1877
- $(this).val($.datepicker.formatDate(format, date));
1878
- }
1879
- });
1880
- }
1881
- checkDates(startTime, endTime, startTime.val());
1882
 
1883
- function checkDates(changed, other, dateText) {
1884
- if (other.val() && (new Date(startTime.val()) > new Date(endTime.val()))) {
1885
- other.val(dateText);
1886
- }
1887
- }
1888
  selected(startTime, endTime, 'minDate');
1889
  selected(endTime, startTime, 'maxDate');
1890
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1891
  function selected(changed, other, option) {
1892
- if (!$(changed).val()) {
1893
  return;
1894
  }
1895
- var date = $(changed)[method].call($(changed), 'getDate');
1896
- // timepicker doesn't implement 'getDate' and returns a jQuery
 
 
 
 
 
 
 
1897
  if (date.getTime) {
1898
- $(other)[method].call($(other), 'option', option, date);
1899
  }
1900
  }
1901
  return $([startTime.get(0), endTime.get(0)]);
@@ -1907,13 +2102,27 @@
1907
  * @return void
1908
  */
1909
  $.timepicker.log = function(err){
1910
- if(window.console)
1911
  console.log(err);
 
1912
  };
1913
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1914
  /*
1915
  * Keep up with the version
1916
  */
1917
- $.timepicker.version = "1.2";
1918
 
1919
  })(jQuery);
1
  /*
2
  * jQuery timepicker addon
3
  * By: Trent Richardson [http://trentrichardson.com]
4
+ * Version 1.3.1
5
+ * Last Modified: 07/07/2013
6
  *
7
  * Copyright 2013 Trent Richardson
8
  * You may use this project under MIT or GPL licenses.
27
  */
28
  $.extend($.ui, {
29
  timepicker: {
30
+ version: "1.3.1"
31
  }
32
  });
33
 
52
  minuteText: 'Minute',
53
  secondText: 'Second',
54
  millisecText: 'Millisecond',
55
+ microsecText: 'Microsecond',
56
  timezoneText: 'Time Zone',
57
  isRTL: false
58
  };
59
  this._defaults = { // Global defaults for all the datetime picker instances
60
  showButtonPanel: true,
61
  timeOnly: false,
62
+ showHour: null,
63
+ showMinute: null,
64
+ showSecond: null,
65
+ showMillisec: null,
66
+ showMicrosec: null,
67
+ showTimezone: null,
68
  showTime: true,
69
  stepHour: 1,
70
  stepMinute: 1,
71
  stepSecond: 1,
72
  stepMillisec: 1,
73
+ stepMicrosec: 1,
74
  hour: 0,
75
  minute: 0,
76
  second: 0,
77
  millisec: 0,
78
+ microsec: 0,
79
  timezone: null,
 
 
80
  hourMin: 0,
81
  minuteMin: 0,
82
  secondMin: 0,
83
  millisecMin: 0,
84
+ microsecMin: 0,
85
  hourMax: 23,
86
  minuteMax: 59,
87
  secondMax: 59,
88
  millisecMax: 999,
89
+ microsecMax: 999,
90
  minDateTime: null,
91
  maxDateTime: null,
92
  onSelect: null,
94
  minuteGrid: 0,
95
  secondGrid: 0,
96
  millisecGrid: 0,
97
+ microsecGrid: 0,
98
  alwaysSetTime: true,
99
  separator: ' ',
100
  altFieldTimeOnly: true,
104
  pickerTimeFormat: null,
105
  pickerTimeSuffix: null,
106
  showTimepicker: true,
 
107
  timezoneList: null,
108
  addSliderAccess: false,
109
  sliderAccessArgs: null,
123
  minute_slider: null,
124
  second_slider: null,
125
  millisec_slider: null,
126
+ microsec_slider: null,
127
  timezone_select: null,
128
  hour: 0,
129
  minute: 0,
130
  second: 0,
131
  millisec: 0,
132
+ microsec: 0,
133
  timezone: null,
 
134
  hourMinOriginal: null,
135
  minuteMinOriginal: null,
136
  secondMinOriginal: null,
137
  millisecMinOriginal: null,
138
+ microsecMinOriginal: null,
139
  hourMaxOriginal: null,
140
  minuteMaxOriginal: null,
141
  secondMaxOriginal: null,
142
  millisecMaxOriginal: null,
143
+ microsecMaxOriginal: null,
144
  ampm: '',
145
  formattedDate: '',
146
  formattedTime: '',
147
  formattedDateTime: '',
148
  timezoneList: null,
149
+ units: ['hour','minute','second','millisec', 'microsec'],
150
+ support: {},
151
  control: null,
152
 
153
  /*
163
  /*
164
  * Create a new Timepicker instance
165
  */
166
+ _newInst: function($input, opts) {
167
  var tp_inst = new Timepicker(),
168
  inlineSettings = {},
169
+ fns = {},
170
+ overrides, i;
171
 
172
  for (var attrName in this._defaults) {
173
  if(this._defaults.hasOwnProperty(attrName)){
181
  }
182
  }
183
  }
184
+
185
  overrides = {
186
  beforeShow: function (input, dp_inst) {
187
  if ($.isFunction(tp_inst._defaults.evnts.beforeShow)) {
206
  };
207
  for (i in overrides) {
208
  if (overrides.hasOwnProperty(i)) {
209
+ fns[i] = opts[i] || null;
210
  }
211
  }
212
+
213
+ tp_inst._defaults = $.extend({}, this._defaults, inlineSettings, opts, overrides, {
214
  evnts:fns,
215
  timepicker: tp_inst // add timepicker as a property of datepicker: $.datepicker._get(dp_inst, 'timepicker');
216
  });
221
  return val.toUpperCase();
222
  });
223
 
224
+ // detect which units are supported
225
+ tp_inst.support = detectSupport(
226
+ tp_inst._defaults.timeFormat +
227
+ (tp_inst._defaults.pickerTimeFormat? tp_inst._defaults.pickerTimeFormat:'') +
228
+ (tp_inst._defaults.altTimeFormat? tp_inst._defaults.altTimeFormat:''));
229
+
230
  // controlType is string - key to our this._controls
231
  if(typeof(tp_inst._defaults.controlType) === 'string'){
232
+ if(tp_inst._defaults.controlType == 'slider' && typeof(jQuery.ui.slider) === 'undefined'){
233
  tp_inst._defaults.controlType = 'select';
234
  }
235
  tp_inst.control = tp_inst._controls[tp_inst._defaults.controlType];
239
  tp_inst.control = tp_inst._defaults.controlType;
240
  }
241
 
242
+ // prep the timezone options
243
+ var timezoneList = [-720,-660,-600,-570,-540,-480,-420,-360,-300,-270,-240,-210,-180,-120,-60,
244
+ 0,60,120,180,210,240,270,300,330,345,360,390,420,480,525,540,570,600,630,660,690,720,765,780,840];
245
+ if (tp_inst._defaults.timezoneList !== null) {
246
+ timezoneList = tp_inst._defaults.timezoneList;
247
+ }
248
+ var tzl=timezoneList.length,tzi=0,tzv=null;
249
+ if (tzl > 0 && typeof timezoneList[0] !== 'object') {
250
+ for(; tzi<tzl; tzi++){
251
+ tzv = timezoneList[tzi];
252
+ timezoneList[tzi] = { value: tzv, label: $.timepicker.timezoneOffsetString(tzv, tp_inst.support.iso8601) };
253
  }
 
254
  }
255
+ tp_inst._defaults.timezoneList = timezoneList;
256
 
257
+ // set the default units
258
+ tp_inst.timezone = tp_inst._defaults.timezone !== null? $.timepicker.timezoneOffsetNumber(tp_inst._defaults.timezone) :
259
+ ((new Date()).getTimezoneOffset()*-1);
260
  tp_inst.hour = tp_inst._defaults.hour < tp_inst._defaults.hourMin? tp_inst._defaults.hourMin :
261
  tp_inst._defaults.hour > tp_inst._defaults.hourMax? tp_inst._defaults.hourMax : tp_inst._defaults.hour;
262
  tp_inst.minute = tp_inst._defaults.minute < tp_inst._defaults.minuteMin? tp_inst._defaults.minuteMin :
265
  tp_inst._defaults.second > tp_inst._defaults.secondMax? tp_inst._defaults.secondMax : tp_inst._defaults.second;
266
  tp_inst.millisec = tp_inst._defaults.millisec < tp_inst._defaults.millisecMin? tp_inst._defaults.millisecMin :
267
  tp_inst._defaults.millisec > tp_inst._defaults.millisecMax? tp_inst._defaults.millisecMax : tp_inst._defaults.millisec;
268
+ tp_inst.microsec = tp_inst._defaults.microsec < tp_inst._defaults.microsecMin? tp_inst._defaults.microsecMin :
269
+ tp_inst._defaults.microsec > tp_inst._defaults.microsecMax? tp_inst._defaults.microsecMax : tp_inst._defaults.microsec;
270
  tp_inst.ampm = '';
271
  tp_inst.$input = $input;
272
 
273
+ if (tp_inst._defaults.altField) {
274
+ tp_inst.$altInput = $(tp_inst._defaults.altField).css({
275
  cursor: 'pointer'
276
  }).focus(function() {
277
  $input.trigger("focus");
359
  tp_inst = this,
360
  litem = '',
361
  uitem = '',
362
+ show = null,
363
  max = {},
364
  gridSize = {},
365
+ size = null,
366
+ i=0,
367
+ l=0;
368
 
369
  // Prevent displaying twice
370
  if ($dp.find("div.ui-timepicker-div").length === 0 && o.showTimepicker) {
373
  '<dd class="ui_tpicker_time"' + ((o.showTime) ? '' : noDisplay) + '></dd>';
374
 
375
  // Create the markup
376
+ for(i=0,l=this.units.length; i<l; i++){
377
  litem = this.units[i];
378
  uitem = litem.substr(0,1).toUpperCase() + litem.substr(1);
379
+ show = o['show'+uitem] !== null? o['show'+uitem] : this.support[litem];
380
+
381
  // Added by Peter Medeiros:
382
  // - Figure out what the hour/minute/second max should be based on the step values.
383
  // - Example: if stepMinute is 15, then minMax is 45.
384
  max[litem] = parseInt((o[litem+'Max'] - ((o[litem+'Max'] - o[litem+'Min']) % o['step'+uitem])), 10);
385
  gridSize[litem] = 0;
386
 
387
+ html += '<dt class="ui_tpicker_'+ litem +'_label"' + (show ? '' : noDisplay) + '>' + o[litem +'Text'] + '</dt>' +
388
+ '<dd class="ui_tpicker_'+ litem +'"><div class="ui_tpicker_'+ litem +'_slider"' + (show ? '' : noDisplay) + '></div>';
389
 
390
+ if (show && o[litem+'Grid'] > 0) {
391
  html += '<div style="padding-left: 1px"><table class="ui-tpicker-grid-label"><tr>';
392
 
393
  if(litem == 'hour'){
394
  for (var h = o[litem+'Min']; h <= max[litem]; h += parseInt(o[litem+'Grid'], 10)) {
395
  gridSize[litem]++;
396
+ var tmph = $.datepicker.formatTime(this.support.ampm? 'hht':'HH', {hour:h}, o);
397
  html += '<td data-for="'+litem+'">' + tmph + '</td>';
398
  }
399
  }
410
  }
411
 
412
  // Timezone
413
+ var showTz = o.showTimezone !== null? o.showTimezone : this.support.timezone;
414
+ html += '<dt class="ui_tpicker_timezone_label"' + (showTz ? '' : noDisplay) + '>' + o.timezoneText + '</dt>';
415
+ html += '<dd class="ui_tpicker_timezone" ' + (showTz ? '' : noDisplay) + '></dd>';
416
 
417
  // Create the elements from string
418
  html += '</dl></div>';
425
  }
426
 
427
  // add sliders, adjust grids, add events
428
+ for(i=0,l=tp_inst.units.length; i<l; i++){
429
  litem = tp_inst.units[i];
430
  uitem = litem.substr(0,1).toUpperCase() + litem.substr(1);
431
+ show = o['show'+uitem] !== null? o['show'+uitem] : this.support[litem];
432
 
433
  // add the slider
434
  tp_inst[litem+'_slider'] = tp_inst.control.create(tp_inst, $tp.find('.ui_tpicker_'+litem+'_slider'), litem, tp_inst[litem], o[litem+'Min'], max[litem], o['step'+uitem]);
435
 
436
  // adjust the grid and add click event
437
+ if (show && o[litem+'Grid'] > 0) {
438
  size = 100 * gridSize[litem] * o[litem+'Grid'] / (max[litem] - o[litem+'Min']);
439
  $tp.find('.ui_tpicker_'+litem+' table').css({
440
  width: size + "%",
463
 
464
  tp_inst._onTimeChange();
465
  tp_inst._onSelectHandler();
466
+ }).css({
 
467
  cursor: 'pointer',
468
  width: (100 / gridSize[litem]) + '%',
469
  textAlign: 'center',
479
  return $("<option />").val(typeof val == "object" ? val.value : val).text(typeof val == "object" ? val.label : val);
480
  }));
481
  if (typeof(this.timezone) != "undefined" && this.timezone !== null && this.timezone !== "") {
482
+ var local_timezone = (new Date(this.inst.selectedYear, this.inst.selectedMonth, this.inst.selectedDay, 12)).getTimezoneOffset()*-1;
 
483
  if (local_timezone == this.timezone) {
484
+ selectLocalTimezone(tp_inst);
485
  } else {
486
  this.timezone_select.val(this.timezone);
487
  }
488
  } else {
489
  if (typeof(this.hour) != "undefined" && this.hour !== null && this.hour !== "") {
490
+ this.timezone_select.val(o.timezone);
491
  } else {
492
+ selectLocalTimezone(tp_inst);
493
  }
494
  }
495
  this.timezone_select.change(function() {
 
496
  tp_inst._onTimeChange();
497
  tp_inst._onSelectHandler();
498
  });
543
  }
544
  // end slideAccess integration
545
 
546
+ tp_inst._limitMinMaxDateTime(this.inst, true);
547
  }
548
  },
549
 
563
  var minDateTime = $.datepicker._get(dp_inst, 'minDateTime'),
564
  minDateTimeDate = new Date(minDateTime.getFullYear(), minDateTime.getMonth(), minDateTime.getDate(), 0, 0, 0, 0);
565
 
566
+ if (this.hourMinOriginal === null || this.minuteMinOriginal === null || this.secondMinOriginal === null || this.millisecMinOriginal === null || this.microsecMinOriginal === null) {
567
  this.hourMinOriginal = o.hourMin;
568
  this.minuteMinOriginal = o.minuteMin;
569
  this.secondMinOriginal = o.secondMin;
570
  this.millisecMinOriginal = o.millisecMin;
571
+ this.microsecMinOriginal = o.microsecMin;
572
  }
573
 
574
  if (dp_inst.settings.timeOnly || minDateTimeDate.getTime() == dp_date.getTime()) {
582
  if (this.second <= this._defaults.secondMin) {
583
  this.second = this._defaults.secondMin;
584
  this._defaults.millisecMin = minDateTime.getMilliseconds();
585
+ if(this.millisec <= this._defaults.millisecMin) {
 
586
  this.millisec = this._defaults.millisecMin;
587
+ this._defaults.microsecMin = minDateTime.getMicroseconds();
588
+ } else {
589
+ if (this.microsec < this._defaults.microsecMin) {
590
+ this.microsec = this._defaults.microsecMin;
591
+ }
592
+ this._defaults.microsecMin = this.microsecMinOriginal;
593
  }
594
+ } else {
595
  this._defaults.millisecMin = this.millisecMinOriginal;
596
+ this._defaults.microsecMin = this.microsecMinOriginal;
597
  }
598
  } else {
599
  this._defaults.secondMin = this.secondMinOriginal;
600
  this._defaults.millisecMin = this.millisecMinOriginal;
601
+ this._defaults.microsecMin = this.microsecMinOriginal;
602
  }
603
  } else {
604
  this._defaults.minuteMin = this.minuteMinOriginal;
605
  this._defaults.secondMin = this.secondMinOriginal;
606
  this._defaults.millisecMin = this.millisecMinOriginal;
607
+ this._defaults.microsecMin = this.microsecMinOriginal;
608
  }
609
  } else {
610
  this._defaults.hourMin = this.hourMinOriginal;
611
  this._defaults.minuteMin = this.minuteMinOriginal;
612
  this._defaults.secondMin = this.secondMinOriginal;
613
  this._defaults.millisecMin = this.millisecMinOriginal;
614
+ this._defaults.microsecMin = this.microsecMinOriginal;
615
  }
616
  }
617
 
619
  var maxDateTime = $.datepicker._get(dp_inst, 'maxDateTime'),
620
  maxDateTimeDate = new Date(maxDateTime.getFullYear(), maxDateTime.getMonth(), maxDateTime.getDate(), 0, 0, 0, 0);
621
 
622
+ if (this.hourMaxOriginal === null || this.minuteMaxOriginal === null || this.secondMaxOriginal === null || this.millisecMaxOriginal === null) {
623
  this.hourMaxOriginal = o.hourMax;
624
  this.minuteMaxOriginal = o.minuteMax;
625
  this.secondMaxOriginal = o.secondMax;
626
  this.millisecMaxOriginal = o.millisecMax;
627
+ this.microsecMaxOriginal = o.microsecMax;
628
  }
629
 
630
  if (dp_inst.settings.timeOnly || maxDateTimeDate.getTime() == dp_date.getTime()) {
638
  if (this.second >= this._defaults.secondMax) {
639
  this.second = this._defaults.secondMax;
640
  this._defaults.millisecMax = maxDateTime.getMilliseconds();
641
+ if (this.millisec >= this._defaults.millisecMax) {
 
642
  this.millisec = this._defaults.millisecMax;
643
+ this._defaults.microsecMax = maxDateTime.getMicroseconds();
644
+ } else {
645
+ if (this.microsec > this._defaults.microsecMax) {
646
+ this.microsec = this._defaults.microsecMax;
647
+ }
648
+ this._defaults.microsecMax = this.microsecMaxOriginal;
649
  }
650
+ } else {
651
  this._defaults.millisecMax = this.millisecMaxOriginal;
652
+ this._defaults.microsecMax = this.microsecMaxOriginal;
653
  }
654
  } else {
655
  this._defaults.secondMax = this.secondMaxOriginal;
656
  this._defaults.millisecMax = this.millisecMaxOriginal;
657
+ this._defaults.microsecMax = this.microsecMaxOriginal;
658
  }
659
  } else {
660
  this._defaults.minuteMax = this.minuteMaxOriginal;
661
  this._defaults.secondMax = this.secondMaxOriginal;
662
  this._defaults.millisecMax = this.millisecMaxOriginal;
663
+ this._defaults.microsecMax = this.microsecMaxOriginal;
664
  }
665
  } else {
666
  this._defaults.hourMax = this.hourMaxOriginal;
667
  this._defaults.minuteMax = this.minuteMaxOriginal;
668
  this._defaults.secondMax = this.secondMaxOriginal;
669
  this._defaults.millisecMax = this.millisecMaxOriginal;
670
+ this._defaults.microsecMax = this.microsecMaxOriginal;
671
  }
672
  }
673
 
676
  minMax = parseInt((this._defaults.minuteMax - ((this._defaults.minuteMax - this._defaults.minuteMin) % this._defaults.stepMinute)), 10),
677
  secMax = parseInt((this._defaults.secondMax - ((this._defaults.secondMax - this._defaults.secondMin) % this._defaults.stepSecond)), 10),
678
  millisecMax = parseInt((this._defaults.millisecMax - ((this._defaults.millisecMax - this._defaults.millisecMin) % this._defaults.stepMillisec)), 10);
679
+ microsecMax = parseInt((this._defaults.microsecMax - ((this._defaults.microsecMax - this._defaults.microsecMin) % this._defaults.stepMicrosec)), 10);
680
 
681
  if (this.hour_slider) {
682
  this.control.options(this, this.hour_slider, 'hour', { min: this._defaults.hourMin, max: hourMax });
694
  this.control.options(this, this.millisec_slider, 'millisec', { min: this._defaults.millisecMin, max: millisecMax });
695
  this.control.value(this, this.millisec_slider, 'millisec', this.millisec - (this.millisec % this._defaults.stepMillisec));
696
  }
697
+ if (this.microsec_slider) {
698
+ this.control.options(this, this.microsec_slider, 'microsec', { min: this._defaults.microsecMin, max: microsecMax });
699
+ this.control.value(this, this.microsec_slider, 'microsec', this.microsec - (this.microsec % this._defaults.stepMicrosec));
700
+ }
701
  }
702
 
703
  },
711
  minute = (this.minute_slider) ? this.control.value(this, this.minute_slider, 'minute') : false,
712
  second = (this.second_slider) ? this.control.value(this, this.second_slider, 'second') : false,
713
  millisec = (this.millisec_slider) ? this.control.value(this, this.millisec_slider, 'millisec') : false,
714
+ microsec = (this.microsec_slider) ? this.control.value(this, this.microsec_slider, 'microsec') : false,
715
  timezone = (this.timezone_select) ? this.timezone_select.val() : false,
716
  o = this._defaults,
717
  pickerTimeFormat = o.pickerTimeFormat || o.timeFormat,
729
  if (typeof(millisec) == 'object') {
730
  millisec = false;
731
  }
732
+ if (typeof(microsec) == 'object') {
733
+ microsec = false;
734
+ }
735
  if (typeof(timezone) == 'object') {
736
  timezone = false;
737
  }
748
  if (millisec !== false) {
749
  millisec = parseInt(millisec, 10);
750
  }
751
+ if (microsec !== false) {
752
+ microsec = parseInt(microsec, 10);
753
+ }
754
 
755
  var ampm = o[hour < 12 ? 'amNames' : 'pmNames'][0];
756
 
757
  // If the update was done in the input field, the input field should not be updated.
758
  // If the update was done using the sliders, update the input field.
759
+ var hasChanged = (hour != this.hour || minute != this.minute || second != this.second || millisec != this.millisec || microsec != this.microsec
760
  || (this.ampm.length > 0 && (hour < 12) != ($.inArray(this.ampm.toUpperCase(), this.amNames) !== -1))
761
+ || (this.timezone !== null && timezone != this.timezone));
762
 
763
  if (hasChanged) {
764
 
774
  if (millisec !== false) {
775
  this.millisec = millisec;
776
  }
777
+ if (microsec !== false) {
778
+ this.microsec = microsec;
779
+ }
780
  if (timezone !== false) {
781
  this.timezone = timezone;
782
  }
787
 
788
  this._limitMinMaxDateTime(this.inst, true);
789
  }
790
+ if (this.support.ampm) {
791
  this.ampm = ampm;
792
  }
793
 
825
  */
826
  _updateDateTime: function(dp_inst) {
827
  dp_inst = this.inst || dp_inst;
828
+ //var dt = $.datepicker._daylightSavingAdjust(new Date(dp_inst.selectedYear, dp_inst.selectedMonth, dp_inst.selectedDay)),
829
+ var dt = $.datepicker._daylightSavingAdjust(new Date(dp_inst.currentYear, dp_inst.currentMonth, dp_inst.currentDay)),
830
  dateFmt = $.datepicker._get(dp_inst, 'dateFormat'),
831
  formatCfg = $.datepicker._getFormatConfig(dp_inst),
832
  timeAvailable = dt !== null && this.timeDefined;
834
  var formattedDateTime = this.formattedDate;
835
 
836
  // if a slider was changed but datepicker doesn't have a value yet, set it
837
+ if(dp_inst.lastVal===""){
838
  dp_inst.currentYear=dp_inst.selectedYear;
839
  dp_inst.currentMonth=dp_inst.selectedMonth;
840
  dp_inst.currentDay=dp_inst.selectedDay;
859
 
860
  if (!this._defaults.showTimepicker) {
861
  this.$input.val(this.formattedDate);
862
+ } else if (this.$altInput && this._defaults.timeOnly === false && this._defaults.altFieldTimeOnly === true) {
863
  this.$altInput.val(this.formattedTime);
864
  this.$input.val(this.formattedDate);
865
  } else if (this.$altInput) {
867
  var altFormattedDateTime = '',
868
  altSeparator = this._defaults.altSeparator ? this._defaults.altSeparator : this._defaults.separator,
869
  altTimeSuffix = this._defaults.altTimeSuffix ? this._defaults.altTimeSuffix : this._defaults.timeSuffix;
870
+
871
+ if(!this._defaults.timeOnly){
872
+ if (this._defaults.altFormat){
873
+ altFormattedDateTime = $.datepicker.formatDate(this._defaults.altFormat, (dt === null ? new Date() : dt), formatCfg);
874
+ }
875
+ else{
876
+ altFormattedDateTime = this.formattedDate;
877
+ }
878
+
879
+ if (altFormattedDateTime){
880
+ altFormattedDateTime += altSeparator;
881
+ }
882
+ }
883
 
884
+ if(this._defaults.altTimeFormat){
885
+ altFormattedDateTime += $.datepicker.formatTime(this._defaults.altTimeFormat, this, this._defaults) + altTimeSuffix;
886
+ }
887
+ else{
888
+ altFormattedDateTime += this.formattedTime + altTimeSuffix;
889
+ }
890
  this.$altInput.val(altFormattedDateTime);
891
  } else {
892
  this.$input.val(formattedDateTime);
940
  if(tp_inst._defaults.isRTL){
941
  if(typeof(opts) == 'string'){
942
  if(opts == 'min' || opts == 'max'){
943
+ if(val !== undefined){
944
  return obj.slider(opts, val*-1);
945
+ }
946
  return Math.abs(obj.slider(opts));
947
  }
948
  return obj.slider(opts);
950
  var min = opts.min,
951
  max = opts.max;
952
  opts.min = opts.max = null;
953
+ if(min !== undefined){
954
  opts.max = min * -1;
955
+ }
956
+ if(max !== undefined){
957
  opts.min = max * -1;
958
+ }
959
  return obj.slider(opts);
960
  }
961
+ if(typeof(opts) == 'string' && val !== undefined){
962
  return obj.slider(opts, val);
963
+ }
964
  return obj.slider(opts);
965
  },
966
  value: function(tp_inst, obj, unit, val){
967
  if(tp_inst._defaults.isRTL){
968
+ if(val !== undefined){
969
  return obj.slider('value', val*-1);
970
+ }
971
  return Math.abs(obj.slider('value'));
972
  }
973
+ if(val !== undefined){
974
  return obj.slider('value', val);
975
+ }
976
  return obj.slider('value');
977
  }
978
  },
980
  select: {
981
  create: function(tp_inst, obj, unit, val, min, max, step){
982
  var sel = '<select class="ui-timepicker-select" data-unit="'+ unit +'" data-min="'+ min +'" data-max="'+ max +'" data-step="'+ step +'">',
983
+ format = tp_inst._defaults.pickerTimeFormat || tp_inst._defaults.timeFormat;
 
984
 
985
  for(var i=min; i<=max; i+=step){
986
  sel += '<option value="'+ i +'"'+ (i==val? ' selected':'') +'>';
987
+ if(unit == 'hour'){
988
+ sel += $.datepicker.formatTime($.trim(format.replace(/[^ht ]/ig,'')), {hour:i}, tp_inst._defaults);
989
+ }
990
+ else if(unit == 'millisec' || unit == 'microsec' || i >= 10){ sel += i; }
991
+ else {sel += '0'+ i.toString(); }
992
  sel += '</option>';
993
  }
994
  sel += '</select>';
1006
  var o = {},
1007
  $t = obj.children('select');
1008
  if(typeof(opts) == 'string'){
1009
+ if(val === undefined){
1010
  return $t.data(opts);
1011
+ }
1012
  o[opts] = val;
1013
  }
1014
+ else{ o = opts; }
1015
  return tp_inst.control.create(tp_inst, obj, $t.data('unit'), $t.val(), o.min || $t.data('min'), o.max || $t.data('max'), o.step || $t.data('step'));
1016
  },
1017
  value: function(tp_inst, obj, unit, val){
1018
  var $t = obj.children('select');
1019
+ if(val !== undefined){
1020
  return $t.val(val);
1021
+ }
1022
  return $t.val();
1023
  }
1024
  }
1078
  if (parseRes.timeObj) {
1079
  var t = parseRes.timeObj;
1080
  parseRes.date.setHours(t.hour, t.minute, t.second, t.millisec);
1081
+ parseRes.date.setMicroseconds(t.microsec);
1082
  }
1083
 
1084
  return parseRes.date;
1088
  * Public utility to parse time
1089
  */
1090
  $.datepicker.parseTime = function(timeFormat, timeString, options) {
1091
+ var o = extendRemove(extendRemove({}, $.timepicker._defaults), options || {}),
1092
+ iso8601 = (timeFormat.replace(/\'.*?\'/g,'').indexOf('Z') !== -1);
1093
 
1094
  // Strict parse requires the timeString to match the timeFormat exactly
1095
  var strictParse = function(f, s, o){
1111
 
1112
  // figure out position of time elements.. cause js cant do named captures
1113
  var getFormatPositions = function(timeFormat) {
1114
+ var finds = timeFormat.toLowerCase().match(/(h{1,2}|m{1,2}|s{1,2}|l{1}|c{1}|t{1,2}|z|'.*?')/g),
1115
  orders = {
1116
  h: -1,
1117
  m: -1,
1118
  s: -1,
1119
  l: -1,
1120
+ c: -1,
1121
  t: -1,
1122
  z: -1
1123
  };
1133
  };
1134
 
1135
  var regstr = '^' + f.toString()
1136
+ .replace(/([hH]{1,2}|mm?|ss?|[tT]{1,2}|[zZ]|[lc]|'.*?')/g, function (match) {
1137
  var ml = match.length;
1138
  switch (match.charAt(0).toLowerCase()) {
1139
  case 'h': return ml === 1? '(\\d?\\d)':'(\\d{'+ml+'})';
1140
  case 'm': return ml === 1? '(\\d?\\d)':'(\\d{'+ml+'})';
1141
  case 's': return ml === 1? '(\\d?\\d)':'(\\d{'+ml+'})';
1142
  case 'l': return '(\\d?\\d?\\d)';
1143
+ case 'c': return '(\\d?\\d?\\d)';
1144
  case 'z': return '(z|[-+]\\d\\d:?\\d\\d|\\S+)?';
1145
  case 't': return getPatternAmpm(o.amNames, o.pmNames);
1146
  default: // literal escaped in quotes
1159
  hour: 0,
1160
  minute: 0,
1161
  second: 0,
1162
+ millisec: 0,
1163
+ microsec: 0
1164
  };
1165
 
1166
  if (treg) {
1195
  if (order.l !== -1) {
1196
  resTime.millisec = Number(treg[order.l]);
1197
  }
1198
+ if (order.c !== -1) {
1199
+ resTime.microsec = Number(treg[order.c]);
1200
+ }
1201
  if (order.z !== -1 && treg[order.z] !== undefined) {
1202
+ resTime.timezone = $.timepicker.timezoneOffsetNumber(treg[order.z]);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1203
  }
1204
 
1205
 
1227
  minute: d.getMinutes(),
1228
  second: d.getSeconds(),
1229
  millisec: d.getMilliseconds(),
1230
+ microsec: d.getMicroseconds(),
1231
+ timezone: d.getTimezoneOffset()*-1
1232
  };
1233
  }
1234
  catch(err){
1243
  }; // end looseParse
1244
 
1245
  if(typeof o.parse === "function"){
1246
+ return o.parse(timeFormat, timeString, o);
1247
  }
1248
  if(o.parse === 'loose'){
1249
  return looseParse(timeFormat, timeString, o);
1265
  minute: 0,
1266
  second: 0,
1267
  millisec: 0,
1268
+ timezone: 0
1269
  }, time);
1270
 
1271
  var tmptime = format,
1276
  ampmName = options.pmNames[0];
1277
  }
1278
 
1279
+ tmptime = tmptime.replace(/(?:HH?|hh?|mm?|ss?|[tT]{1,2}|[zZ]|[lc]|('.*?'|".*?"))/g, function(match) {
1280
  switch (match) {
1281
  case 'HH':
1282
  return ('0' + hour).slice(-2);
1296
  return time.second;
1297
  case 'l':
1298
  return ('00' + time.millisec).slice(-3);
1299
+ case 'c':
1300
+ return ('00' + time.microsec).slice(-3);
1301
  case 'z':
1302
+ return $.timepicker.timezoneOffsetString(time.timezone === null? options.timezone : time.timezone, false);
1303
+ case 'Z':
1304
+ return $.timepicker.timezoneOffsetString(time.timezone === null? options.timezone : time.timezone, true);
1305
  case 'T':
1306
  return ampmName.charAt(0).toUpperCase();
1307
  case 'TT':
1362
  var tp_inst = this._get(inst, 'timepicker');
1363
  if (tp_inst) {
1364
  tp_inst._addTimePicker(inst);
 
 
 
 
 
 
1365
  }
1366
  }
1367
  };
1376
 
1377
  if (tp_inst) {
1378
  if ($.datepicker._get(inst, 'constrainInput')) {
1379
+ var ampm = tp_inst.support.ampm,
1380
+ tz = tp_inst._defaults.showTimezone !== null? tp_inst._defaults.showTimezone : tp_inst.support.timezone,
1381
  dateChars = $.datepicker._possibleChars($.datepicker._get(inst, 'dateFormat')),
1382
  datetimeChars = tp_inst._defaults.timeFormat.toString()
1383
  .replace(/[hms]/g, '')
1389
  .replace(/t/g, ampm ? 'ap' : '') +
1390
  " " + tp_inst._defaults.separator +
1391
  tp_inst._defaults.timeSuffix +
1392
+ (tz ? tp_inst._defaults.timezoneList.join('') : '') +
1393
  (tp_inst._defaults.amNames.join('')) + (tp_inst._defaults.pmNames.join('')) +
1394
  dateChars,
1395
  chr = String.fromCharCode(event.charCode === undefined ? event.keyCode : event.charCode);
1420
 
1421
  altFormattedDateTime += $.datepicker.formatTime(altTimeFormat, tp_inst, tp_inst._defaults) + altTimeSuffix;
1422
  if(!tp_inst._defaults.timeOnly && !tp_inst._defaults.altFieldTimeOnly && date !== null){
1423
+ if(tp_inst._defaults.altFormat){
1424
  altFormattedDateTime = $.datepicker.formatDate(tp_inst._defaults.altFormat, date, formatCfg) + altSeparator + altFormattedDateTime;
1425
+ }
1426
+ else{
1427
+ altFormattedDateTime = tp_inst.formattedDate + altSeparator + altFormattedDateTime;
1428
+ }
1429
  }
1430
  $(altField).val(altFormattedDateTime);
1431
  }
1465
  $dp = inst.dpDiv;
1466
  this._base_gotoToday(id);
1467
  var tp_inst = this._get(inst, 'timepicker');
1468
+ selectLocalTimezone(tp_inst);
1469
  var now = new Date();
1470
  this._setTime(inst, now);
1471
  $('.ui-datepicker-today', $dp).click();
1516
  tp_inst.minute = date ? date.getMinutes() : defaults.minute;
1517
  tp_inst.second = date ? date.getSeconds() : defaults.second;
1518
  tp_inst.millisec = date ? date.getMilliseconds() : defaults.millisec;
1519
+ tp_inst.microsec = date ? date.getMicroseconds() : defaults.microsec;
1520
 
1521
  //check if within min/max times..
1522
  tp_inst._limitMinMaxDateTime(inst, true);
1545
  tp_inst._parseTime(date, withDate);
1546
  tp_date = new Date();
1547
  tp_date.setHours(tp_inst.hour, tp_inst.minute, tp_inst.second, tp_inst.millisec);
1548
+ tp_date.setMicroseconds(tp_inst.microsec);
1549
  } else {
1550
  tp_date = new Date(date.getTime());
1551
+ tp_date.setMicroseconds(date.getMicroseconds());
1552
  }
1553
  if (tp_date.toString() == 'Invalid Date') {
1554
  tp_date = undefined;
1569
  return;
1570
  }
1571
 
1572
+ if(typeof(date) === 'string'){
1573
+ date = new Date(date);
1574
+ if(!date.getTime()){
1575
+ $.timepicker.log("Error creating Date object from string.");
1576
+ }
1577
+ }
1578
+
1579
+ var tp_inst = this._get(inst, 'timepicker');
1580
+ var tp_date;
1581
+ if (date instanceof Date) {
1582
+ tp_date = new Date(date.getTime());
1583
+ tp_date.setMicroseconds(date.getMicroseconds());
1584
+ } else {
1585
+ tp_date = date;
1586
+ }
1587
+
1588
+ // This is important if you are using the timezone option, javascript's Date
1589
+ // object will only return the timezone offset for the current locale, so we
1590
+ // adjust it accordingly. If not using timezone option this won't matter..
1591
+ // If a timezone is different in tp, keep the timezone as is
1592
+ if(tp_inst){
1593
+ // look out for DST if tz wasn't specified
1594
+ if(!tp_inst.support.timezone && tp_inst._defaults.timezone === null){
1595
+ tp_inst.timezone = tp_date.getTimezoneOffset()*-1;
1596
+ }
1597
+ date = $.timepicker.timezoneAdjust(date, tp_inst.timezone);
1598
+ tp_date = $.timepicker.timezoneAdjust(tp_date, tp_inst.timezone);
1599
+ }
1600
 
1601
  this._updateDatepicker(inst);
1602
  this._base_setDateDatepicker.apply(this, arguments);
1624
  var date = this._getDate(inst);
1625
  if (date && tp_inst._parseTime($(target).val(), tp_inst.timeOnly)) {
1626
  date.setHours(tp_inst.hour, tp_inst.minute, tp_inst.second, tp_inst.millisec);
1627
+ date.setMicroseconds(tp_inst.microsec);
1628
+
1629
+ // This is important if you are using the timezone option, javascript's Date
1630
+ // object will only return the timezone offset for the current locale, so we
1631
+ // adjust it accordingly. If not using timezone option this won't matter..
1632
+ if(tp_inst.timezone != null){
1633
+ // look out for DST if tz wasn't specified
1634
+ if(!tp_inst.support.timezone && tp_inst._defaults.timezone === null){
1635
+ tp_inst.timezone = date.getTimezoneOffset()*-1;
1636
+ }
1637
+ date = $.timepicker.timezoneAdjust(date, tp_inst.timezone);
1638
+ }
1639
  }
1640
  return date;
1641
  }
1655
  // Hack! The error message ends with a colon, a space, and
1656
  // the "extra" characters. We rely on that instead of
1657
  // attempting to perfectly reproduce the parsing algorithm.
1658
+ if (err.indexOf(":") >= 0) {
1659
+ date = this._base_parseDate(format, value.substring(0,value.length-(err.length-err.indexOf(':')-2)), settings);
1660
+ $.timepicker.log("Error parsing the date string: " + err + "\ndate string = " + value + "\ndate format = " + format);
1661
+ } else {
1662
+ throw err;
1663
+ }
1664
  }
1665
  return date;
1666
  };
1760
  }
1761
  return this._base_optionDatepicker.call($.datepicker, target, name_clone || name, value);
1762
  };
1763
+
1764
  /*
1765
  * jQuery isEmptyObject does not check hasOwnProperty - if someone has added to the object prototype,
1766
  * it will return false for all objects
1789
  };
1790
 
1791
  /*
1792
+ * Determine by the time format which units are supported
1793
+ * Returns an object of booleans for each unit
1794
  */
1795
+ var detectSupport = function(timeFormat){
1796
+ var tf = timeFormat.replace(/\'.*?\'/g,'').toLowerCase(), // removes literals
1797
+ isIn = function(f, t){ // does the format contain the token?
1798
+ return f.indexOf(t) !== -1? true:false;
1799
+ };
1800
+ return {
1801
+ hour: isIn(tf,'h'),
1802
+ minute: isIn(tf,'m'),
1803
+ second: isIn(tf,'s'),
1804
+ millisec: isIn(tf,'l'),
1805
+ microsec: isIn(tf,'c'),
1806
+ timezone: isIn(tf,'z'),
1807
+ ampm: isIn(tf,'t') && isIn(timeFormat,'h'),
1808
+ iso8601: isIn(timeFormat, 'Z')
1809
+ };
1810
  };
1811
 
1812
  /*
1818
  hour = hour - 12;
1819
  }
1820
 
1821
+ if (hour === 0) {
1822
  hour = 12;
1823
  }
1824
 
1876
  * Internal function to parse datetime interval
1877
  * Returns: {date: Date, timeObj: Object}, where
1878
  * date - parsed date without time (type Date)
1879
+ * timeObj = {hour: , minute: , second: , millisec: , microsec: } - parsed time. Optional
1880
  */
1881
  var parseDateTimeInternal = function(dateFormat, timeFormat, dateTimeString, dateSettings, timeSettings) {
1882
  var date;
1903
  /*
1904
  * Internal function to set timezone_select to the local timezone
1905
  */
1906
+ var selectLocalTimezone = function(tp_inst, date) {
1907
  if (tp_inst && tp_inst.timezone_select) {
 
1908
  var now = typeof date !== 'undefined' ? date : new Date();
1909
+ tp_inst.timezone_select.val(now.getTimezoneOffset()*-1);
 
 
 
 
1910
  }
1911
  };
1912
 
1917
 
1918
  /**
1919
  * Get the timezone offset as string from a date object (eg '+0530' for UTC+5.5)
1920
+ * @param number if not a number this value is returned
1921
+ * @param boolean if true formats in accordance to iso8601 "+12:45"
1922
  * @return string
1923
  */
1924
+ $.timepicker.timezoneOffsetString = function(tzMinutes, iso8601) {
1925
+ if(isNaN(tzMinutes) || tzMinutes > 840){
1926
+ return tzMinutes;
1927
+ }
1928
+
1929
+ var off = tzMinutes,
1930
  minutes = off % 60,
1931
+ hours = (off - minutes) / 60,
1932
+ iso = iso8601? ':':'',
1933
+ tz = (off >= 0 ? '+' : '-') + ('0' + (hours * 101).toString()).slice(-2) + iso + ('0' + (minutes * 101).toString()).slice(-2);
1934
+
1935
+ if(tz == '+00:00'){
1936
+ return 'Z';
1937
+ }
1938
+ return tz;
1939
+ };
1940
+
1941
+ /**
1942
+ * Get the number in minutes that represents a timezone string
1943
+ * @param string formated like "+0500", "-1245"
1944
+ * @return number
1945
+ */
1946
+ $.timepicker.timezoneOffsetNumber = function(tzString) {
1947
+ tzString = tzString.toString().replace(':',''); // excuse any iso8601, end up with "+1245"
1948
+
1949
+ if(tzString.toUpperCase() === 'Z'){ // if iso8601 with Z, its 0 minute offset
1950
+ return 0;
1951
+ }
1952
+
1953
+ if(!/^(\-|\+)\d{4}$/.test(tzString)){ // possibly a user defined tz, so just give it back
1954
+ return tzString;
1955
+ }
1956
+
1957
+ return ((tzString.substr(0,1) =='-'? -1 : 1) * // plus or minus
1958
+ ((parseInt(tzString.substr(1,2),10)*60) + // hours (converted to minutes)
1959
+ parseInt(tzString.substr(3,2),10))); // minutes
1960
+ };
1961
+
1962
+ /**
1963
+ * No way to set timezone in js Date, so we must adjust the minutes to compensate. (think setDate, getDate)
1964
+ * @param date
1965
+ * @param string formated like "+0500", "-1245"
1966
+ * @return date
1967
+ */
1968
+ $.timepicker.timezoneAdjust = function(date, toTimezone) {
1969
+ var toTz = $.timepicker.timezoneOffsetNumber(toTimezone);
1970
+ if(!isNaN(toTz)){
1971
+ date.setMinutes(date.getMinutes()*1 + (date.getTimezoneOffset()*-1 - toTz*1) );
1972
+ }
1973
+ return date;
1974
  };
1975
 
1976
  /**
1996
  * @param string method Can be used to specify the type of picker to be added
1997
  * @return jQuery
1998
  */
1999
+ $.timepicker.datetimeRange = function(startTime, endTime, options) {
2000
+ $.timepicker.handleRange('datetimepicker', startTime, endTime, options);
2001
  };
2002
 
2003
  /**
2007
  * @param Element endTime
2008
  * @param obj options Options for the `timepicker()` call. Also supports `reformat`,
2009
  * a boolean value that can be used to reformat the input values to the `dateFormat`.
 
2010
  * @return jQuery
2011
  */
2012
+ $.timepicker.dateRange = function(startTime, endTime, options) {
2013
+ $.timepicker.handleRange('datepicker', startTime, endTime, options);
 
2014
  };
2015
 
2016
  /**
2024
  * @return jQuery
2025
  */
2026
  $.timepicker.handleRange = function(method, startTime, endTime, options) {
2027
+ options = $.extend({}, {
2028
+ minInterval: 0, // min allowed interval in milliseconds
2029
+ maxInterval: 0, // max allowed interval in milliseconds
2030
+ start: {}, // options for start picker
2031
+ end: {} // options for end picker
2032
+ }, options);
2033
+
2034
  $.fn[method].call(startTime, $.extend({
2035
  onClose: function(dateText, inst) {
2036
+ checkDates($(this), endTime);
2037
  },
2038
  onSelect: function(selectedDateTime) {
2039
+ selected($(this), endTime, 'minDate');
2040
  }
2041
  }, options, options.start));
2042
  $.fn[method].call(endTime, $.extend({
2043
  onClose: function(dateText, inst) {
2044
+ checkDates($(this), startTime);
2045
  },
2046
  onSelect: function(selectedDateTime) {
2047
+ selected($(this), startTime, 'maxDate');
2048
  }
2049
  }, options, options.end));
 
 
 
 
 
 
 
 
 
 
 
 
 
2050
 
2051
+ checkDates(startTime, endTime);
 
 
 
 
2052
  selected(startTime, endTime, 'minDate');
2053
  selected(endTime, startTime, 'maxDate');
2054
 
2055
+ function checkDates(changed, other) {
2056
+ var startdt = startTime[method]('getDate'),
2057
+ enddt = endTime[method]('getDate'),
2058
+ changeddt = changed[method]('getDate');
2059
+
2060
+ if(startdt !== null){
2061
+ var minDate = new Date(startdt.getTime()),
2062
+ maxDate = new Date(startdt.getTime());
2063
+
2064
+ minDate.setMilliseconds(minDate.getMilliseconds() + options.minInterval);
2065
+ maxDate.setMilliseconds(maxDate.getMilliseconds() + options.maxInterval);
2066
+
2067
+ if(options.minInterval > 0 && minDate > enddt){ // minInterval check
2068
+ endTime[method]('setDate',minDate);
2069
+ }
2070
+ else if(options.maxInterval > 0 && maxDate < enddt){ // max interval check
2071
+ endTime[method]('setDate',maxDate);
2072
+ }
2073
+ else if (startdt > enddt) {
2074
+ other[method]('setDate',changeddt);
2075
+ }
2076
+ }
2077
+ }
2078
+
2079
  function selected(changed, other, option) {
2080
+ if (!changed.val()) {
2081
  return;
2082
  }
2083
+ var date = changed[method].call(changed, 'getDate');
2084
+ if(date !== null && options.minInterval > 0){
2085
+ if(option == 'minDate'){
2086
+ date.setMilliseconds(date.getMilliseconds() + options.minInterval);
2087
+ }
2088
+ if(option == 'maxDate'){
2089
+ date.setMilliseconds(date.getMilliseconds() - options.minInterval);
2090
+ }
2091
+ }
2092
  if (date.getTime) {
2093
+ other[method].call(other, 'option', option, date);
2094
  }
2095
  }
2096
  return $([startTime.get(0), endTime.get(0)]);
2102
  * @return void
2103
  */
2104
  $.timepicker.log = function(err){
2105
+ if(window.console){
2106
  console.log(err);
2107
+ }
2108
  };
2109
 
2110
+ /*
2111
+ * Microsecond support
2112
+ */
2113
+ if(!Date.prototype.getMicroseconds){
2114
+ Date.prototype.microseconds = 0;
2115
+ Date.prototype.getMicroseconds = function(){ return this.microseconds; };
2116
+ Date.prototype.setMicroseconds = function(m){
2117
+ this.setMilliseconds(this.getMilliseconds() + Math.floor(m/1000));
2118
+ this.microseconds = m%1000;
2119
+ return this;
2120
+ };
2121
+ }
2122
+
2123
  /*
2124
  * Keep up with the version
2125
  */
2126
+ $.timepicker.version = "1.3.1";
2127
 
2128
  })(jQuery);
js/localization/jquery-ui-timepicker-af.js CHANGED
@@ -8,6 +8,7 @@
8
  minuteText: 'Minute',
9
  secondText: 'Sekondes',
10
  millisecText: 'Millisekondes',
 
11
  timezoneText: 'Tydsone',
12
  currentText: 'Huidige Tyd',
13
  closeText: 'Klaar',
8
  minuteText: 'Minute',
9
  secondText: 'Sekondes',
10
  millisecText: 'Millisekondes',
11
+ microsecText: 'Mikrosekondes',
12
  timezoneText: 'Tydsone',
13
  currentText: 'Huidige Tyd',
14
  closeText: 'Klaar',
js/localization/jquery-ui-timepicker-bg.js CHANGED
@@ -8,6 +8,7 @@
8
  minuteText: 'Минути',
9
  secondText: 'Секунди',
10
  millisecText: 'Милисекунди',
 
11
  timezoneText: 'Часови пояс',
12
  currentText: 'Сега',
13
  closeText: 'Затвори',
8
  minuteText: 'Минути',
9
  secondText: 'Секунди',
10
  millisecText: 'Милисекунди',
11
+ microsecText: 'Микросекунди',
12
  timezoneText: 'Часови пояс',
13
  currentText: 'Сега',
14
  closeText: 'Затвори',
js/localization/jquery-ui-timepicker-ca.js CHANGED
@@ -8,6 +8,7 @@
8
  minuteText: 'Minuts',
9
  secondText: 'Segons',
10
  millisecText: 'Milisegons',
 
11
  timezoneText: 'Fus horari',
12
  currentText: 'Ara',
13
  closeText: 'Tancar',
8
  minuteText: 'Minuts',
9
  secondText: 'Segons',
10
  millisecText: 'Milisegons',
11
+ microsecText: 'Microsegons',
12
  timezoneText: 'Fus horari',
13
  currentText: 'Ara',
14
  closeText: 'Tancar',
js/localization/jquery-ui-timepicker-cs.js CHANGED
@@ -8,6 +8,7 @@
8
  minuteText: 'Minuty',
9
  secondText: 'Vteřiny',
10
  millisecText: 'Milisekundy',
 
11
  timezoneText: 'Časové pásmo',
12
  currentText: 'Nyní',
13
  closeText: 'Zavřít',
8
  minuteText: 'Minuty',
9
  secondText: 'Vteřiny',
10
  millisecText: 'Milisekundy',
11
+ microsecText: 'Mikrosekundy',
12
  timezoneText: 'Časové pásmo',
13
  currentText: 'Nyní',
14
  closeText: 'Zavřít',
js/localization/jquery-ui-timepicker-de.js CHANGED
@@ -8,6 +8,7 @@
8
  minuteText: 'Minute',
9
  secondText: 'Sekunde',
10
  millisecText: 'Millisekunde',
 
11
  timezoneText: 'Zeitzone',
12
  currentText: 'Jetzt',
13
  closeText: 'Fertig',
8
  minuteText: 'Minute',
9
  secondText: 'Sekunde',
10
  millisecText: 'Millisekunde',
11
+ microsecText: 'Mikrosekunde',
12
  timezoneText: 'Zeitzone',
13
  currentText: 'Jetzt',
14
  closeText: 'Fertig',
js/localization/jquery-ui-timepicker-el.js CHANGED
@@ -8,6 +8,7 @@
8
  minuteText: 'Λεπτά',
9
  secondText: 'Δευτερόλεπτα',
10
  millisecText: 'μιλιδευτερόλεπτο',
 
11
  timezoneText: 'Ζώνη ώρας',
12
  currentText: 'Τώρα',
13
  closeText: 'Κλείσιμο',
8
  minuteText: 'Λεπτά',
9
  secondText: 'Δευτερόλεπτα',
10
  millisecText: 'μιλιδευτερόλεπτο',
11
+ microsecText: 'Microseconds',
12
  timezoneText: 'Ζώνη ώρας',
13
  currentText: 'Τώρα',
14
  closeText: 'Κλείσιμο',
js/localization/jquery-ui-timepicker-es.js CHANGED
@@ -8,6 +8,7 @@
8
  minuteText: 'Minutos',
9
  secondText: 'Segundos',
10
  millisecText: 'Milisegundos',
 
11
  timezoneText: 'Huso horario',
12
  currentText: 'Ahora',
13
  closeText: 'Cerrar',
8
  minuteText: 'Minutos',
9
  secondText: 'Segundos',
10
  millisecText: 'Milisegundos',
11
+ microsecText: 'Microsegundos',
12
  timezoneText: 'Huso horario',
13
  currentText: 'Ahora',
14
  closeText: 'Cerrar',
js/localization/jquery-ui-timepicker-et.js CHANGED
@@ -8,6 +8,7 @@
8
  minuteText: 'Minut',
9
  secondText: 'Sekund',
10
  millisecText: 'Millisekundis',
 
11
  timezoneText: 'Ajavöönd',
12
  currentText: 'Praegu',
13
  closeText: 'Valmis',
8
  minuteText: 'Minut',
9
  secondText: 'Sekund',
10
  millisecText: 'Millisekundis',
11
+ microsecText: 'Mikrosekundis',
12
  timezoneText: 'Ajavöönd',
13
  currentText: 'Praegu',
14
  closeText: 'Valmis',
js/localization/jquery-ui-timepicker-eu.js CHANGED
@@ -8,6 +8,7 @@
8
  minuteText: 'Minutuak',
9
  secondText: 'Segunduak',
10
  millisecText: 'Milisegunduak',
 
11
  timezoneText: 'Ordu-eremua',
12
  currentText: 'Orain',
13
  closeText: 'Itxi',
8
  minuteText: 'Minutuak',
9
  secondText: 'Segunduak',
10
  millisecText: 'Milisegunduak',
11
+ microsecText: 'Mikrosegundotan',
12
  timezoneText: 'Ordu-eremua',
13
  currentText: 'Orain',
14
  closeText: 'Itxi',
js/localization/jquery-ui-timepicker-fi.js CHANGED
@@ -8,6 +8,7 @@
8
  minuteText: 'Minuutti',
9
  secondText: 'Sekunti',
10
  millisecText: 'Millisekunnin',
 
11
  timezoneText: 'Aikavyöhyke',
12
  currentText: 'Nyt',
13
  closeText: 'Sulje',
8
  minuteText: 'Minuutti',
9
  secondText: 'Sekunti',
10
  millisecText: 'Millisekunnin',
11
+ microsecText: 'Mikrosekuntia',
12
  timezoneText: 'Aikavyöhyke',
13
  currentText: 'Nyt',
14
  closeText: 'Sulje',
js/localization/jquery-ui-timepicker-fr.js CHANGED
@@ -8,6 +8,7 @@
8
  minuteText: 'Minutes',
9
  secondText: 'Secondes',
10
  millisecText: 'Millisecondes',
 
11
  timezoneText: 'Fuseau horaire',
12
  currentText: 'Maintenant',
13
  closeText: 'Terminé',
8
  minuteText: 'Minutes',
9
  secondText: 'Secondes',
10
  millisecText: 'Millisecondes',
11
+ microsecText: 'Microsecondes',
12
  timezoneText: 'Fuseau horaire',
13
  currentText: 'Maintenant',
14
  closeText: 'Terminé',
js/localization/jquery-ui-timepicker-gl.js CHANGED
@@ -8,6 +8,7 @@
8
  minuteText: 'Minutos',
9
  secondText: 'Segundos',
10
  millisecText: 'Milisegundos',
 
11
  timezoneText: 'Fuso horario',
12
  currentText: 'Agora',
13
  closeText: 'Pechar',
8
  minuteText: 'Minutos',
9
  secondText: 'Segundos',
10
  millisecText: 'Milisegundos',
11
+ microsecText: 'Microssegundos',
12
  timezoneText: 'Fuso horario',
13
  currentText: 'Agora',
14
  closeText: 'Pechar',
js/localization/jquery-ui-timepicker-he.js CHANGED
@@ -8,6 +8,7 @@
8
  minuteText: "דקות",
9
  secondText: "שניות",
10
  millisecText: "אלפית השנייה",
 
11
  timezoneText: "אזור זמן",
12
  currentText: "עכשיו",
13
  closeText:"סגור",
8
  minuteText: "דקות",
9
  secondText: "שניות",
10
  millisecText: "אלפית השנייה",
11
+ microsecText: "מיקרו",
12
  timezoneText: "אזור זמן",
13
  currentText: "עכשיו",
14
  closeText:"סגור",
js/localization/jquery-ui-timepicker-hu.js CHANGED
@@ -8,6 +8,7 @@
8
  minuteText: 'Perc',
9
  secondText: 'Másodperc',
10
  millisecText: 'Milliszekundumos',
 
11
  timezoneText: 'Időzóna',
12
  currentText: 'Most',
13
  closeText: 'Kész',
8
  minuteText: 'Perc',
9
  secondText: 'Másodperc',
10
  millisecText: 'Milliszekundumos',
11
+ microsecText: 'Ezredmásodperc',
12
  timezoneText: 'Időzóna',
13
  currentText: 'Most',
14
  closeText: 'Kész',
js/localization/jquery-ui-timepicker-id.js CHANGED
@@ -8,6 +8,7 @@
8
  minuteText: 'Menit',
9
  secondText: 'Detik',
10
  millisecText: 'Milidetik',
 
11
  timezoneText: 'Zona Waktu',
12
  currentText: 'Sekarang',
13
  closeText: 'OK',
8
  minuteText: 'Menit',
9
  secondText: 'Detik',
10
  millisecText: 'Milidetik',
11
+ microsecText: 'Mikrodetik',
12
  timezoneText: 'Zona Waktu',
13
  currentText: 'Sekarang',
14
  closeText: 'OK',
js/localization/jquery-ui-timepicker-it.js CHANGED
@@ -5,9 +5,10 @@
5
  timeOnlyTitle: 'Scegli orario',
6
  timeText: 'Orario',
7
  hourText: 'Ora',
8
- minuteText: 'Minuto',
9
- secondText: 'Secondo',
10
- millisecText: 'Millisecondo',
 
11
  timezoneText: 'Fuso orario',
12
  currentText: 'Adesso',
13
  closeText: 'Chiudi',
5
  timeOnlyTitle: 'Scegli orario',
6
  timeText: 'Orario',
7
  hourText: 'Ora',
8
+ minuteText: 'Minuti',
9
+ secondText: 'Secondi',
10
+ millisecText: 'Millisecondi',
11
+ microsecText: 'Microsecondi',
12
  timezoneText: 'Fuso orario',
13
  currentText: 'Adesso',
14
  closeText: 'Chiudi',
js/localization/jquery-ui-timepicker-ja.js CHANGED
@@ -8,6 +8,7 @@
8
  minuteText: '分',
9
  secondText: '秒',
10
  millisecText: 'ミリ秒',
 
11
  timezoneText: 'タイムゾーン',
12
  currentText: '現時刻',
13
  closeText: '閉じる',
8
  minuteText: '分',
9
  secondText: '秒',
10
  millisecText: 'ミリ秒',
11
+ microsecText: 'マイクロ秒',
12
  timezoneText: 'タイムゾーン',
13
  currentText: '現時刻',
14
  closeText: '閉じる',
js/localization/jquery-ui-timepicker-ko.js CHANGED
@@ -8,6 +8,7 @@
8
  minuteText: '분',
9
  secondText: '초',
10
  millisecText: '밀리초',
 
11
  timezoneText: '표준 시간대',
12
  currentText: '현재 시각',
13
  closeText: '닫기',
8
  minuteText: '분',
9
  secondText: '초',
10
  millisecText: '밀리초',
11
+ microsecText: '마이크로',
12
  timezoneText: '표준 시간대',
13
  currentText: '현재 시각',
14
  closeText: '닫기',
js/localization/jquery-ui-timepicker-lt.js CHANGED
@@ -8,6 +8,7 @@
8
  minuteText: 'Minutės',
9
  secondText: 'Sekundės',
10
  millisecText: 'Milisekundės',
 
11
  timezoneText: 'Laiko zona',
12
  currentText: 'Dabar',
13
  closeText: 'Uždaryti',
8
  minuteText: 'Minutės',
9
  secondText: 'Sekundės',
10
  millisecText: 'Milisekundės',
11
+ microsecText: 'Mikrosekundės',
12
  timezoneText: 'Laiko zona',
13
  currentText: 'Dabar',
14
  closeText: 'Uždaryti',
js/localization/jquery-ui-timepicker-nl.js CHANGED
@@ -8,6 +8,7 @@
8
  minuteText: 'Minuut',
9
  secondText: 'Seconde',
10
  millisecText: 'Milliseconde',
 
11
  timezoneText: 'Tijdzone',
12
  currentText: 'Vandaag',
13
  closeText: 'Sluiten',
8
  minuteText: 'Minuut',
9
  secondText: 'Seconde',
10
  millisecText: 'Milliseconde',
11
+ microsecText: 'Microseconde',
12
  timezoneText: 'Tijdzone',
13
  currentText: 'Vandaag',
14
  closeText: 'Sluiten',
js/localization/jquery-ui-timepicker-no.js CHANGED
@@ -8,6 +8,7 @@
8
  minuteText: 'Minutt',
9
  secondText: 'Sekund',
10
  millisecText: 'Millisekund',
 
11
  timezoneText: 'Tidssone',
12
  currentText: 'Nå',
13
  closeText: 'Lukk',
8
  minuteText: 'Minutt',
9
  secondText: 'Sekund',
10
  millisecText: 'Millisekund',
11
+ microsecText: 'mikrosekund',
12
  timezoneText: 'Tidssone',
13
  currentText: 'Nå',
14
  closeText: 'Lukk',
js/localization/jquery-ui-timepicker-pl.js CHANGED
@@ -8,6 +8,7 @@
8
  minuteText: 'Minuta',
9
  secondText: 'Sekunda',
10
  millisecText: 'Milisekunda',
 
11
  timezoneText: 'Strefa czasowa',
12
  currentText: 'Teraz',
13
  closeText: 'Gotowe',
8
  minuteText: 'Minuta',
9
  secondText: 'Sekunda',
10
  millisecText: 'Milisekunda',
11
+ microsecText: 'Mikrosekunda',
12
  timezoneText: 'Strefa czasowa',
13
  currentText: 'Teraz',
14
  closeText: 'Gotowe',
js/localization/jquery-ui-timepicker-pt-BR.js CHANGED
@@ -2,12 +2,13 @@
2
  /* Written by Diogo Damiani (diogodamiani@gmail.com) */
3
  (function ($) {
4
  $.timepicker.regional['pt-BR'] = {
5
- timeOnlyTitle: 'Escolha a horário',
6
  timeText: 'Horário',
7
  hourText: 'Hora',
8
  minuteText: 'Minutos',
9
  secondText: 'Segundos',
10
  millisecText: 'Milissegundos',
 
11
  timezoneText: 'Fuso horário',
12
  currentText: 'Agora',
13
  closeText: 'Fechar',
2
  /* Written by Diogo Damiani (diogodamiani@gmail.com) */
3
  (function ($) {
4
  $.timepicker.regional['pt-BR'] = {
5
+ timeOnlyTitle: 'Escolha o horário',
6
  timeText: 'Horário',
7
  hourText: 'Hora',
8
  minuteText: 'Minutos',
9
  secondText: 'Segundos',
10
  millisecText: 'Milissegundos',
11
+ microsecText: 'Microssegundos',
12
  timezoneText: 'Fuso horário',
13
  currentText: 'Agora',
14
  closeText: 'Fechar',
js/localization/jquery-ui-timepicker-pt.js CHANGED
@@ -8,6 +8,7 @@
8
  minuteText: 'Minutos',
9
  secondText: 'Segundos',
10
  millisecText: 'Milissegundos',
 
11
  timezoneText: 'Fuso horário',
12
  currentText: 'Agora',
13
  closeText: 'Fechar',
8
  minuteText: 'Minutos',
9
  secondText: 'Segundos',
10
  millisecText: 'Milissegundos',
11
+ microsecText: 'Microssegundos',
12
  timezoneText: 'Fuso horário',
13
  currentText: 'Agora',
14
  closeText: 'Fechar',
js/localization/jquery-ui-timepicker-ro.js CHANGED
@@ -8,6 +8,7 @@
8
  minuteText: 'Minute',
9
  secondText: 'Secunde',
10
  millisecText: 'Milisecunde',
 
11
  timezoneText: 'Fus orar',
12
  currentText: 'Acum',
13
  closeText: 'Închide',
8
  minuteText: 'Minute',
9
  secondText: 'Secunde',
10
  millisecText: 'Milisecunde',
11
+ microsecText: 'Microsecunde',
12
  timezoneText: 'Fus orar',
13
  currentText: 'Acum',
14
  closeText: 'Închide',
js/localization/jquery-ui-timepicker-ru.js CHANGED
@@ -8,6 +8,7 @@
8
  minuteText: 'Минуты',
9
  secondText: 'Секунды',
10
  millisecText: 'Миллисекунды',
 
11
  timezoneText: 'Часовой пояс',
12
  currentText: 'Сейчас',
13
  closeText: 'Закрыть',
8
  minuteText: 'Минуты',
9
  secondText: 'Секунды',
10
  millisecText: 'Миллисекунды',
11
+ microsecText: 'Микросекунды',
12
  timezoneText: 'Часовой пояс',
13
  currentText: 'Сейчас',
14
  closeText: 'Закрыть',
js/localization/jquery-ui-timepicker-sk.js CHANGED
@@ -8,6 +8,7 @@
8
  minuteText: 'Minúty',
9
  secondText: 'Sekundy',
10
  millisecText: 'Milisekundy',
 
11
  timezoneText: 'Časové pásmo',
12
  currentText: 'Teraz',
13
  closeText: 'Zavrieť',
8
  minuteText: 'Minúty',
9
  secondText: 'Sekundy',
10
  millisecText: 'Milisekundy',
11
+ microsecText: 'Mikrosekundy',
12
  timezoneText: 'Časové pásmo',
13
  currentText: 'Teraz',
14
  closeText: 'Zavrieť',
js/localization/jquery-ui-timepicker-sv.js CHANGED
@@ -3,11 +3,12 @@
3
  (function($) {
4
  $.timepicker.regional['sv'] = {
5
  timeOnlyTitle: 'Välj en tid',
6
- timeText: 'Timme',
7
- hourText: 'Timmar',
8
- minuteText: 'Minuter',
9
- secondText: 'Sekunder',
10
- millisecText: 'Millisekunder',
 
11
  timezoneText: 'Tidszon',
12
  currentText: 'Nu',
13
  closeText: 'Stäng',
3
  (function($) {
4
  $.timepicker.regional['sv'] = {
5
  timeOnlyTitle: 'Välj en tid',
6
+ timeText: 'Tid',
7
+ hourText: 'Timme',
8
+ minuteText: 'Minut',
9
+ secondText: 'Sekund',
10
+ millisecText: 'Millisekund',
11
+ microsecText: 'Mikrosekund',
12
  timezoneText: 'Tidszon',
13
  currentText: 'Nu',
14
  closeText: 'Stäng',
js/localization/jquery-ui-timepicker-th.js CHANGED
@@ -8,6 +8,7 @@
8
  minuteText: 'นาที',
9
  secondText: 'วินาที',
10
  millisecText: 'มิลลิวินาที',
 
11
  timezoneText: 'เขตเวลา',
12
  currentText: 'เวลาปัจจุบัน',
13
  closeText: 'ปิด',
8
  minuteText: 'นาที',
9
  secondText: 'วินาที',
10
  millisecText: 'มิลลิวินาที',
11
+ microsecText: 'ไมโคริวินาที',
12
  timezoneText: 'เขตเวลา',
13
  currentText: 'เวลาปัจจุบัน',
14
  closeText: 'ปิด',
js/localization/jquery-ui-timepicker-tr.js CHANGED
@@ -8,6 +8,7 @@
8
  minuteText: 'Dakika',
9
  secondText: 'Saniye',
10
  millisecText: 'Milisaniye',
 
11
  timezoneText: 'Zaman Dilimi',
12
  currentText: 'Şu an',
13
  closeText: 'Tamam',
8
  minuteText: 'Dakika',
9
  secondText: 'Saniye',
10
  millisecText: 'Milisaniye',
11
+ microsecText: 'Mikrosaniye',
12
  timezoneText: 'Zaman Dilimi',
13
  currentText: 'Şu an',
14
  closeText: 'Tamam',
js/localization/jquery-ui-timepicker-uk.js CHANGED
@@ -8,6 +8,7 @@
8
  minuteText: 'Хвилини',
9
  secondText: 'Секунди',
10
  millisecText: 'Мілісекунди',
 
11
  timezoneText: 'Часовий пояс',
12
  currentText: 'Зараз',
13
  closeText: 'Закрити',
8
  minuteText: 'Хвилини',
9
  secondText: 'Секунди',
10
  millisecText: 'Мілісекунди',
11
+ microsecText: 'Мікросекунди',
12
  timezoneText: 'Часовий пояс',
13
  currentText: 'Зараз',
14
  closeText: 'Закрити',
js/localization/jquery-ui-timepicker-vi.js CHANGED
@@ -8,6 +8,7 @@
8
  minuteText: 'Phút',
9
  secondText: 'Giây',
10
  millisecText: 'Phần nghìn giây',
 
11
  timezoneText: 'Múi giờ',
12
  currentText: 'Hiện thời',
13
  closeText: 'Đóng',
8
  minuteText: 'Phút',
9
  secondText: 'Giây',
10
  millisecText: 'Phần nghìn giây',
11
+ microsecText: 'Miligiây',
12
  timezoneText: 'Múi giờ',
13
  currentText: 'Hiện thời',
14
  closeText: 'Đóng',
js/localization/jquery-ui-timepicker-zh-CN.js CHANGED
@@ -8,6 +8,7 @@
8
  minuteText: '分钟',
9
  secondText: '秒钟',
10
  millisecText: '微秒',
 
11
  timezoneText: '时区',
12
  currentText: '现在时间',
13
  closeText: '关闭',
8
  minuteText: '分钟',
9
  secondText: '秒钟',
10
  millisecText: '微秒',
11
+ microsecText: '微秒',
12
  timezoneText: '时区',
13
  currentText: '现在时间',
14
  closeText: '关闭',
js/localization/jquery-ui-timepicker-zh-TW.js CHANGED
@@ -8,6 +8,7 @@
8
  minuteText: '分',
9
  secondText: '秒',
10
  millisecText: '毫秒',
 
11
  timezoneText: '時區',
12
  currentText: '現在時間',
13
  closeText: '確定',
8
  minuteText: '分',
9
  secondText: '秒',
10
  millisecText: '毫秒',
11
+ microsecText: '微秒',
12
  timezoneText: '時區',
13
  currentText: '現在時間',
14
  closeText: '確定',
js/timepicker.js CHANGED
@@ -16,7 +16,7 @@
16
  }
17
 
18
 
19
- input.addClass('active').datetimepicker({
20
  changeYear: true
21
  , yearRange: "-100:+100"
22
  , changeMonth: true
16
  }
17
 
18
 
19
+ input.addClass('active').attr("placeholder", (is_timeonly) ? time_format : date_format + ' ' + time_format).datetimepicker({
20
  changeYear: true
21
  , yearRange: "-100:+100"
22
  , changeMonth: true
readme.txt CHANGED
@@ -3,8 +3,8 @@ Contributors: PerS
3
  Donate link: http://soderlind.no/donate/
4
  Tags: acf, custom field,datepicker,timepicker
5
  Requires at least: 3.4
6
- Tested up to: 3.5.1
7
- Stable tag: 2.0.8
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -21,7 +21,7 @@ This is an add-on for the [Advanced Custom Fields](http://wordpress.org/extend/p
21
 
22
  This add-on will work with:
23
 
24
- * Advanced Custom Fields version 4 and up. **NOTE, There's an issue with ACF 4.1.5 and up, and custom fields. Please use [ACF 4.1.4](http://downloads.wordpress.org/plugin/advanced-custom-fields.4.1.4.zip)**
25
  * Advanced Custom Fields version 3 and bellow
26
 
27
  = More Information =
@@ -110,6 +110,10 @@ TT AM or PM for AM/PM
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.8 =
114
  * Adds option to store the date and time field as a UNIX timestamp or not.
115
  = 2.0.7 =
3
  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.9
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
21
 
22
  This add-on will work with:
23
 
24
+ * Advanced Custom Fields version 4 and up
25
  * Advanced Custom Fields version 3 and bellow
26
 
27
  = More Information =
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.9 =
114
+ * 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
115
+ * Replaced DateTime::createFromFormat (PHP 5 >= 5.3.0), with strtotime
116
+ * minor bugfixes
117
  = 2.0.8 =
118
  * Adds option to store the date and time field as a UNIX timestamp or not.
119
  = 2.0.7 =