]> git.pond.sub.org Git - eow/blob - static/dojo-release-1.1.1/dojo/tests/date/locale.js
Comment class stub
[eow] / static / dojo-release-1.1.1 / dojo / tests / date / locale.js
1 if(!dojo._hasResource["tests.date.locale"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code.
2 dojo._hasResource["tests.date.locale"] = true;
3 dojo.provide("tests.date.locale");
4
5 dojo.require("dojo.date.locale");
6
7 tests.register("tests.date.locale", 
8         [
9                 {
10                         // Test formatting and parsing of dates in various locales pre-built in dojo.cldr
11                         // NOTE: we can't set djConfig.extraLocale before bootstrapping unit tests, so directly
12                         // load resources here for specific locales:
13
14                         name: "date.locale",
15                         setUp: function(){
16                                 var partLocaleList = ["en-us", "fr-fr", "es", "de-at", "ja-jp", "zh-cn"];
17
18                                 dojo.forEach(partLocaleList, function(locale){
19                                         dojo.requireLocalization("dojo.cldr", "gregorian", locale, "zh-cn,zh,en-ca,ko-kr,pt,pt-br,it-it,ROOT,en-gb,de,ja,en,en-au,fr,es,ko,zh-tw,it,es-es");
20                                 });
21                         },
22                         runTest: function(t){
23                         },
24                         tearDown: function(){
25                                 //Clean up bundles that should not exist if
26                                 //the test is re-run.
27                                 delete dojo.cldr.nls.gregorian;
28                         }
29                 },
30                 {
31                         name: "isWeekend",
32                         runTest: function(t){
33                                 var thursday = new Date(2006, 8, 21);
34                                 var friday = new Date(2006, 8, 22);
35                                 var saturday = new Date(2006, 8, 23);
36                                 var sunday = new Date(2006, 8, 24);
37                                 var monday = new Date(2006, 8, 25);
38                                 t.f(dojo.date.locale.isWeekend(thursday, 'en-us'));
39                                 t.t(dojo.date.locale.isWeekend(saturday, 'en-us'));
40                                 t.t(dojo.date.locale.isWeekend(sunday, 'en-us'));
41                                 t.f(dojo.date.locale.isWeekend(monday, 'en-us'));
42 //      t.f(dojo.date.locale.isWeekend(saturday, 'en-in'));
43 //      t.t(dojo.date.locale.isWeekend(sunday, 'en-in'));
44 //      t.f(dojo.date.locale.isWeekend(monday, 'en-in'));
45 //      t.t(dojo.date.locale.isWeekend(friday, 'he-il'));
46 //      t.f(dojo.date.locale.isWeekend(sunday, 'he-il'));
47                         }
48                 },
49                 {
50                         name: "format",
51                         runTest: function(t){
52
53         var date = new Date(2006, 7, 11, 0, 55, 12, 345);
54
55         t.is("Friday, August 11, 2006", dojo.date.locale.format(date, {formatLength:'full',selector:'date', locale:'en-us'}));
56         t.is("vendredi 11 ao\xFBt 2006", dojo.date.locale.format(date, {formatLength:'full',selector:'date', locale:'fr-fr'}));
57         t.is("Freitag, 11. August 2006", dojo.date.locale.format(date, {formatLength:'full',selector:'date', locale:'de-at'}));
58         t.is("2006\u5E748\u670811\u65E5\u91D1\u66DC\u65E5", dojo.date.locale.format(date, {formatLength:'full',selector:'date', locale:'ja-jp'}));
59
60         t.is("8/11/06", dojo.date.locale.format(date, {formatLength:'short',selector:'date', locale:'en-us'}));
61         t.is("11/08/06", dojo.date.locale.format(date, {formatLength:'short',selector:'date', locale:'fr-fr'}));
62         t.is("11.08.06", dojo.date.locale.format(date, {formatLength:'short',selector:'date', locale:'de-at'}));
63         t.is("06/08/11", dojo.date.locale.format(date, {formatLength:'short',selector:'date', locale:'ja-jp'}));
64
65         t.is("12:55 AM", dojo.date.locale.format(date, {formatLength:'short',selector:'time', locale:'en-us'}));
66         t.is("12:55:12", dojo.date.locale.format(date, {timePattern:'h:m:s',selector:'time'}));
67         t.is("12:55:12.35", dojo.date.locale.format(date, {timePattern:'h:m:s.SS',selector:'time'}));
68         t.is("24:55:12.35", dojo.date.locale.format(date, {timePattern:'k:m:s.SS',selector:'time'}));
69         t.is("0:55:12.35", dojo.date.locale.format(date, {timePattern:'H:m:s.SS',selector:'time'}));
70         t.is("0:55:12.35", dojo.date.locale.format(date, {timePattern:'K:m:s.SS',selector:'time'}));
71
72         t.is("11082006", dojo.date.locale.format(date, {datePattern:"ddMMyyyy", selector:"date"}));
73
74         // compare without timezone
75         t.is("\u4e0a\u534812\u65f655\u520612\u79d2", dojo.date.locale.format(date, {formatLength:'full',selector:'time', locale:'zh-cn'}).split(' ')[0]);
76                         }
77                 },
78                 {
79                         name: "parse_dates",
80                         runTest: function(t){
81
82         var aug_11_2006 = new Date(2006, 7, 11, 0);
83
84         //en: 'short' fmt: M/d/yy
85         // Tolerate either 8 or 08 for month part.
86         t.is( aug_11_2006, dojo.date.locale.parse("08/11/06", {formatLength:'short', selector:'date', locale:'en'}));
87         t.is( aug_11_2006, dojo.date.locale.parse("8/11/06", {formatLength:'short', selector:'date', locale:'en'}));    
88         // Tolerate yyyy input in yy part...
89         t.is( aug_11_2006, dojo.date.locale.parse("8/11/2006", {formatLength:'short', selector:'date', locale:'en'}));
90         // ...but not in strict mode
91         t.f( Boolean(dojo.date.locale.parse("8/11/2006", {formatLength:'short', selector:'date', locale:'en', strict:true})));
92
93         //en: 'medium' fmt: MMM d, yyyy
94         // Tolerate either 8 or 08 for month part.
95         t.is( aug_11_2006, dojo.date.locale.parse("Aug 11, 2006", {formatLength:'medium', selector:'date', locale:'en'}));
96         t.is( aug_11_2006, dojo.date.locale.parse("Aug 11, 2006", {formatLength:'medium', selector:'date', locale:'en'}));      
97         // Tolerate abbreviating period in month part...
98         t.is( aug_11_2006, dojo.date.locale.parse("Aug. 11, 2006", {formatLength:'medium', selector:'date', locale:'en'}));
99         // ...but not in strict mode
100         t.f( Boolean(dojo.date.locale.parse("Aug. 11, 2006", {formatLength:'medium', selector:'date', locale:'en', strict:true})));
101
102         // Note: 06 for year part will be translated literally as the year 6 C.E.
103         var aug_11_06CE = new Date(2006, 7, 11, 0);
104         aug_11_06CE.setFullYear(6); //literally the year 6 C.E.
105         t.is( aug_11_06CE, dojo.date.locale.parse("Aug 11, 06", {selector:'date', datePattern:'MMM dd, yyyy', strict:true}));
106
107         //en: 'long' fmt: MMMM d, yyyy
108         t.is( aug_11_2006, dojo.date.locale.parse("August 11, 2006", {formatLength:'long', selector:'date', locale:'en'}));
109
110         //en: 'full' fmt: EEEE, MMMM d, yyyy
111         t.is( aug_11_2006, dojo.date.locale.parse("Friday, August 11, 2006", {formatLength:'full', selector:'date', locale:'en'}));
112         //TODO: wrong day-of-week should fail
113         //t.f( Boolean(dojo.date.locale.parse("Thursday, August 11, 2006", {formatLength:'full', selector:'date', locale:'en'})));
114         //TODO: Whitespace tolerance
115         //      t.is( aug_11_2006, dojo.date.locale.parse(" August 11, 2006", {formatLength:'long', selector:'date', locale:'en'}));
116         //      t.is( aug_11_2006, dojo.date.locale.parse("August  11, 2006", {formatLength:'long', selector:'date', locale:'en'}));
117         //      t.is( aug_11_2006, dojo.date.locale.parse("August 11 , 2006", {formatLength:'long', selector:'date', locale:'en'}));
118         //      t.is( aug_11_2006, dojo.date.locale.parse("August 11,  2006", {formatLength:'long', selector:'date', locale:'en'}));
119         //      t.is( aug_11_2006, dojo.date.locale.parse("August 11, 2006 ", {formatLength:'long', selector:'date', locale:'en'}));
120
121         //Simple Validation Tests
122         //catch "month" > 12 (note: month/day reversals are common when user expectation isn't met wrt european versus US formats)
123         t.f( Boolean(dojo.date.locale.parse("15/1/2005", {formatLength:'short', selector:'date', locale:'en'})));
124         //day of month typo rolls over to the next month
125         t.f( Boolean(dojo.date.locale.parse("Aug 32, 2006", {formatLength:'medium', selector:'date', locale:'en'})));
126
127         //German (de)
128         t.is( aug_11_2006, dojo.date.locale.parse("11.08.06", {formatLength:'short', selector:'date', locale:'de'}));
129         t.f( Boolean(dojo.date.locale.parse("11.8/06", {formatLength:'short', selector:'date', locale:'de'})));
130         t.f( Boolean(dojo.date.locale.parse("11.8x06", {formatLength:'short', selector:'date', locale:'de'})));
131         t.f( Boolean(dojo.date.locale.parse("11.13.06", {formatLength:'short', selector:'date', locale:'de'})));
132         t.f( Boolean(dojo.date.locale.parse("11.0.06", {formatLength:'short', selector:'date', locale:'de'})));
133         t.f( Boolean(dojo.date.locale.parse("32.08.06", {formatLength:'short', selector:'date', locale:'de'})));
134
135         //Spanish (es)
136         //es: 'short' fmt: d/MM/yy
137         t.is( aug_11_2006, dojo.date.locale.parse("11/08/06", {formatLength:'short', selector:'date', locale:'es'}));
138         t.is( aug_11_2006, dojo.date.locale.parse("11/8/06", {formatLength:'short', selector:'date', locale:'es'}));    
139         // Tolerate yyyy input in yy part...
140         t.is( aug_11_2006, dojo.date.locale.parse("11/8/2006", {formatLength:'short', selector:'date', locale:'es'}));
141         // ...but not in strict mode
142         t.f( Boolean(dojo.date.locale.parse("11/8/2006", {formatLength:'short', selector:'date', locale:'es', strict:true})));
143         //es: 'medium' fmt: dd-MMM-yy (not anymore as of CLDR 1.5.1)
144 //      t.is( aug_11_2006, dojo.date.locale.parse("11-ago-06", {formatLength:'medium', selector:'date', locale:'es'}));
145 //      t.is( aug_11_2006, dojo.date.locale.parse("11-ago-2006", {formatLength:'medium', selector:'date', locale:'es'}));       
146         // Tolerate abbreviating period in month part...
147 //      t.is( aug_11_2006, dojo.date.locale.parse("11-ago.-2006", {formatLength:'medium', selector:'date', locale:'es'}));
148         // ...but not in strict mode
149 //      t.f( Boolean(dojo.date.locale.parse("11-ago.-2006", {formatLength:'medium', selector:'date', locale:'es', strict:true})));
150         //es: 'long' fmt: d' de 'MMMM' de 'yyyy
151         t.is( aug_11_2006, dojo.date.locale.parse("11 de agosto de 2006", {formatLength:'long', selector:'date', locale:'es'}));
152         //case-insensitive month...
153         t.is( aug_11_2006, dojo.date.locale.parse("11 de Agosto de 2006", {formatLength:'long', selector:'date', locale:'es'}));
154         //...but not in strict mode
155         t.f( Boolean(dojo.date.locale.parse("11 de Agosto de 2006", {formatLength:'long', selector:'date', locale:'es', strict:true})));
156         //es 'full' fmt: EEEE d' de 'MMMM' de 'yyyy
157         t.is( aug_11_2006, dojo.date.locale.parse("viernes 11 de agosto de 2006", {formatLength:'full', selector:'date', locale:'es'}));
158         //case-insensitive day-of-week...
159         t.is( aug_11_2006, dojo.date.locale.parse("Viernes 11 de agosto de 2006", {formatLength:'full', selector:'date', locale:'es'}));
160         //...but not in strict mode
161         t.f( Boolean(dojo.date.locale.parse("Viernes 11 de agosto de 2006", {formatLength:'full', selector:'date', locale:'es', strict:true})));
162
163         //Japanese (ja)
164         //note: to avoid garbling from non-utf8-aware editors that may touch this file, using the \uNNNN format 
165         //for expressing double-byte chars.
166         //toshi (year): \u5e74
167         //getsu (month): \u6708
168         //nichi (day): \u65e5
169         //kinyoubi (Friday): \u91d1\u66dc\u65e5
170         //zenkaku space: \u3000
171         
172         //ja: 'short' fmt: yy/MM/dd (note: the "short" fmt isn't actually defined in the CLDR data...)
173         t.is( aug_11_2006, dojo.date.locale.parse("06/08/11", {formatLength:'short', selector:'date', locale:'ja'}));
174         t.is( aug_11_2006, dojo.date.locale.parse("06/8/11", {formatLength:'short', selector:'date', locale:'ja'}));    
175         // Tolerate yyyy input in yy part...
176         t.is( aug_11_2006, dojo.date.locale.parse("2006/8/11", {formatLength:'short', selector:'date', locale:'ja'}));
177         // ...but not in strict mode
178         t.f( Boolean(dojo.date.locale.parse("2006/8/11", {formatLength:'short', selector:'date', locale:'ja', strict:true})));
179         //ja: 'medium' fmt: yyyy/MM/dd
180         t.is( aug_11_2006, dojo.date.locale.parse("2006/08/11", {formatLength:'medium', selector:'date', locale:'ja'}));
181         t.is( aug_11_2006, dojo.date.locale.parse("2006/8/11", {formatLength:'medium', selector:'date', locale:'ja'}));         
182         //ja: 'long' fmt: yyyy'\u5e74'\u6708'd'\u65e5'
183         t.is( aug_11_2006, dojo.date.locale.parse("2006\u5e748\u670811\u65e5", {formatLength:'long', selector:'date', locale:'ja'}));
184         //ja 'full' fmt: yyyy'\u5e74'M'\u6708'd'\u65e5'EEEE
185         t.is( aug_11_2006, dojo.date.locale.parse("2006\u5e748\u670811\u65e5\u91d1\u66dc\u65e5", {formatLength:'full', selector:'date', locale:'ja'}));
186
187         //TODO: Whitespace tolerance
188         //tolerate ascii space
189         //      t.is( aug_11_2006, dojo.date.locale.parse(" 2006\u5e748\u670811\u65e5\u91d1\u66dc\u65e5 ", {formatLength:'full', selector:'date', locale:'ja'}));
190         //      t.is( aug_11_2006, dojo.date.locale.parse("2006\u5e74 8\u670811\u65e5 \u91d1\u66dc\u65e5", {formatLength:'full', selector:'date', locale:'ja'}));
191         //tolerate zenkaku space
192         //      t.is( aug_11_2006, dojo.date.locale.parse("\u30002006\u5e748\u670811\u65e5\u91d1\u66dc\u65e5\u3000", {formatLength:'full', selector:'date', locale:'ja'}));
193         //      t.is( aug_11_2006, dojo.date.locale.parse("2006\u5e74\u30008\u670811\u65e5\u3000\u91d1\u66dc\u65e5", {formatLength:'full', selector:'date', locale:'ja'}));
194
195         var apr_11_2006 = new Date(2006, 3, 11, 0);
196         //Roundtrip
197         var options={formatLength:'medium',selector:'date', locale:'fr-fr'};
198         t.is(0, dojo.date.compare(apr_11_2006, dojo.date.locale.parse(dojo.date.locale.format(apr_11_2006, options), options)));
199
200         //Tolerance for abbreviations
201         t.is(0, dojo.date.compare(apr_11_2006, dojo.date.locale.parse("11 avr 06", options)));
202                         }
203                 },
204                 {
205                         name: "parse_dates_neg",
206                         runTest: function(t){
207                                 t.f(Boolean(dojo.date.locale.parse("2/29/2007", {formatLength: 'short', selector: 'date', locale: 'en'})));
208                                 t.f(Boolean(dojo.date.locale.parse("4/31/2007", {formatLength: 'short', selector: 'date', locale: 'en'})));
209                                 t.f(Boolean(dojo.date.locale.parse("Decemb 30, 2007", {formatLength: 'long', selector: 'date', locale: 'en'})));
210                         }
211                 },
212                 {
213                         name: "parse_datetimes",
214                         runTest: function(t){
215
216         var aug_11_2006_12_30_am = new Date(2006, 7, 11, 0, 30);
217         var aug_11_2006_12_30_pm = new Date(2006, 7, 11, 12, 30);
218
219         //en: 'short' datetime fmt: M/d/yy h:mm a
220         //note: this is concatenation of dateFormat-short and timeFormat-short, 
221         //cldr provisionally defines datetime fmts as well, but we're not using them at the moment
222         t.is( aug_11_2006_12_30_pm, dojo.date.locale.parse("08/11/06 12:30 PM", {formatLength:'short', locale:'en'}));
223         //case-insensitive
224         t.is( aug_11_2006_12_30_pm, dojo.date.locale.parse("08/11/06 12:30 pm", {formatLength:'short', locale:'en'}));
225         //...but not in strict mode
226         t.f( Boolean(dojo.date.locale.parse("08/11/06 12:30 pm", {formatLength:'short', locale:'en', strict:true})));
227
228         t.is( aug_11_2006_12_30_am, dojo.date.locale.parse("08/11/06 12:30 AM", {formatLength:'short', locale:'en'}));
229
230         t.is( new Date(2006, 7, 11), dojo.date.locale.parse("11082006", {datePattern:"ddMMyyyy", selector:"date"}));
231
232                         }
233                 },
234                 {
235                         name: "parse_times",
236                         runTest: function(t){
237
238         var time = new Date(2006, 7, 11, 12, 30);
239         var tformat = {selector:'time', strict:true, timePattern:"h:mm a", locale:'en'};
240
241         t.is(time.getHours(), dojo.date.locale.parse("12:30 PM", tformat).getHours());
242         t.is(time.getMinutes(), dojo.date.locale.parse("12:30 PM", tformat).getMinutes());
243                         }
244                 },
245                 {
246                         name: "day_of_year",
247                         runTest: function(t){
248
249 //                              t.is(23, dojo.date.setDayOfYear(new Date(2006,0,1), 23).getDate());
250                                 t.is(1, dojo.date.locale._getDayOfYear(new Date(2006,0,1)));
251                                 t.is(32, dojo.date.locale._getDayOfYear(new Date(2006,1,1)));
252                                 t.is(72, dojo.date.locale._getDayOfYear(new Date(2007,2,13,0,13)));
253                                 t.is(72, dojo.date.locale._getDayOfYear(new Date(2007,2,13,1,13)));
254                         }
255                 },
256                 {
257                         name: "week_of_year",
258                         runTest: function(t){
259                                 t.is(0, dojo.date.locale._getWeekOfYear(new Date(2000,0,1)));
260                                 t.is(1, dojo.date.locale._getWeekOfYear(new Date(2000,0,2)));
261                                 t.is(0, dojo.date.locale._getWeekOfYear(new Date(2000,0,2), 1));
262                                 t.is(0, dojo.date.locale._getWeekOfYear(new Date(2007,0,1)));
263                                 t.is(1, dojo.date.locale._getWeekOfYear(new Date(2007,0,1), 1));
264                                 t.is(27, dojo.date.locale._getWeekOfYear(new Date(2007,6,14)));
265                                 t.is(28, dojo.date.locale._getWeekOfYear(new Date(2007,6,14), 1));
266                         }
267                 }
268         ]
269 );
270
271 /*
272 // workaround deprecated methods. Should decide whether we should convert the tests or add a helper method (in dojo.date?) to do this.
273
274 dojo_validate_isValidTime = function(str, props){
275         props = props || {};
276         if(!props.format){props.format="h:mm:ss";}
277         if(!props.am){props.am="a.m.";}
278         if(!props.pm){props.pm="p.m.";}
279         var result = false;
280         if(/[hk]/.test(props.format) && props.format.indexOf('a') == -1){
281                 result = dojo.date.locale.parse(str, {selector: 'time', timePattern: props.format + " a"});
282         }
283         return Boolean(result || dojo.date.locale.parse(str, {selector: 'time', timePattern: props.format}));
284 }
285
286 dojo_validate_is12HourTime = function(str){
287         return dojo_validate_isValidTime(str, {format: 'h:mm:ss'}) ||   dojo_validate_isValidTime(str, {format: 'h:mm'});
288 }
289
290 dojo_validate_is24HourTime = function(str){
291         return dojo_validate_isValidTime(str, {format: 'H:mm:ss'}) ||   dojo_validate_isValidTime(str, {format: 'H:mm'});
292 }
293
294 dojo_validate_isValidDate = function(str, fmt){
295         return Boolean(dojo.date.locale.parse(str, {selector: 'date', datePattern: fmt}));
296 }
297
298 function test_validate_datetime_isValidTime(){
299         jum.assertTrue("test1", dojo_validate_isValidTime('5:15:05 pm'));
300 // FAILURE      jum.assertTrue("test2", dojo_validate_isValidTime('5:15:05 p.m.', {pm: "P.M."} ));
301         jum.assertFalse("test3", dojo_validate_isValidTime('5:15:05 f.m.'));
302         jum.assertTrue("test4", dojo_validate_isValidTime('5:15 pm', {format: "h:mm a"} ) );
303         jum.assertFalse("test5", dojo_validate_isValidTime('5:15 fm', {}) );
304         jum.assertTrue("test6", dojo_validate_isValidTime('15:15:00', {format: "H:mm:ss"} ) );
305 // FAILURE      jum.assertFalse("test7", dojo_validate_isValidTime('15:15:00', {}) );
306         jum.assertTrue("test8", dojo_validate_isValidTime('17:01:30', {format: "H:mm:ss"} ) );
307         jum.assertFalse("test9", dojo_validate_isValidTime('17:1:30', {format: "H:mm:ss"} ) );
308 // FAILURE      jum.assertFalse("test10", dojo_validate_isValidTime('17:01:30', {format: "H:m:ss"} ) );
309         // Greek
310 // FAILURE      jum.assertTrue("test11", dojo_validate_isValidTime('5:01:30 \u0924\u0924', {am: "\u0928\u0924", pm: "\u0924\u0924"} ) );
311         // Italian
312         jum.assertTrue("test12", dojo_validate_isValidTime('17.01.30', {format: "H.mm.ss"} ) );
313         // Mexico
314 // FAILURE      jum.assertTrue("test13", dojo_validate_isValidTime('05:01:30 p.m.', {format: "hh:mm:ss a", am: "a.m.", pm: "p.m."} ) );
315 }
316
317
318 function test_validate_datetime_is12HourTime(){
319         jum.assertTrue("test1", dojo_validate_is12HourTime('5:15:05 pm'));
320 // FAILURE      jum.assertFalse("test2", dojo_validate_is12HourTime('05:15:05 pm'));
321         jum.assertFalse("test3", dojo_validate_is12HourTime('5:5:05 pm'));
322         jum.assertFalse("test4", dojo_validate_is12HourTime('5:15:5 pm'));
323 // FAILURE      jum.assertFalse("test5", dojo_validate_is12HourTime('13:15:05 pm'));
324         jum.assertFalse("test6", dojo_validate_is12HourTime('5:60:05 pm'));
325         jum.assertFalse("test7", dojo_validate_is12HourTime('5:15:60 pm'));
326         jum.assertTrue("test8", dojo_validate_is12HourTime('5:59:05 pm'));
327         jum.assertTrue("test9", dojo_validate_is12HourTime('5:15:59 pm'));
328 // FAILURE      jum.assertFalse("test10", dojo_validate_is12HourTime('5:15:05'));
329
330         // optional seconds
331         jum.assertTrue("test11", dojo_validate_is12HourTime('5:15 pm'));
332         jum.assertFalse("test12", dojo_validate_is12HourTime('5:15: pm'));
333 }
334
335 function test_validate_datetime_is24HourTime(){
336         jum.assertTrue("test1", dojo_validate_is24HourTime('00:03:59'));
337         jum.assertTrue("test2", dojo_validate_is24HourTime('22:03:59'));
338 //FIXME: fix tests or code?
339 //      jum.assertFalse("test3", dojo_validate_is24HourTime('22:03:59 pm'));
340 //      jum.assertFalse("test4", dojo_validate_is24HourTime('2:03:59'));
341         jum.assertFalse("test5", dojo_validate_is24HourTime('0:3:59'));
342         jum.assertFalse("test6", dojo_validate_is24HourTime('00:03:5'));
343         jum.assertFalse("test7", dojo_validate_isValidTime('24:03:59', {format: 'kk:mm:ss'}));
344         jum.assertFalse("test8", dojo_validate_is24HourTime('02:60:59'));
345         jum.assertFalse("test9", dojo_validate_is24HourTime('02:03:60'));
346
347         // optional seconds
348         jum.assertTrue("test10", dojo_validate_is24HourTime('22:53'));
349         jum.assertFalse("test11", dojo_validate_is24HourTime('22:53:'));
350 }
351
352 function test_validate_datetime_isValidDate(){
353         
354         // Month date year
355         jum.assertTrue("test1", dojo_validate_isValidDate("08/06/2005", "MM/dd/yyyy"));
356         jum.assertTrue("test2", dojo_validate_isValidDate("08.06.2005", "MM.dd.yyyy"));
357         jum.assertTrue("test3", dojo_validate_isValidDate("08-06-2005", "MM-dd-yyyy"));
358         jum.assertTrue("test4", dojo_validate_isValidDate("8/6/2005", "M/d/yyyy"));
359         jum.assertTrue("test5", dojo_validate_isValidDate("8/6", "M/d"));
360         jum.assertFalse("test6", dojo_validate_isValidDate("09/31/2005", "MM/dd/yyyy"));
361         jum.assertFalse("test7", dojo_validate_isValidDate("02/29/2005", "MM/dd/yyyy"));
362         jum.assertTrue("test8", dojo_validate_isValidDate("02/29/2004", "MM/dd/yyyy"));
363
364         // year month date
365         jum.assertTrue("test9", dojo_validate_isValidDate("2005-08-06", "yyyy-MM-dd"));
366         jum.assertTrue("test10", dojo_validate_isValidDate("20050806", "yyyyMMdd"));
367
368         // year month
369         jum.assertTrue("test11", dojo_validate_isValidDate("2005-08", "yyyy-MM"));
370         jum.assertTrue("test12", dojo_validate_isValidDate("200508", "yyyyMM"));
371
372         // year
373         jum.assertTrue("test13", dojo_validate_isValidDate("2005", "yyyy"));
374
375         // year week day
376 //TODO: need to support 'w'?
377 //      jum.assertTrue("test14", dojo_validate_isValidDate("2005-W42-3", "yyyy-'W'ww-d"));
378 //      jum.assertTrue("test15", dojo_validate_isValidDate("2005W423", "yyyy'W'wwd"));
379 //      jum.assertFalse("test16", dojo_validate_isValidDate("2005-W42-8", "yyyy-'W'ww-d"));
380 //      jum.assertFalse("test17", dojo_validate_isValidDate("2005-W54-3", "yyyy-'W'ww-d"));
381
382         // year week
383 //      jum.assertTrue("test18", dojo_validate_isValidDate("2005-W42", "yyyy-'W'ww"));
384 //      jum.assertTrue("test19", dojo_validate_isValidDate("2005W42", "yyyy'W'ww"));
385
386         // year ordinal-day
387         jum.assertTrue("test20", dojo_validate_isValidDate("2005-292", "yyyy-DDD"));
388         jum.assertTrue("test21", dojo_validate_isValidDate("2005292", "yyyyDDD"));
389         jum.assertFalse("test22", dojo_validate_isValidDate("2005-366", "yyyy-DDD"));
390         jum.assertTrue("test23", dojo_validate_isValidDate("2004-366", "yyyy-DDD"));
391
392         // date month year
393         jum.assertTrue("test24", dojo_validate_isValidDate("19.10.2005", "dd.MM.yyyy"));
394         jum.assertTrue("test25", dojo_validate_isValidDate("19-10-2005", "d-M-yyyy"));
395 }
396 */
397
398 }