Subversion Repositories Applications.papyrus

Rev

Details | Last modification | View Log | RSS feed

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