summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTrent Richardson <trentdrichardson@gmail.com>2012-11-01 09:21:51 -0400
committerTrent Richardson <trentdrichardson@gmail.com>2012-11-01 09:21:51 -0400
commita43ef3b95e27779061fda6d59ac706c98f472040 (patch)
tree2003263fe346a7b17b9261d111a2f30ac910de6a
parent0d7c56913f990059df90f1dd1fb3e9eed2966aae (diff)
downloadjQuery-Timepicker-Addon-a43ef3b95e27779061fda6d59ac706c98f472040.zip
jQuery-Timepicker-Addon-a43ef3b95e27779061fda6d59ac706c98f472040.tar.gz
jQuery-Timepicker-Addon-a43ef3b95e27779061fda6d59ac706c98f472040.tar.bz2
change strict to parse
-rw-r--r--index.html26
-rw-r--r--jquery-ui-timepicker-addon.js7
2 files changed, 28 insertions, 5 deletions
diff --git a/index.html b/index.html
index d6b52fe..c75c132 100644
--- a/index.html
+++ b/index.html
@@ -220,7 +220,19 @@
<dl class="defs">
<dt>controlType</dt>
- <dd><em>Default: 'slider'</em> - Whether to use 'slider' or 'select'. If 'slider' is unavailable through jQueryUI, 'select' will be used. For advanced usage you may pass an object which implements "create", "options", "value" methods to use controls other than sliders or selects. See the _controls property in the source code for more details.</dd>
+ <dd><em>Default: 'slider'</em> - Whether to use 'slider' or 'select'. If 'slider' is unavailable through jQueryUI, 'select' will be used. For advanced usage you may pass an object which implements "create", "options", "value" methods to use controls other than sliders or selects. See the _controls property in the source code for more details.
+<pre>{
+ create: function(tp_inst, obj, unit, val, min, max, step){
+ // generate whatever controls you want here, just return obj
+ },
+ options: function(tp_inst, obj, unit, opts, val){
+ // if val==undefined return the value, else return obj
+ },
+ value: function(tp_inst, obj, unit, val){
+ // if val==undefined return the value, else return obj
+ }
+}</pre>
+ </dd>
<dt>showHour</dt>
<dd><em>Default: true</em> - Whether to show the hour slider.</dd>
@@ -345,8 +357,16 @@
<dt>maxDateTime</dt>
<dd><em>Default: null</em> - Date object of the maximum datetime allowed. Also Available as maxDate.</dd>
- <dt>strict</dt>
- <dd><em>Default: true</em> - Requires the time to exactly match the timeFormat when parsing. False will attempt to allow Javascript Date() to parse the time string.</dd>
+ <dt>parse</dt>
+ <dd><em>Default: 'strict'</em> - How to parse the time string. Two methods are provided: 'strict' which must match the timeFormat exactly, and 'loose' which uses javascript's new Date(timeString) to guess the time. You may also pass in a function(timeFormat, timeString, options) to handle the parsing yourself, returning a simple object:
+<pre>{
+ hour: 19,
+ minutes: 10,
+ seconds: 23,
+ millisec: 45,
+ timezone: '-0400'
+}</pre>
+ </dd>
</dl>
</div>
diff --git a/jquery-ui-timepicker-addon.js b/jquery-ui-timepicker-addon.js
index f412793..44b85e9 100644
--- a/jquery-ui-timepicker-addon.js
+++ b/jquery-ui-timepicker-addon.js
@@ -105,7 +105,7 @@
sliderAccessArgs: null,
controlType: 'slider',
defaultValue: null,
- strict: true
+ parse: 'strict'
};
$.extend(this._defaults, this.regional['']);
}
@@ -1142,7 +1142,10 @@
return false;
}; // end looseParse
- if(o.strict !== undefined && o.strict === false){
+ if(typeof o.parse === "function"){
+ return o.parse(timeFormat, timeString, o)
+ }
+ if(o.parse === 'loose'){
return looseParse(timeFormat, timeString, o);
}
return strictParse(timeFormat, timeString, o);