/[projects]/misc/horsensspejder-web/jquery/jquery-ui-1.10.3/tests/unit/datepicker/datepicker_test_helpers.js
ViewVC logotype

Contents of /misc/horsensspejder-web/jquery/jquery-ui-1.10.3/tests/unit/datepicker/datepicker_test_helpers.js

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2125 - (show annotations) (download) (as text)
Wed Mar 12 19:30:05 2014 UTC (10 years, 3 months ago) by torben
File MIME type: application/javascript
File size: 972 byte(s)
initial import
1 TestHelpers.datepicker = {
2 addMonths: function(date, offset) {
3 var maxDay = 32 - new Date(date.getFullYear(), date.getMonth() + offset, 32).getDate();
4 date.setDate(Math.min(date.getDate(), maxDay));
5 date.setMonth(date.getMonth() + offset);
6 return date;
7 },
8 equalsDate: function(d1, d2, message) {
9 if (!d1 || !d2) {
10 ok(false, message + " - missing date");
11 return;
12 }
13 d1 = new Date(d1.getFullYear(), d1.getMonth(), d1.getDate());
14 d2 = new Date(d2.getFullYear(), d2.getMonth(), d2.getDate());
15 equal(d1.toString(), d2.toString(), message);
16 },
17 init: function(id, options) {
18 $.datepicker.setDefaults($.datepicker.regional[""]);
19 return $(id).datepicker($.extend({showAnim: ""}, options || {}));
20 },
21 onFocus: function( element, onFocus ) {
22 var fn = function( event ){
23 if( !event.originalEvent ) {
24 return;
25 }
26 element.unbind( "focus", fn );
27 onFocus();
28 };
29
30 element.bind( "focus", fn )[ 0 ].focus();
31 },
32 PROP_NAME: "datepicker"
33 };

  ViewVC Help
Powered by ViewVC 1.1.20