Lines Matching refs:Date

100    Combines the $(REF Date,std,datetime,date) and
118 this(in Date date, in TimeOfDay tod = TimeOfDay.init) @safe pure nothrow @nogc
128 assert(dt._date == Date.init);
133 auto dt = DateTime(Date(1999, 7 ,6));
134 assert(dt._date == Date(1999, 7, 6));
139 auto dt = DateTime(Date(1999, 7 ,6), TimeOfDay(12, 30, 33));
140 assert(dt._date == Date(1999, 7, 6));
157 _date = Date(year, month, day);
165 assert(dt._date == Date(1999, 7, 6));
171 assert(dt._date == Date(1999, 7, 6));
200 assert(DateTime(Date.init, TimeOfDay.init).opCmp(DateTime.init) == 0);
202 assert(DateTime(Date(1999, 1, 1)).opCmp(DateTime(Date(1999, 1, 1))) == 0);
203 assert(DateTime(Date(1, 7, 1)).opCmp(DateTime(Date(1, 7, 1))) == 0);
204 assert(DateTime(Date(1, 1, 6)).opCmp(DateTime(Date(1, 1, 6))) == 0);
206 assert(DateTime(Date(1999, 7, 1)).opCmp(DateTime(Date(1999, 7, 1))) == 0);
207 assert(DateTime(Date(1999, 7, 6)).opCmp(DateTime(Date(1999, 7, 6))) == 0);
209 assert(DateTime(Date(1, 7, 6)).opCmp(DateTime(Date(1, 7, 6))) == 0);
211 assert(DateTime(Date(1999, 7, 6)).opCmp(DateTime(Date(2000, 7, 6))) < 0);
212 assert(DateTime(Date(2000, 7, 6)).opCmp(DateTime(Date(1999, 7, 6))) > 0);
213 assert(DateTime(Date(1999, 7, 6)).opCmp(DateTime(Date(1999, 8, 6))) < 0);
214 assert(DateTime(Date(1999, 8, 6)).opCmp(DateTime(Date(1999, 7, 6))) > 0);
215 assert(DateTime(Date(1999, 7, 6)).opCmp(DateTime(Date(1999, 7, 7))) < 0);
216 assert(DateTime(Date(1999, 7, 7)).opCmp(DateTime(Date(1999, 7, 6))) > 0);
218 assert(DateTime(Date(1999, 8, 7)).opCmp(DateTime(Date(2000, 7, 6))) < 0);
219 assert(DateTime(Date(2000, 8, 6)).opCmp(DateTime(Date(1999, 7, 7))) > 0);
220 assert(DateTime(Date(1999, 7, 7)).opCmp(DateTime(Date(2000, 7, 6))) < 0);
221 assert(DateTime(Date(2000, 7, 6)).opCmp(DateTime(Date(1999, 7, 7))) > 0);
222 assert(DateTime(Date(1999, 7, 7)).opCmp(DateTime(Date(1999, 8, 6))) < 0);
223 assert(DateTime(Date(1999, 8, 6)).opCmp(DateTime(Date(1999, 7, 7))) > 0);
226 assert(DateTime(Date(1999, 7, 6), TimeOfDay(0, 0, 0)).opCmp(
227 DateTime(Date(1999, 7, 6), TimeOfDay(0, 0, 0))) == 0);
228 assert(DateTime(Date(1999, 7, 6), TimeOfDay(12, 0, 0)).opCmp(
229 DateTime(Date(1999, 7, 6), TimeOfDay(12, 0, 0))) == 0);
230 assert(DateTime(Date(1999, 7, 6), TimeOfDay(0, 30, 0)).opCmp(
231 DateTime(Date(1999, 7, 6), TimeOfDay(0, 30, 0))) == 0);
232 assert(DateTime(Date(1999, 7, 6), TimeOfDay(0, 0, 33)).opCmp(
233 DateTime(Date(1999, 7, 6), TimeOfDay(0, 0, 33))) == 0);
235 assert(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 0)).opCmp(
236 DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 0))) == 0);
237 assert(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)).opCmp(
238 DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33))) == 0);
240 assert(DateTime(Date(1999, 7, 6), TimeOfDay(0, 30, 33)).opCmp(
241 DateTime(Date(1999, 7, 6), TimeOfDay(0, 30, 33))) == 0);
242 assert(DateTime(Date(1999, 7, 6), TimeOfDay(0, 0, 33)).opCmp(
243 DateTime(Date(1999, 7, 6), TimeOfDay(0, 0, 33))) == 0);
245 assert(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)).opCmp(
246 DateTime(Date(1999, 7, 6), TimeOfDay(13, 30, 33))) < 0);
247 assert(DateTime(Date(1999, 7, 6), TimeOfDay(13, 30, 33)).opCmp(
248 DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33))) > 0);
249 assert(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)).opCmp(
250 DateTime(Date(1999, 7, 6), TimeOfDay(12, 31, 33))) < 0);
251 assert(DateTime(Date(1999, 7, 6), TimeOfDay(12, 31, 33)).opCmp(
252 DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33))) > 0);
253 assert(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)).opCmp(
254 DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 34))) < 0);
255 assert(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 34)).opCmp(
256 DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33))) > 0);
258 assert(DateTime(Date(1999, 7, 6), TimeOfDay(13, 30, 33)).opCmp(
259 DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 34))) > 0);
260 assert(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 34)).opCmp(
261 DateTime(Date(1999, 7, 6), TimeOfDay(13, 30, 33))) < 0);
262 assert(DateTime(Date(1999, 7, 6), TimeOfDay(13, 30, 33)).opCmp(
263 DateTime(Date(1999, 7, 6), TimeOfDay(12, 31, 33))) > 0);
264 assert(DateTime(Date(1999, 7, 6), TimeOfDay(12, 31, 33)).opCmp(
265 DateTime(Date(1999, 7, 6), TimeOfDay(13, 30, 33))) < 0);
267 assert(DateTime(Date(1999, 7, 6), TimeOfDay(12, 31, 33)).opCmp(
268 DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 34))) > 0);
269 assert(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 34)).opCmp(
270 DateTime(Date(1999, 7, 6), TimeOfDay(12, 31, 33))) < 0);
272 assert(DateTime(Date(1999, 7, 6), TimeOfDay(13, 30, 33)).opCmp(
273 DateTime(Date(2000, 7, 6), TimeOfDay(12, 30, 33))) < 0);
274 assert(DateTime(Date(2000, 7, 6), TimeOfDay(12, 30, 33)).opCmp(
275 DateTime(Date(1999, 7, 6), TimeOfDay(13, 30, 33))) > 0);
276 assert(DateTime(Date(1999, 7, 6), TimeOfDay(12, 31, 33)).opCmp(
277 DateTime(Date(2000, 7, 6), TimeOfDay(12, 30, 33))) < 0);
278 assert(DateTime(Date(2000, 7, 6), TimeOfDay(12, 30, 33)).opCmp(
279 DateTime(Date(1999, 7, 6), TimeOfDay(12, 31, 33))) > 0);
280 assert(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 34)).opCmp(
281 DateTime(Date(2000, 7, 6), TimeOfDay(12, 30, 33))) < 0);
282 assert(DateTime(Date(2000, 7, 6), TimeOfDay(12, 30, 33)).opCmp(
283 DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 34))) > 0);
285 assert(DateTime(Date(1999, 7, 6), TimeOfDay(13, 30, 33)).opCmp(
286 DateTime(Date(1999, 8, 6), TimeOfDay(12, 30, 33))) < 0);
287 assert(DateTime(Date(1999, 8, 6), TimeOfDay(12, 30, 33)).opCmp(
288 DateTime(Date(1999, 7, 6), TimeOfDay(13, 30, 33))) > 0);
289 assert(DateTime(Date(1999, 7, 6), TimeOfDay(12, 31, 33)).opCmp(
290 DateTime(Date(1999, 8, 6), TimeOfDay(12, 30, 33))) < 0);
291 assert(DateTime(Date(1999, 8, 6), TimeOfDay(12, 30, 33)).opCmp(
292 DateTime(Date(1999, 7, 6), TimeOfDay(12, 31, 33))) > 0);
293 assert(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 34)).opCmp(
294 DateTime(Date(1999, 8, 6), TimeOfDay(12, 30, 33))) < 0);
295 assert(DateTime(Date(1999, 8, 6), TimeOfDay(12, 30, 33)).opCmp(
296 DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 34))) > 0);
298 assert(DateTime(Date(1999, 7, 6), TimeOfDay(13, 30, 33)).opCmp(
299 DateTime(Date(1999, 7, 7), TimeOfDay(12, 30, 33))) < 0);
300 assert(DateTime(Date(1999, 7, 7), TimeOfDay(12, 30, 33)).opCmp(
301 DateTime(Date(1999, 7, 6), TimeOfDay(13, 30, 33))) > 0);
302 assert(DateTime(Date(1999, 7, 6), TimeOfDay(12, 31, 33)).opCmp(
303 DateTime(Date(1999, 7, 7), TimeOfDay(12, 31, 33))) < 0);
304 assert(DateTime(Date(1999, 7, 7), TimeOfDay(12, 30, 33)).opCmp(
305 DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33))) > 0);
306 assert(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 34)).opCmp(
307 DateTime(Date(1999, 7, 7), TimeOfDay(12, 30, 33))) < 0);
308 assert(DateTime(Date(1999, 7, 7), TimeOfDay(12, 30, 33)).opCmp(
309 DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 34))) > 0);
312 assert(DateTime(Date(-1, 1, 1), TimeOfDay(12, 30, 33)).opCmp(
313 DateTime(Date(-1, 1, 1), TimeOfDay(12, 30, 33))) == 0);
314 assert(DateTime(Date(-1, 7, 1), TimeOfDay(12, 30, 33)).opCmp(
315 DateTime(Date(-1, 7, 1), TimeOfDay(12, 30, 33))) == 0);
316 assert(DateTime(Date(-1, 1, 6), TimeOfDay(12, 30, 33)).opCmp(
317 DateTime(Date(-1, 1, 6), TimeOfDay(12, 30, 33))) == 0);
319 assert(DateTime(Date(-1999, 7, 1), TimeOfDay(12, 30, 33)).opCmp(
320 DateTime(Date(-1999, 7, 1), TimeOfDay(12, 30, 33))) == 0);
321 assert(DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 33)).opCmp(
322 DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 33))) == 0);
324 assert(DateTime(Date(-1, 7, 6), TimeOfDay(12, 30, 33)).opCmp(
325 DateTime(Date(-1, 7, 6), TimeOfDay(12, 30, 33))) == 0);
327 assert(DateTime(Date(-2000, 7, 6), TimeOfDay(12, 30, 33)).opCmp(
328 DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 33))) < 0);
329 assert(DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 33)).opCmp(
330 DateTime(Date(-2000, 7, 6), TimeOfDay(12, 30, 33))) > 0);
331 assert(DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 33)).opCmp(
332 DateTime(Date(-1999, 8, 6), TimeOfDay(12, 30, 33))) < 0);
333 assert(DateTime(Date(-1999, 8, 6), TimeOfDay(12, 30, 33)).opCmp(
334 DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 33))) > 0);
335 assert(DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 33)).opCmp(
336 DateTime(Date(-1999, 7, 7), TimeOfDay(12, 30, 33))) < 0);
337 assert(DateTime(Date(-1999, 7, 7), TimeOfDay(12, 30, 33)).opCmp(
338 DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 33))) > 0);
340 assert(DateTime(Date(-2000, 8, 6), TimeOfDay(12, 30, 33)).opCmp(
341 DateTime(Date(-1999, 7, 7), TimeOfDay(12, 30, 33))) < 0);
342 assert(DateTime(Date(-1999, 8, 7), TimeOfDay(12, 30, 33)).opCmp(
343 DateTime(Date(-2000, 7, 6), TimeOfDay(12, 30, 33))) > 0);
344 assert(DateTime(Date(-2000, 7, 6), TimeOfDay(12, 30, 33)).opCmp(
345 DateTime(Date(-1999, 7, 7), TimeOfDay(12, 30, 33))) < 0);
346 assert(DateTime(Date(-1999, 7, 7), TimeOfDay(12, 30, 33)).opCmp(
347 DateTime(Date(-2000, 7, 6), TimeOfDay(12, 30, 33))) > 0);
348 assert(DateTime(Date(-1999, 7, 7), TimeOfDay(12, 30, 33)).opCmp(
349 DateTime(Date(-1999, 8, 6), TimeOfDay(12, 30, 33))) < 0);
350 assert(DateTime(Date(-1999, 8, 6), TimeOfDay(12, 30, 33)).opCmp(
351 DateTime(Date(-1999, 7, 7), TimeOfDay(12, 30, 33))) > 0);
354 assert(DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 33)).opCmp(
355 DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33))) < 0);
356 assert(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)).opCmp(
357 DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 33))) > 0);
359 assert(DateTime(Date(-1999, 8, 6), TimeOfDay(12, 30, 33)).opCmp(
360 DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33))) < 0);
361 assert(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)).opCmp(
362 DateTime(Date(-1999, 8, 6), TimeOfDay(12, 30, 33))) > 0);
364 assert(DateTime(Date(-1999, 7, 7), TimeOfDay(12, 30, 33)).opCmp(
365 DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33))) < 0);
366 assert(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)).opCmp(
367 DateTime(Date(-1999, 7, 7), TimeOfDay(12, 30, 33))) > 0);
369 assert(DateTime(Date(-1999, 8, 7), TimeOfDay(12, 30, 33)).opCmp(
370 DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33))) < 0);
371 assert(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)).opCmp(
372 DateTime(Date(-1999, 8, 7), TimeOfDay(12, 30, 33))) > 0);
374 assert(DateTime(Date(-1999, 8, 6), TimeOfDay(12, 30, 33)).opCmp(
375 DateTime(Date(1999, 6, 6), TimeOfDay(12, 30, 33))) < 0);
376 assert(DateTime(Date(1999, 6, 8), TimeOfDay(12, 30, 33)).opCmp(
377 DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 33))) > 0);
379 auto dt = DateTime(Date(1999, 7, 6), TimeOfDay(12, 33, 30));
380 const cdt = DateTime(Date(1999, 7, 6), TimeOfDay(12, 33, 30));
381 immutable idt = DateTime(Date(1999, 7, 6), TimeOfDay(12, 33, 30));
397 @property Date date() const @safe pure nothrow @nogc
406 assert(dt.date == Date.init);
410 auto dt = DateTime(Date(1999, 7, 6));
411 assert(dt.date == Date(1999, 7, 6));
416 assert(cdt.date == Date(1999, 7, 6));
417 assert(idt.date == Date(1999, 7, 6));
425 date = The Date to set this $(LREF DateTime)'s date portion to.
427 @property void date(in Date date) @safe pure nothrow @nogc
435 dt.date = Date(1999, 7, 6);
436 assert(dt._date == Date(1999, 7, 6));
441 static assert(!__traits(compiles, cdt.date = Date(2010, 1, 1)));
442 static assert(!__traits(compiles, idt.date = Date(2010, 1, 1)));
462 auto dt = DateTime(Date.init, TimeOfDay(12, 30, 33));
489 assert(dt._date == Date.init);
510 assert(Date.init.year == 1);
511 assert(Date(1999, 7, 6).year == 1999);
512 assert(Date(-1999, 7, 6).year == -1999);
540 assert(DateTime(Date(1999, 7, 6), TimeOfDay(9, 7, 5)).year == 1999);
541 assert(DateTime(Date(2010, 10, 4), TimeOfDay(0, 0, 30)).year == 2010);
542 assert(DateTime(Date(-7, 4, 5), TimeOfDay(7, 45, 2)).year == -7);
553 testDT(DateTime(Date(1, 1, 1), TimeOfDay(12, 30, 33)),
555 DateTime(Date(1999, 1, 1), TimeOfDay(12, 30, 33)));
556 testDT(DateTime(Date(1, 1, 1), TimeOfDay(12, 30, 33)),
558 DateTime(Date(0, 1, 1), TimeOfDay(12, 30, 33)));
559 testDT(DateTime(Date(1, 1, 1), TimeOfDay(12, 30, 33)),
561 DateTime(Date(-1999, 1, 1), TimeOfDay(12, 30, 33)));
584 assert(DateTime(Date(0, 1, 1), TimeOfDay(12, 30, 33)).yearBC == 1);
585 assert(DateTime(Date(-1, 1, 1), TimeOfDay(10, 7, 2)).yearBC == 2);
586 assert(DateTime(Date(-100, 1, 1), TimeOfDay(4, 59, 0)).yearBC == 101);
591 assertThrown!DateTimeException((in DateTime dt){dt.yearBC;}(DateTime(Date(1, 1, 1))));
621 auto dt = DateTime(Date(2010, 1, 1), TimeOfDay(7, 30, 0));
623 assert(dt == DateTime(Date(0, 1, 1), TimeOfDay(7, 30, 0)));
626 assert(dt == DateTime(Date(-9, 1, 1), TimeOfDay(7, 30, 0)));
631 assertThrown!DateTimeException((DateTime dt){dt.yearBC = -1;}(DateTime(Date(1, 1, 1))));
654 assert(DateTime(Date(1999, 7, 6), TimeOfDay(9, 7, 5)).month == 7);
655 assert(DateTime(Date(2010, 10, 4), TimeOfDay(0, 0, 30)).month == 10);
656 assert(DateTime(Date(-7, 4, 5), TimeOfDay(7, 45, 2)).month == 4);
662 assert(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)).month == 7);
663 assert(DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 33)).month == 7);
696 assertThrown!DateTimeException(testDT(DateTime(Date(1, 1, 1), TimeOfDay(12, 30, 33)), cast(Month) 0));
697 assertThrown!DateTimeException(testDT(DateTime(Date(1, 1, 1), TimeOfDay(12, 30, 33)), cast(Month) 13));
699 testDT(DateTime(Date(1, 1, 1), TimeOfDay(12, 30, 33)),
701 DateTime(Date(1, 7, 1), TimeOfDay(12, 30, 33)));
702 testDT(DateTime(Date(-1, 1, 1), TimeOfDay(12, 30, 33)),
704 DateTime(Date(-1, 7, 1), TimeOfDay(12, 30, 33)));
724 assert(DateTime(Date(1999, 7, 6), TimeOfDay(9, 7, 5)).day == 6);
725 assert(DateTime(Date(2010, 10, 4), TimeOfDay(0, 0, 30)).day == 4);
726 assert(DateTime(Date(-7, 4, 5), TimeOfDay(7, 45, 2)).day == 5);
744 test(DateTime(Date(year, md.month, md.day), tod), md.day);
780 assertThrown!DateTimeException(testDT(DateTime(Date(1, 1, 1)), 0));
781 assertThrown!DateTimeException(testDT(DateTime(Date(1, 1, 1)), 32));
782 assertThrown!DateTimeException(testDT(DateTime(Date(1, 2, 1)), 29));
783 assertThrown!DateTimeException(testDT(DateTime(Date(4, 2, 1)), 30));
784 assertThrown!DateTimeException(testDT(DateTime(Date(1, 3, 1)), 32));
785 assertThrown!DateTimeException(testDT(DateTime(Date(1, 4, 1)), 31));
786 assertThrown!DateTimeException(testDT(DateTime(Date(1, 5, 1)), 32));
787 assertThrown!DateTimeException(testDT(DateTime(Date(1, 6, 1)), 31));
788 assertThrown!DateTimeException(testDT(DateTime(Date(1, 7, 1)), 32));
789 assertThrown!DateTimeException(testDT(DateTime(Date(1, 8, 1)), 32));
790 assertThrown!DateTimeException(testDT(DateTime(Date(1, 9, 1)), 31));
791 assertThrown!DateTimeException(testDT(DateTime(Date(1, 10, 1)), 32));
792 assertThrown!DateTimeException(testDT(DateTime(Date(1, 11, 1)), 31));
793 assertThrown!DateTimeException(testDT(DateTime(Date(1, 12, 1)), 32));
795 assertNotThrown!DateTimeException(testDT(DateTime(Date(1, 1, 1)), 31));
796 assertNotThrown!DateTimeException(testDT(DateTime(Date(1, 2, 1)), 28));
797 assertNotThrown!DateTimeException(testDT(DateTime(Date(4, 2, 1)), 29));
798 assertNotThrown!DateTimeException(testDT(DateTime(Date(1, 3, 1)), 31));
799 assertNotThrown!DateTimeException(testDT(DateTime(Date(1, 4, 1)), 30));
800 assertNotThrown!DateTimeException(testDT(DateTime(Date(1, 5, 1)), 31));
801 assertNotThrown!DateTimeException(testDT(DateTime(Date(1, 6, 1)), 30));
802 assertNotThrown!DateTimeException(testDT(DateTime(Date(1, 7, 1)), 31));
803 assertNotThrown!DateTimeException(testDT(DateTime(Date(1, 8, 1)), 31));
804 assertNotThrown!DateTimeException(testDT(DateTime(Date(1, 9, 1)), 30));
805 assertNotThrown!DateTimeException(testDT(DateTime(Date(1, 10, 1)), 31));
806 assertNotThrown!DateTimeException(testDT(DateTime(Date(1, 11, 1)), 30));
807 assertNotThrown!DateTimeException(testDT(DateTime(Date(1, 12, 1)), 31));
810 auto dt = DateTime(Date(1, 1, 1), TimeOfDay(7, 12, 22));
812 assert(dt == DateTime(Date(1, 1, 6), TimeOfDay(7, 12, 22)));
816 assertThrown!DateTimeException(testDT(DateTime(Date(-1, 1, 1)), 0));
817 assertThrown!DateTimeException(testDT(DateTime(Date(-1, 1, 1)), 32));
818 assertThrown!DateTimeException(testDT(DateTime(Date(-1, 2, 1)), 29));
819 assertThrown!DateTimeException(testDT(DateTime(Date(0, 2, 1)), 30));
820 assertThrown!DateTimeException(testDT(DateTime(Date(-1, 3, 1)), 32));
821 assertThrown!DateTimeException(testDT(DateTime(Date(-1, 4, 1)), 31));
822 assertThrown!DateTimeException(testDT(DateTime(Date(-1, 5, 1)), 32));
823 assertThrown!DateTimeException(testDT(DateTime(Date(-1, 6, 1)), 31));
824 assertThrown!DateTimeException(testDT(DateTime(Date(-1, 7, 1)), 32));
825 assertThrown!DateTimeException(testDT(DateTime(Date(-1, 8, 1)), 32));
826 assertThrown!DateTimeException(testDT(DateTime(Date(-1, 9, 1)), 31));
827 assertThrown!DateTimeException(testDT(DateTime(Date(-1, 10, 1)), 32));
828 assertThrown!DateTimeException(testDT(DateTime(Date(-1, 11, 1)), 31));
829 assertThrown!DateTimeException(testDT(DateTime(Date(-1, 12, 1)), 32));
831 assertNotThrown!DateTimeException(testDT(DateTime(Date(-1, 1, 1)), 31));
832 assertNotThrown!DateTimeException(testDT(DateTime(Date(-1, 2, 1)), 28));
833 assertNotThrown!DateTimeException(testDT(DateTime(Date(0, 2, 1)), 29));
834 assertNotThrown!DateTimeException(testDT(DateTime(Date(-1, 3, 1)), 31));
835 assertNotThrown!DateTimeException(testDT(DateTime(Date(-1, 4, 1)), 30));
836 assertNotThrown!DateTimeException(testDT(DateTime(Date(-1, 5, 1)), 31));
837 assertNotThrown!DateTimeException(testDT(DateTime(Date(-1, 6, 1)), 30));
838 assertNotThrown!DateTimeException(testDT(DateTime(Date(-1, 7, 1)), 31));
839 assertNotThrown!DateTimeException(testDT(DateTime(Date(-1, 8, 1)), 31));
840 assertNotThrown!DateTimeException(testDT(DateTime(Date(-1, 9, 1)), 30));
841 assertNotThrown!DateTimeException(testDT(DateTime(Date(-1, 10, 1)), 31));
842 assertNotThrown!DateTimeException(testDT(DateTime(Date(-1, 11, 1)), 30));
843 assertNotThrown!DateTimeException(testDT(DateTime(Date(-1, 12, 1)), 31));
845 auto dt = DateTime(Date(-1, 1, 1), TimeOfDay(7, 12, 22));
847 assert(dt == DateTime(Date(-1, 1, 6), TimeOfDay(7, 12, 22)));
867 assert(DateTime(Date.init, TimeOfDay(12, 0, 0)).hour == 12);
893 assertThrown!DateTimeException((){DateTime(Date(1999, 7, 6), TimeOfDay(0, 0, 0)).hour = 24;}());
1214 testDT(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)), 0,
1215 DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)));
1216 testDT(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)), 1,
1217 DateTime(Date(1999, 7, 6), TimeOfDay(13, 30, 33)));
1218 testDT(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)), 2,
1219 DateTime(Date(1999, 7, 6), TimeOfDay(14, 30, 33)));
1220 testDT(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)), 3,
1221 DateTime(Date(1999, 7, 6), TimeOfDay(15, 30, 33)));
1222 testDT(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)), 4,
1223 DateTime(Date(1999, 7, 6), TimeOfDay(16, 30, 33)));
1224 testDT(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)), 5,
1225 DateTime(Date(1999, 7, 6), TimeOfDay(17, 30, 33)));
1226 testDT(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)), 6,
1227 DateTime(Date(1999, 7, 6), TimeOfDay(18, 30, 33)));
1228 testDT(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)), 7,
1229 DateTime(Date(1999, 7, 6), TimeOfDay(19, 30, 33)));
1230 testDT(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)), 8,
1231 DateTime(Date(1999, 7, 6), TimeOfDay(20, 30, 33)));
1232 testDT(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)), 9,
1233 DateTime(Date(1999, 7, 6), TimeOfDay(21, 30, 33)));
1234 testDT(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)), 10,
1235 DateTime(Date(1999, 7, 6), TimeOfDay(22, 30, 33)));
1236 testDT(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)), 11,
1237 DateTime(Date(1999, 7, 6), TimeOfDay(23, 30, 33)));
1238 testDT(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)), 12,
1239 DateTime(Date(1999, 7, 6), TimeOfDay(0, 30, 33)));
1240 testDT(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)), 13,
1241 DateTime(Date(1999, 7, 6), TimeOfDay(1, 30, 33)));
1242 testDT(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)), 14,
1243 DateTime(Date(1999, 7, 6), TimeOfDay(2, 30, 33)));
1244 testDT(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)), 15,
1245 DateTime(Date(1999, 7, 6), TimeOfDay(3, 30, 33)));
1246 testDT(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)), 16,
1247 DateTime(Date(1999, 7, 6), TimeOfDay(4, 30, 33)));
1248 testDT(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)), 17,
1249 DateTime(Date(1999, 7, 6), TimeOfDay(5, 30, 33)));
1250 testDT(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)), 18,
1251 DateTime(Date(1999, 7, 6), TimeOfDay(6, 30, 33)));
1252 testDT(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)), 19,
1253 DateTime(Date(1999, 7, 6), TimeOfDay(7, 30, 33)));
1254 testDT(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)), 20,
1255 DateTime(Date(1999, 7, 6), TimeOfDay(8, 30, 33)));
1256 testDT(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)), 21,
1257 DateTime(Date(1999, 7, 6), TimeOfDay(9, 30, 33)));
1258 testDT(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)), 22,
1259 DateTime(Date(1999, 7, 6), TimeOfDay(10, 30, 33)));
1260 testDT(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)), 23,
1261 DateTime(Date(1999, 7, 6), TimeOfDay(11, 30, 33)));
1262 testDT(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)), 24,
1263 DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)));
1264 testDT(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)), 25,
1265 DateTime(Date(1999, 7, 6), TimeOfDay(13, 30, 33)));
1267 testDT(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)), -1,
1268 DateTime(Date(1999, 7, 6), TimeOfDay(11, 30, 33)));
1269 testDT(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)), -2,
1270 DateTime(Date(1999, 7, 6), TimeOfDay(10, 30, 33)));
1271 testDT(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)), -3,
1272 DateTime(Date(1999, 7, 6), TimeOfDay(9, 30, 33)));
1273 testDT(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)), -4,
1274 DateTime(Date(1999, 7, 6), TimeOfDay(8, 30, 33)));
1275 testDT(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)), -5,
1276 DateTime(Date(1999, 7, 6), TimeOfDay(7, 30, 33)));
1277 testDT(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)), -6,
1278 DateTime(Date(1999, 7, 6), TimeOfDay(6, 30, 33)));
1279 testDT(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)), -7,
1280 DateTime(Date(1999, 7, 6), TimeOfDay(5, 30, 33)));
1281 testDT(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)), -8,
1282 DateTime(Date(1999, 7, 6), TimeOfDay(4, 30, 33)));
1283 testDT(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)), -9,
1284 DateTime(Date(1999, 7, 6), TimeOfDay(3, 30, 33)));
1285 testDT(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)), -10,
1286 DateTime(Date(1999, 7, 6), TimeOfDay(2, 30, 33)));
1287 testDT(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)), -11,
1288 DateTime(Date(1999, 7, 6), TimeOfDay(1, 30, 33)));
1289 testDT(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)), -12,
1290 DateTime(Date(1999, 7, 6), TimeOfDay(0, 30, 33)));
1291 testDT(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)), -13,
1292 DateTime(Date(1999, 7, 6), TimeOfDay(23, 30, 33)));
1293 testDT(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)), -14,
1294 DateTime(Date(1999, 7, 6), TimeOfDay(22, 30, 33)));
1295 testDT(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)), -15,
1296 DateTime(Date(1999, 7, 6), TimeOfDay(21, 30, 33)));
1297 testDT(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)), -16,
1298 DateTime(Date(1999, 7, 6), TimeOfDay(20, 30, 33)));
1299 testDT(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)), -17,
1300 DateTime(Date(1999, 7, 6), TimeOfDay(19, 30, 33)));
1301 testDT(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)), -18,
1302 DateTime(Date(1999, 7, 6), TimeOfDay(18, 30, 33)));
1303 testDT(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)), -19,
1304 DateTime(Date(1999, 7, 6), TimeOfDay(17, 30, 33)));
1305 testDT(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)), -20,
1306 DateTime(Date(1999, 7, 6), TimeOfDay(16, 30, 33)));
1307 testDT(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)), -21,
1308 DateTime(Date(1999, 7, 6), TimeOfDay(15, 30, 33)));
1309 testDT(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)), -22,
1310 DateTime(Date(1999, 7, 6), TimeOfDay(14, 30, 33)));
1311 testDT(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)), -23,
1312 DateTime(Date(1999, 7, 6), TimeOfDay(13, 30, 33)));
1313 testDT(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)), -24,
1314 DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)));
1315 testDT(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)), -25,
1316 DateTime(Date(1999, 7, 6), TimeOfDay(11, 30, 33)));
1318 testDT(DateTime(Date(1999, 7, 6), TimeOfDay(0, 30, 33)), 1,
1319 DateTime(Date(1999, 7, 6), TimeOfDay(1, 30, 33)));
1320 testDT(DateTime(Date(1999, 7, 6), TimeOfDay(0, 30, 33)), 0,
1321 DateTime(Date(1999, 7, 6), TimeOfDay(0, 30, 33)));
1322 testDT(DateTime(Date(1999, 7, 6), TimeOfDay(0, 30, 33)), -1,
1323 DateTime(Date(1999, 7, 6), TimeOfDay(23, 30, 33)));
1325 testDT(DateTime(Date(1999, 7, 6), TimeOfDay(23, 30, 33)), 1,
1326 DateTime(Date(1999, 7, 6), TimeOfDay(0, 30, 33)));
1327 testDT(DateTime(Date(1999, 7, 6), TimeOfDay(23, 30, 33)), 0,
1328 DateTime(Date(1999, 7, 6), TimeOfDay(23, 30, 33)));
1329 testDT(DateTime(Date(1999, 7, 6), TimeOfDay(23, 30, 33)), -1,
1330 DateTime(Date(1999, 7, 6), TimeOfDay(22, 30, 33)));
1332 testDT(DateTime(Date(1999, 7, 31), TimeOfDay(23, 30, 33)), 1,
1333 DateTime(Date(1999, 7, 31), TimeOfDay(0, 30, 33)));
1334 testDT(DateTime(Date(1999, 8, 1), TimeOfDay(0, 30, 33)), -1,
1335 DateTime(Date(1999, 8, 1), TimeOfDay(23, 30, 33)));
1337 testDT(DateTime(Date(1999, 12, 31), TimeOfDay(23, 30, 33)), 1,
1338 DateTime(Date(1999, 12, 31), TimeOfDay(0, 30, 33)));
1339 testDT(DateTime(Date(2000, 1, 1), TimeOfDay(0, 30, 33)), -1,
1340 DateTime(Date(2000, 1, 1), TimeOfDay(23, 30, 33)));
1342 testDT(DateTime(Date(1999, 2, 28), TimeOfDay(23, 30, 33)), 25,
1343 DateTime(Date(1999, 2, 28), TimeOfDay(0, 30, 33)));
1344 testDT(DateTime(Date(1999, 3, 2), TimeOfDay(0, 30, 33)), -25,
1345 DateTime(Date(1999, 3, 2), TimeOfDay(23, 30, 33)));
1347 testDT(DateTime(Date(2000, 2, 28), TimeOfDay(23, 30, 33)), 25,
1348 DateTime(Date(2000, 2, 28), TimeOfDay(0, 30, 33)));
1349 testDT(DateTime(Date(2000, 3, 1), TimeOfDay(0, 30, 33)), -25,
1350 DateTime(Date(2000, 3, 1), TimeOfDay(23, 30, 33)));
1353 testDT(DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 33)), 0,
1354 DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 33)));
1355 testDT(DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 33)), 1,
1356 DateTime(Date(-1999, 7, 6), TimeOfDay(13, 30, 33)));
1357 testDT(DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 33)), 2,
1358 DateTime(Date(-1999, 7, 6), TimeOfDay(14, 30, 33)));
1359 testDT(DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 33)), 3,
1360 DateTime(Date(-1999, 7, 6), TimeOfDay(15, 30, 33)));
1361 testDT(DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 33)), 4,
1362 DateTime(Date(-1999, 7, 6), TimeOfDay(16, 30, 33)));
1363 testDT(DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 33)), 5,
1364 DateTime(Date(-1999, 7, 6), TimeOfDay(17, 30, 33)));
1365 testDT(DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 33)), 6,
1366 DateTime(Date(-1999, 7, 6), TimeOfDay(18, 30, 33)));
1367 testDT(DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 33)), 7,
1368 DateTime(Date(-1999, 7, 6), TimeOfDay(19, 30, 33)));
1369 testDT(DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 33)), 8,
1370 DateTime(Date(-1999, 7, 6), TimeOfDay(20, 30, 33)));
1371 testDT(DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 33)), 9,
1372 DateTime(Date(-1999, 7, 6), TimeOfDay(21, 30, 33)));
1373 testDT(DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 33)), 10,
1374 DateTime(Date(-1999, 7, 6), TimeOfDay(22, 30, 33)));
1375 testDT(DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 33)), 11,
1376 DateTime(Date(-1999, 7, 6), TimeOfDay(23, 30, 33)));
1377 testDT(DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 33)), 12,
1378 DateTime(Date(-1999, 7, 6), TimeOfDay(0, 30, 33)));
1379 testDT(DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 33)), 13,
1380 DateTime(Date(-1999, 7, 6), TimeOfDay(1, 30, 33)));
1381 testDT(DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 33)), 14,
1382 DateTime(Date(-1999, 7, 6), TimeOfDay(2, 30, 33)));
1383 testDT(DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 33)), 15,
1384 DateTime(Date(-1999, 7, 6), TimeOfDay(3, 30, 33)));
1385 testDT(DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 33)), 16,
1386 DateTime(Date(-1999, 7, 6), TimeOfDay(4, 30, 33)));
1387 testDT(DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 33)), 17,
1388 DateTime(Date(-1999, 7, 6), TimeOfDay(5, 30, 33)));
1389 testDT(DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 33)), 18,
1390 DateTime(Date(-1999, 7, 6), TimeOfDay(6, 30, 33)));
1391 testDT(DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 33)), 19,
1392 DateTime(Date(-1999, 7, 6), TimeOfDay(7, 30, 33)));
1393 testDT(DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 33)), 20,
1394 DateTime(Date(-1999, 7, 6), TimeOfDay(8, 30, 33)));
1395 testDT(DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 33)), 21,
1396 DateTime(Date(-1999, 7, 6), TimeOfDay(9, 30, 33)));
1397 testDT(DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 33)), 22,
1398 DateTime(Date(-1999, 7, 6), TimeOfDay(10, 30, 33)));
1399 testDT(DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 33)), 23,
1400 DateTime(Date(-1999, 7, 6), TimeOfDay(11, 30, 33)));
1401 testDT(DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 33)), 24,
1402 DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 33)));
1403 testDT(DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 33)), 25,
1404 DateTime(Date(-1999, 7, 6), TimeOfDay(13, 30, 33)));
1406 testDT(DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 33)), -1,
1407 DateTime(Date(-1999, 7, 6), TimeOfDay(11, 30, 33)));
1408 testDT(DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 33)), -2,
1409 DateTime(Date(-1999, 7, 6), TimeOfDay(10, 30, 33)));
1410 testDT(DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 33)), -3,
1411 DateTime(Date(-1999, 7, 6), TimeOfDay(9, 30, 33)));
1412 testDT(DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 33)), -4,
1413 DateTime(Date(-1999, 7, 6), TimeOfDay(8, 30, 33)));
1414 testDT(DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 33)), -5,
1415 DateTime(Date(-1999, 7, 6), TimeOfDay(7, 30, 33)));
1416 testDT(DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 33)), -6,
1417 DateTime(Date(-1999, 7, 6), TimeOfDay(6, 30, 33)));
1418 testDT(DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 33)), -7,
1419 DateTime(Date(-1999, 7, 6), TimeOfDay(5, 30, 33)));
1420 testDT(DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 33)), -8,
1421 DateTime(Date(-1999, 7, 6), TimeOfDay(4, 30, 33)));
1422 testDT(DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 33)), -9,
1423 DateTime(Date(-1999, 7, 6), TimeOfDay(3, 30, 33)));
1424 testDT(DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 33)), -10,
1425 DateTime(Date(-1999, 7, 6), TimeOfDay(2, 30, 33)));
1426 testDT(DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 33)), -11,
1427 DateTime(Date(-1999, 7, 6), TimeOfDay(1, 30, 33)));
1428 testDT(DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 33)), -12,
1429 DateTime(Date(-1999, 7, 6), TimeOfDay(0, 30, 33)));
1430 testDT(DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 33)), -13,
1431 DateTime(Date(-1999, 7, 6), TimeOfDay(23, 30, 33)));
1432 testDT(DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 33)), -14,
1433 DateTime(Date(-1999, 7, 6), TimeOfDay(22, 30, 33)));
1434 testDT(DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 33)), -15,
1435 DateTime(Date(-1999, 7, 6), TimeOfDay(21, 30, 33)));
1436 testDT(DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 33)), -16,
1437 DateTime(Date(-1999, 7, 6), TimeOfDay(20, 30, 33)));
1438 testDT(DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 33)), -17,
1439 DateTime(Date(-1999, 7, 6), TimeOfDay(19, 30, 33)));
1440 testDT(DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 33)), -18,
1441 DateTime(Date(-1999, 7, 6), TimeOfDay(18, 30, 33)));
1442 testDT(DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 33)), -19,
1443 DateTime(Date(-1999, 7, 6), TimeOfDay(17, 30, 33)));
1444 testDT(DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 33)), -20,
1445 DateTime(Date(-1999, 7, 6), TimeOfDay(16, 30, 33)));
1446 testDT(DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 33)), -21,
1447 DateTime(Date(-1999, 7, 6), TimeOfDay(15, 30, 33)));
1448 testDT(DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 33)), -22,
1449 DateTime(Date(-1999, 7, 6), TimeOfDay(14, 30, 33)));
1450 testDT(DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 33)), -23,
1451 DateTime(Date(-1999, 7, 6), TimeOfDay(13, 30, 33)));
1452 testDT(DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 33)), -24,
1453 DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 33)));
1454 testDT(DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 33)), -25,
1455 DateTime(Date(-1999, 7, 6), TimeOfDay(11, 30, 33)));
1457 testDT(DateTime(Date(-1999, 7, 6), TimeOfDay(0, 30, 33)), 1,
1458 DateTime(Date(-1999, 7, 6), TimeOfDay(1, 30, 33)));
1459 testDT(DateTime(Date(-1999, 7, 6), TimeOfDay(0, 30, 33)), 0,
1460 DateTime(Date(-1999, 7, 6), TimeOfDay(0, 30, 33)));
1461 testDT(DateTime(Date(-1999, 7, 6), TimeOfDay(0, 30, 33)), -1,
1462 DateTime(Date(-1999, 7, 6), TimeOfDay(23, 30, 33)));
1464 testDT(DateTime(Date(-1999, 7, 6), TimeOfDay(23, 30, 33)), 1,
1465 DateTime(Date(-1999, 7, 6), TimeOfDay(0, 30, 33)));
1466 testDT(DateTime(Date(-1999, 7, 6), TimeOfDay(23, 30, 33)), 0,
1467 DateTime(Date(-1999, 7, 6), TimeOfDay(23, 30, 33)));
1468 testDT(DateTime(Date(-1999, 7, 6), TimeOfDay(23, 30, 33)), -1,
1469 DateTime(Date(-1999, 7, 6), TimeOfDay(22, 30, 33)));
1471 testDT(DateTime(Date(-1999, 7, 31), TimeOfDay(23, 30, 33)), 1,
1472 DateTime(Date(-1999, 7, 31), TimeOfDay(0, 30, 33)));
1473 testDT(DateTime(Date(-1999, 8, 1), TimeOfDay(0, 30, 33)), -1,
1474 DateTime(Date(-1999, 8, 1), TimeOfDay(23, 30, 33)));
1476 testDT(DateTime(Date(-2001, 12, 31), TimeOfDay(23, 30, 33)), 1,
1477 DateTime(Date(-2001, 12, 31), TimeOfDay(0, 30, 33)));
1478 testDT(DateTime(Date(-2000, 1, 1), TimeOfDay(0, 30, 33)), -1,
1479 DateTime(Date(-2000, 1, 1), TimeOfDay(23, 30, 33)));
1481 testDT(DateTime(Date(-2001, 2, 28), TimeOfDay(23, 30, 33)), 25,
1482 DateTime(Date(-2001, 2, 28), TimeOfDay(0, 30, 33)));
1483 testDT(DateTime(Date(-2001, 3, 2), TimeOfDay(0, 30, 33)), -25,
1484 DateTime(Date(-2001, 3, 2), TimeOfDay(23, 30, 33)));
1486 testDT(DateTime(Date(-2000, 2, 28), TimeOfDay(23, 30, 33)), 25,
1487 DateTime(Date(-2000, 2, 28), TimeOfDay(0, 30, 33)));
1488 testDT(DateTime(Date(-2000, 3, 1), TimeOfDay(0, 30, 33)), -25,
1489 DateTime(Date(-2000, 3, 1), TimeOfDay(23, 30, 33)));
1492 testDT(DateTime(Date(-1, 1, 1), TimeOfDay(11, 30, 33)), 17_546,
1493 DateTime(Date(-1, 1, 1), TimeOfDay(13, 30, 33)));
1494 testDT(DateTime(Date(1, 1, 1), TimeOfDay(13, 30, 33)), -17_546,
1495 DateTime(Date(1, 1, 1), TimeOfDay(11, 30, 33)));
1517 testDT(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)), 0,
1518 DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)));
1519 testDT(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)), 1,
1520 DateTime(Date(1999, 7, 6), TimeOfDay(12, 31, 33)));
1521 testDT(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)), 2,
1522 DateTime(Date(1999, 7, 6), TimeOfDay(12, 32, 33)));
1523 testDT(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)), 3,
1524 DateTime(Date(1999, 7, 6), TimeOfDay(12, 33, 33)));
1525 testDT(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)), 4,
1526 DateTime(Date(1999, 7, 6), TimeOfDay(12, 34, 33)));
1527 testDT(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)), 5,
1528 DateTime(Date(1999, 7, 6), TimeOfDay(12, 35, 33)));
1529 testDT(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)), 10,
1530 DateTime(Date(1999, 7, 6), TimeOfDay(12, 40, 33)));
1531 testDT(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)), 15,
1532 DateTime(Date(1999, 7, 6), TimeOfDay(12, 45, 33)));
1533 testDT(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)), 29,
1534 DateTime(Date(1999, 7, 6), TimeOfDay(12, 59, 33)));
1535 testDT(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)), 30,
1536 DateTime(Date(1999, 7, 6), TimeOfDay(12, 0, 33)));
1537 testDT(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)), 45,
1538 DateTime(Date(1999, 7, 6), TimeOfDay(12, 15, 33)));
1539 testDT(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)), 60,
1540 DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)));
1541 testDT(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)), 75,
1542 DateTime(Date(1999, 7, 6), TimeOfDay(12, 45, 33)));
1543 testDT(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)), 90,
1544 DateTime(Date(1999, 7, 6), TimeOfDay(12, 0, 33)));
1545 testDT(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)), 100,
1546 DateTime(Date(1999, 7, 6), TimeOfDay(12, 10, 33)));
1548 testDT(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)), 689,
1549 DateTime(Date(1999, 7, 6), TimeOfDay(12, 59, 33)));
1550 testDT(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)), 690,
1551 DateTime(Date(1999, 7, 6), TimeOfDay(12, 0, 33)));
1552 testDT(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)), 691,
1553 DateTime(Date(1999, 7, 6), TimeOfDay(12, 1, 33)));
1554 testDT(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)), 960,
1555 DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)));
1556 testDT(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)), 1439,
1557 DateTime(Date(1999, 7, 6), TimeOfDay(12, 29, 33)));
1558 testDT(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)), 1440,
1559 DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)));
1560 testDT(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)), 1441,
1561 DateTime(Date(1999, 7, 6), TimeOfDay(12, 31, 33)));
1562 testDT(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)), 2880,
1563 DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)));
1565 testDT(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)), -1,
1566 DateTime(Date(1999, 7, 6), TimeOfDay(12, 29, 33)));
1567 testDT(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)), -2,
1568 DateTime(Date(1999, 7, 6), TimeOfDay(12, 28, 33)));
1569 testDT(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)), -3,
1570 DateTime(Date(1999, 7, 6), TimeOfDay(12, 27, 33)));
1571 testDT(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)), -4,
1572 DateTime(Date(1999, 7, 6), TimeOfDay(12, 26, 33)));
1573 testDT(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)), -5,
1574 DateTime(Date(1999, 7, 6), TimeOfDay(12, 25, 33)));
1575 testDT(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)), -10,
1576 DateTime(Date(1999, 7, 6), TimeOfDay(12, 20, 33)));
1577 testDT(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)), -15,
1578 DateTime(Date(1999, 7, 6), TimeOfDay(12, 15, 33)));
1579 testDT(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)), -29,
1580 DateTime(Date(1999, 7, 6), TimeOfDay(12, 1, 33)));
1581 testDT(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)), -30,
1582 DateTime(Date(1999, 7, 6), TimeOfDay(12, 0, 33)));
1583 testDT(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)), -45,
1584 DateTime(Date(1999, 7, 6), TimeOfDay(12, 45, 33)));
1585 testDT(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)), -60,
1586 DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)));
1587 testDT(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)), -75,
1588 DateTime(Date(1999, 7, 6), TimeOfDay(12, 15, 33)));
1589 testDT(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)), -90,
1590 DateTime(Date(1999, 7, 6), TimeOfDay(12, 0, 33)));
1591 testDT(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)), -100,
1592 DateTime(Date(1999, 7, 6), TimeOfDay(12, 50, 33)));
1594 testDT(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)), -749,
1595 DateTime(Date(1999, 7, 6), TimeOfDay(12, 1, 33)));
1596 testDT(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)), -750,
1597 DateTime(Date(1999, 7, 6), TimeOfDay(12, 0, 33)));
1598 testDT(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)), -751,
1599 DateTime(Date(1999, 7, 6), TimeOfDay(12, 59, 33)));
1600 testDT(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)), -960,
1601 DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)));
1602 testDT(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)), -1439,
1603 DateTime(Date(1999, 7, 6), TimeOfDay(12, 31, 33)));
1604 testDT(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)), -1440,
1605 DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)));
1606 testDT(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)), -1441,
1607 DateTime(Date(1999, 7, 6), TimeOfDay(12, 29, 33)));
1608 testDT(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)), -2880,
1609 DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)));
1611 testDT(DateTime(Date(1999, 7, 6), TimeOfDay(12, 0, 33)), 1,
1612 DateTime(Date(1999, 7, 6), TimeOfDay(12, 1, 33)));
1613 testDT(DateTime(Date(1999, 7, 6), TimeOfDay(12, 0, 33)), 0,
1614 DateTime(Date(1999, 7, 6), TimeOfDay(12, 0, 33)));
1615 testDT(DateTime(Date(1999, 7, 6), TimeOfDay(12, 0, 33)), -1,
1616 DateTime(Date(1999, 7, 6), TimeOfDay(12, 59, 33)));
1618 testDT(DateTime(Date(1999, 7, 6), TimeOfDay(11, 59, 33)), 1,
1619 DateTime(Date(1999, 7, 6), TimeOfDay(11, 0, 33)));
1620 testDT(DateTime(Date(1999, 7, 6), TimeOfDay(11, 59, 33)), 0,
1621 DateTime(Date(1999, 7, 6), TimeOfDay(11, 59, 33)));
1622 testDT(DateTime(Date(1999, 7, 6), TimeOfDay(11, 59, 33)), -1,
1623 DateTime(Date(1999, 7, 6), TimeOfDay(11, 58, 33)));
1625 testDT(DateTime(Date(1999, 7, 6), TimeOfDay(0, 0, 33)), 1,
1626 DateTime(Date(1999, 7, 6), TimeOfDay(0, 1, 33)));
1627 testDT(DateTime(Date(1999, 7, 6), TimeOfDay(0, 0, 33)), 0,
1628 DateTime(Date(1999, 7, 6), TimeOfDay(0, 0, 33)));
1629 testDT(DateTime(Date(1999, 7, 6), TimeOfDay(0, 0, 33)), -1,
1630 DateTime(Date(1999, 7, 6), TimeOfDay(0, 59, 33)));
1632 testDT(DateTime(Date(1999, 7, 5), TimeOfDay(23, 59, 33)), 1,
1633 DateTime(Date(1999, 7, 5), TimeOfDay(23, 0, 33)));
1634 testDT(DateTime(Date(1999, 7, 5), TimeOfDay(23, 59, 33)), 0,
1635 DateTime(Date(1999, 7, 5), TimeOfDay(23, 59, 33)));
1636 testDT(DateTime(Date(1999, 7, 5), TimeOfDay(23, 59, 33)), -1,
1637 DateTime(Date(1999, 7, 5), TimeOfDay(23, 58, 33)));
1639 testDT(DateTime(Date(1998, 12, 31), TimeOfDay(23, 59, 33)), 1,
1640 DateTime(Date(1998, 12, 31), TimeOfDay(23, 0, 33)));
1641 testDT(DateTime(Date(1998, 12, 31), TimeOfDay(23, 59, 33)), 0,
1642 DateTime(Date(1998, 12, 31), TimeOfDay(23, 59, 33)));
1643 testDT(DateTime(Date(1998, 12, 31), TimeOfDay(23, 59, 33)), -1,
1644 DateTime(Date(1998, 12, 31), TimeOfDay(23, 58, 33)));
1647 testDT(DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 33)), 0,
1648 DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 33)));
1649 testDT(DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 33)), 1,
1650 DateTime(Date(-1999, 7, 6), TimeOfDay(12, 31, 33)));
1651 testDT(DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 33)), 2,
1652 DateTime(Date(-1999, 7, 6), TimeOfDay(12, 32, 33)));
1653 testDT(DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 33)), 3,
1654 DateTime(Date(-1999, 7, 6), TimeOfDay(12, 33, 33)));
1655 testDT(DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 33)), 4,
1656 DateTime(Date(-1999, 7, 6), TimeOfDay(12, 34, 33)));
1657 testDT(DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 33)), 5,
1658 DateTime(Date(-1999, 7, 6), TimeOfDay(12, 35, 33)));
1659 testDT(DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 33)), 10,
1660 DateTime(Date(-1999, 7, 6), TimeOfDay(12, 40, 33)));
1661 testDT(DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 33)), 15,
1662 DateTime(Date(-1999, 7, 6), TimeOfDay(12, 45, 33)));
1663 testDT(DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 33)), 29,
1664 DateTime(Date(-1999, 7, 6), TimeOfDay(12, 59, 33)));
1665 testDT(DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 33)), 30,
1666 DateTime(Date(-1999, 7, 6), TimeOfDay(12, 0, 33)));
1667 testDT(DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 33)), 45,
1668 DateTime(Date(-1999, 7, 6), TimeOfDay(12, 15, 33)));
1669 testDT(DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 33)), 60,
1670 DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 33)));
1671 testDT(DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 33)), 75,
1672 DateTime(Date(-1999, 7, 6), TimeOfDay(12, 45, 33)));
1673 testDT(DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 33)), 90,
1674 DateTime(Date(-1999, 7, 6), TimeOfDay(12, 0, 33)));
1675 testDT(DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 33)), 100,
1676 DateTime(Date(-1999, 7, 6), TimeOfDay(12, 10, 33)));
1678 testDT(DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 33)), 689,
1679 DateTime(Date(-1999, 7, 6), TimeOfDay(12, 59, 33)));
1680 testDT(DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 33)), 690,
1681 DateTime(Date(-1999, 7, 6), TimeOfDay(12, 0, 33)));
1682 testDT(DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 33)), 691,
1683 DateTime(Date(-1999, 7, 6), TimeOfDay(12, 1, 33)));
1684 testDT(DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 33)), 960,
1685 DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 33)));
1686 testDT(DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 33)), 1439,
1687 DateTime(Date(-1999, 7, 6), TimeOfDay(12, 29, 33)));
1688 testDT(DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 33)), 1440,
1689 DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 33)));
1690 testDT(DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 33)), 1441,
1691 DateTime(Date(-1999, 7, 6), TimeOfDay(12, 31, 33)));
1692 testDT(DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 33)), 2880,
1693 DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 33)));
1695 testDT(DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 33)), -1,
1696 DateTime(Date(-1999, 7, 6), TimeOfDay(12, 29, 33)));
1697 testDT(DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 33)), -2,
1698 DateTime(Date(-1999, 7, 6), TimeOfDay(12, 28, 33)));
1699 testDT(DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 33)), -3,
1700 DateTime(Date(-1999, 7, 6), TimeOfDay(12, 27, 33)));
1701 testDT(DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 33)), -4,
1702 DateTime(Date(-1999, 7, 6), TimeOfDay(12, 26, 33)));
1703 testDT(DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 33)), -5,
1704 DateTime(Date(-1999, 7, 6), TimeOfDay(12, 25, 33)));
1705 testDT(DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 33)), -10,
1706 DateTime(Date(-1999, 7, 6), TimeOfDay(12, 20, 33)));
1707 testDT(DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 33)), -15,
1708 DateTime(Date(-1999, 7, 6), TimeOfDay(12, 15, 33)));
1709 testDT(DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 33)), -29,
1710 DateTime(Date(-1999, 7, 6), TimeOfDay(12, 1, 33)));
1711 testDT(DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 33)), -30,
1712 DateTime(Date(-1999, 7, 6), TimeOfDay(12, 0, 33)));
1713 testDT(DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 33)), -45,
1714 DateTime(Date(-1999, 7, 6), TimeOfDay(12, 45, 33)));
1715 testDT(DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 33)), -60,
1716 DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 33)));
1717 testDT(DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 33)), -75,
1718 DateTime(Date(-1999, 7, 6), TimeOfDay(12, 15, 33)));
1719 testDT(DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 33)), -90,
1720 DateTime(Date(-1999, 7, 6), TimeOfDay(12, 0, 33)));
1721 testDT(DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 33)), -100,
1722 DateTime(Date(-1999, 7, 6), TimeOfDay(12, 50, 33)));
1724 testDT(DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 33)), -749,
1725 DateTime(Date(-1999, 7, 6), TimeOfDay(12, 1, 33)));
1726 testDT(DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 33)), -750,
1727 DateTime(Date(-1999, 7, 6), TimeOfDay(12, 0, 33)));
1728 testDT(DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 33)), -751,
1729 DateTime(Date(-1999, 7, 6), TimeOfDay(12, 59, 33)));
1730 testDT(DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 33)), -960,
1731 DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 33)));
1732 testDT(DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 33)), -1439,
1733 DateTime(Date(-1999, 7, 6), TimeOfDay(12, 31, 33)));
1734 testDT(DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 33)), -1440,
1735 DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 33)));
1736 testDT(DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 33)), -1441,
1737 DateTime(Date(-1999, 7, 6), TimeOfDay(12, 29, 33)));
1738 testDT(DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 33)), -2880,
1739 DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 33)));
1741 testDT(DateTime(Date(-1999, 7, 6), TimeOfDay(12, 0, 33)), 1,
1742 DateTime(Date(-1999, 7, 6), TimeOfDay(12, 1, 33)));
1743 testDT(DateTime(Date(-1999, 7, 6), TimeOfDay(12, 0, 33)), 0,
1744 DateTime(Date(-1999, 7, 6), TimeOfDay(12, 0, 33)));
1745 testDT(DateTime(Date(-1999, 7, 6), TimeOfDay(12, 0, 33)), -1,
1746 DateTime(Date(-1999, 7, 6), TimeOfDay(12, 59, 33)));
1748 testDT(DateTime(Date(-1999, 7, 6), TimeOfDay(11, 59, 33)), 1,
1749 DateTime(Date(-1999, 7, 6), TimeOfDay(11, 0, 33)));
1750 testDT(DateTime(Date(-1999, 7, 6), TimeOfDay(11, 59, 33)), 0,
1751 DateTime(Date(-1999, 7, 6), TimeOfDay(11, 59, 33)));
1752 testDT(DateTime(Date(-1999, 7, 6), TimeOfDay(11, 59, 33)), -1,
1753 DateTime(Date(-1999, 7, 6), TimeOfDay(11, 58, 33)));
1755 testDT(DateTime(Date(-1999, 7, 6), TimeOfDay(0, 0, 33)), 1,
1756 DateTime(Date(-1999, 7, 6), TimeOfDay(0, 1, 33)));
1757 testDT(DateTime(Date(-1999, 7, 6), TimeOfDay(0, 0, 33)), 0,
1758 DateTime(Date(-1999, 7, 6), TimeOfDay(0, 0, 33)));
1759 testDT(DateTime(Date(-1999, 7, 6), TimeOfDay(0, 0, 33)), -1,
1760 DateTime(Date(-1999, 7, 6), TimeOfDay(0, 59, 33)));
1762 testDT(DateTime(Date(-1999, 7, 5), TimeOfDay(23, 59, 33)), 1,
1763 DateTime(Date(-1999, 7, 5), TimeOfDay(23, 0, 33)));
1764 testDT(DateTime(Date(-1999, 7, 5), TimeOfDay(23, 59, 33)), 0,
1765 DateTime(Date(-1999, 7, 5), TimeOfDay(23, 59, 33)));
1766 testDT(DateTime(Date(-1999, 7, 5), TimeOfDay(23, 59, 33)), -1,
1767 DateTime(Date(-1999, 7, 5), TimeOfDay(23, 58, 33)));
1769 testDT(DateTime(Date(-2000, 12, 31), TimeOfDay(23, 59, 33)), 1,
1770 DateTime(Date(-2000, 12, 31), TimeOfDay(23, 0, 33)));
1771 testDT(DateTime(Date(-2000, 12, 31), TimeOfDay(23, 59, 33)), 0,
1772 DateTime(Date(-2000, 12, 31), TimeOfDay(23, 59, 33)));
1773 testDT(DateTime(Date(-2000, 12, 31), TimeOfDay(23, 59, 33)), -1,
1774 DateTime(Date(-2000, 12, 31), TimeOfDay(23, 58, 33)));
1777 testDT(DateTime(Date(1, 1, 1), TimeOfDay(0, 0, 0)), -1,
1778 DateTime(Date(1, 1, 1), TimeOfDay(0, 59, 0)));
1779 testDT(DateTime(Date(0, 12, 31), TimeOfDay(23, 59, 0)), 1,
1780 DateTime(Date(0, 12, 31), TimeOfDay(23, 0, 0)));
1782 testDT(DateTime(Date(0, 1, 1), TimeOfDay(0, 0, 0)), -1,
1783 DateTime(Date(0, 1, 1), TimeOfDay(0, 59, 0)));
1784 testDT(DateTime(Date(-1, 12, 31), TimeOfDay(23, 59, 0)), 1,
1785 DateTime(Date(-1, 12, 31), TimeOfDay(23, 0, 0)));
1787 testDT(DateTime(Date(-1, 1, 1), TimeOfDay(11, 30, 33)), 1_052_760,
1788 DateTime(Date(-1, 1, 1), TimeOfDay(11, 30, 33)));
1789 testDT(DateTime(Date(1, 1, 1), TimeOfDay(13, 30, 33)), -1_052_760,
1790 DateTime(Date(1, 1, 1), TimeOfDay(13, 30, 33)));
1792 testDT(DateTime(Date(-1, 1, 1), TimeOfDay(11, 30, 33)), 1_052_782,
1793 DateTime(Date(-1, 1, 1), TimeOfDay(11, 52, 33)));
1794 testDT(DateTime(Date(1, 1, 1), TimeOfDay(13, 52, 33)), -1_052_782,
1795 DateTime(Date(1, 1, 1), TimeOfDay(13, 30, 33)));
1817 testDT(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)), 0,
1818 DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)));
1819 testDT(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)), 1,
1820 DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 34)));
1821 testDT(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)), 2,
1822 DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 35)));
1823 testDT(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)), 3,
1824 DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 36)));
1825 testDT(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)), 4,
1826 DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 37)));
1827 testDT(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)), 5,
1828 DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 38)));
1829 testDT(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)), 10,
1830 DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 43)));
1831 testDT(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)), 15,
1832 DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 48)));
1833 testDT(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)), 26,
1834 DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 59)));
1835 testDT(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)), 27,
1836 DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 0)));
1837 testDT(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)), 30,
1838 DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 3)));
1839 testDT(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)), 59,
1840 DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 32)));
1841 testDT(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)), 60,
1842 DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)));
1843 testDT(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)), 61,
1844 DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 34)));
1846 testDT(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)), 1766,
1847 DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 59)));
1848 testDT(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)), 1767,
1849 DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 0)));
1850 testDT(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)), 1768,
1851 DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 1)));
1852 testDT(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)), 2007,
1853 DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 0)));
1854 testDT(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)), 3599,
1855 DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 32)));
1856 testDT(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)), 3600,
1857 DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)));
1858 testDT(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)), 3601,
1859 DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 34)));
1860 testDT(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)), 7200,
1861 DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)));
1863 testDT(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)), -1,
1864 DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 32)));
1865 testDT(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)), -2,
1866 DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 31)));
1867 testDT(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)), -3,
1868 DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 30)));
1869 testDT(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)), -4,
1870 DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 29)));
1871 testDT(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)), -5,
1872 DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 28)));
1873 testDT(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)), -10,
1874 DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 23)));
1875 testDT(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)), -15,
1876 DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 18)));
1877 testDT(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)), -33,
1878 DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 0)));
1879 testDT(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)), -34,
1880 DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 59)));
1881 testDT(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)), -35,
1882 DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 58)));
1883 testDT(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)), -59,
1884 DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 34)));
1885 testDT(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)), -60,
1886 DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)));
1887 testDT(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)), -61,
1888 DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 32)));
1890 testDT(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 0)), 1,
1891 DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 1)));
1892 testDT(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 0)), 0,
1893 DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 0)));
1894 testDT(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 0)), -1,
1895 DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 59)));
1897 testDT(DateTime(Date(1999, 7, 6), TimeOfDay(12, 0, 0)), 1,
1898 DateTime(Date(1999, 7, 6), TimeOfDay(12, 0, 1)));
1899 testDT(DateTime(Date(1999, 7, 6), TimeOfDay(12, 0, 0)), 0,
1900 DateTime(Date(1999, 7, 6), TimeOfDay(12, 0, 0)));
1901 testDT(DateTime(Date(1999, 7, 6), TimeOfDay(12, 0, 0)), -1,
1902 DateTime(Date(1999, 7, 6), TimeOfDay(12, 0, 59)));
1904 testDT(DateTime(Date(1999, 7, 6), TimeOfDay(0, 0, 0)), 1,
1905 DateTime(Date(1999, 7, 6), TimeOfDay(0, 0, 1)));
1906 testDT(DateTime(Date(1999, 7, 6), TimeOfDay(0, 0, 0)), 0,
1907 DateTime(Date(1999, 7, 6), TimeOfDay(0, 0, 0)));
1908 testDT(DateTime(Date(1999, 7, 6), TimeOfDay(0, 0, 0)), -1,
1909 DateTime(Date(1999, 7, 6), TimeOfDay(0, 0, 59)));
1911 testDT(DateTime(Date(1999, 7, 5), TimeOfDay(23, 59, 59)), 1,
1912 DateTime(Date(1999, 7, 5), TimeOfDay(23, 59, 0)));
1913 testDT(DateTime(Date(1999, 7, 5), TimeOfDay(23, 59, 59)), 0,
1914 DateTime(Date(1999, 7, 5), TimeOfDay(23, 59, 59)));
1915 testDT(DateTime(Date(1999, 7, 5), TimeOfDay(23, 59, 59)), -1,
1916 DateTime(Date(1999, 7, 5), TimeOfDay(23, 59, 58)));
1918 testDT(DateTime(Date(1998, 12, 31), TimeOfDay(23, 59, 59)), 1,
1919 DateTime(Date(1998, 12, 31), TimeOfDay(23, 59, 0)));
1920 testDT(DateTime(Date(1998, 12, 31), TimeOfDay(23, 59, 59)), 0,
1921 DateTime(Date(1998, 12, 31), TimeOfDay(23, 59, 59)));
1922 testDT(DateTime(Date(1998, 12, 31), TimeOfDay(23, 59, 59)), -1,
1923 DateTime(Date(1998, 12, 31), TimeOfDay(23, 59, 58)));
1926 testDT(DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 33)), 0,
1927 DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 33)));
1928 testDT(DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 33)), 1,
1929 DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 34)));
1930 testDT(DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 33)), 2,
1931 DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 35)));
1932 testDT(DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 33)), 3,
1933 DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 36)));
1934 testDT(DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 33)), 4,
1935 DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 37)));
1936 testDT(DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 33)), 5,
1937 DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 38)));
1938 testDT(DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 33)), 10,
1939 DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 43)));
1940 testDT(DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 33)), 15,
1941 DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 48)));
1942 testDT(DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 33)), 26,
1943 DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 59)));
1944 testDT(DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 33)), 27,
1945 DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 0)));
1946 testDT(DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 33)), 30,
1947 DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 3)));
1948 testDT(DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 33)), 59,
1949 DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 32)));
1950 testDT(DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 33)), 60,
1951 DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 33)));
1952 testDT(DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 33)), 61,
1953 DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 34)));
1955 testDT(DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 33)), 1766,
1956 DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 59)));
1957 testDT(DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 33)), 1767,
1958 DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 0)));
1959 testDT(DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 33)), 1768,
1960 DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 1)));
1961 testDT(DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 33)), 2007,
1962 DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 0)));
1963 testDT(DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 33)), 3599,
1964 DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 32)));
1965 testDT(DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 33)), 3600,
1966 DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 33)));
1967 testDT(DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 33)), 3601,
1968 DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 34)));
1969 testDT(DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 33)), 7200,
1970 DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 33)));
1972 testDT(DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 33)), -1,
1973 DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 32)));
1974 testDT(DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 33)), -2,
1975 DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 31)));
1976 testDT(DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 33)), -3,
1977 DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 30)));
1978 testDT(DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 33)), -4,
1979 DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 29)));
1980 testDT(DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 33)), -5,
1981 DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 28)));
1982 testDT(DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 33)), -10,
1983 DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 23)));
1984 testDT(DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 33)), -15,
1985 DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 18)));
1986 testDT(DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 33)), -33,
1987 DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 0)));
1988 testDT(DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 33)), -34,
1989 DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 59)));
1990 testDT(DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 33)), -35,
1991 DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 58)));
1992 testDT(DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 33)), -59,
1993 DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 34)));
1994 testDT(DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 33)), -60,
1995 DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 33)));
1996 testDT(DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 33)), -61,
1997 DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 32)));
1999 testDT(DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 0)), 1,
2000 DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 1)));
2001 testDT(DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 0)), 0,
2002 DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 0)));
2003 testDT(DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 0)), -1,
2004 DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 59)));
2006 testDT(DateTime(Date(-1999, 7, 6), TimeOfDay(12, 0, 0)), 1,
2007 DateTime(Date(-1999, 7, 6), TimeOfDay(12, 0, 1)));
2008 testDT(DateTime(Date(-1999, 7, 6), TimeOfDay(12, 0, 0)), 0,
2009 DateTime(Date(-1999, 7, 6), TimeOfDay(12, 0, 0)));
2010 testDT(DateTime(Date(-1999, 7, 6), TimeOfDay(12, 0, 0)), -1,
2011 DateTime(Date(-1999, 7, 6), TimeOfDay(12, 0, 59)));
2013 testDT(DateTime(Date(-1999, 7, 6), TimeOfDay(0, 0, 0)), 1,
2014 DateTime(Date(-1999, 7, 6), TimeOfDay(0, 0, 1)));
2015 testDT(DateTime(Date(-1999, 7, 6), TimeOfDay(0, 0, 0)), 0,
2016 DateTime(Date(-1999, 7, 6), TimeOfDay(0, 0, 0)));
2017 testDT(DateTime(Date(-1999, 7, 6), TimeOfDay(0, 0, 0)), -1,
2018 DateTime(Date(-1999, 7, 6), TimeOfDay(0, 0, 59)));
2020 testDT(DateTime(Date(-1999, 7, 5), TimeOfDay(23, 59, 59)), 1,
2021 DateTime(Date(-1999, 7, 5), TimeOfDay(23, 59, 0)));
2022 testDT(DateTime(Date(-1999, 7, 5), TimeOfDay(23, 59, 59)), 0,
2023 DateTime(Date(-1999, 7, 5), TimeOfDay(23, 59, 59)));
2024 testDT(DateTime(Date(-1999, 7, 5), TimeOfDay(23, 59, 59)), -1,
2025 DateTime(Date(-1999, 7, 5), TimeOfDay(23, 59, 58)));
2027 testDT(DateTime(Date(-2000, 12, 31), TimeOfDay(23, 59, 59)), 1,
2028 DateTime(Date(-2000, 12, 31), TimeOfDay(23, 59, 0)));
2029 testDT(DateTime(Date(-2000, 12, 31), TimeOfDay(23, 59, 59)), 0,
2030 DateTime(Date(-2000, 12, 31), TimeOfDay(23, 59, 59)));
2031 testDT(DateTime(Date(-2000, 12, 31), TimeOfDay(23, 59, 59)), -1,
2032 DateTime(Date(-2000, 12, 31), TimeOfDay(23, 59, 58)));
2035 testDT(DateTime(Date(1, 1, 1), TimeOfDay(0, 0, 0)), -1,
2036 DateTime(Date(1, 1, 1), TimeOfDay(0, 0, 59)));
2037 testDT(DateTime(Date(0, 12, 31), TimeOfDay(23, 59, 59)), 1,
2038 DateTime(Date(0, 12, 31), TimeOfDay(23, 59, 0)));
2040 testDT(DateTime(Date(0, 1, 1), TimeOfDay(0, 0, 0)), -1,
2041 DateTime(Date(0, 1, 1), TimeOfDay(0, 0, 59)));
2042 testDT(DateTime(Date(-1, 12, 31), TimeOfDay(23, 59, 59)), 1,
2043 DateTime(Date(-1, 12, 31), TimeOfDay(23, 59, 0)));
2045 testDT(DateTime(Date(-1, 1, 1), TimeOfDay(11, 30, 33)), 63_165_600L,
2046 DateTime(Date(-1, 1, 1), TimeOfDay(11, 30, 33)));
2047 testDT(DateTime(Date(1, 1, 1), TimeOfDay(13, 30, 33)), -63_165_600L,
2048 DateTime(Date(1, 1, 1), TimeOfDay(13, 30, 33)));
2050 testDT(DateTime(Date(-1, 1, 1), TimeOfDay(11, 30, 33)), 63_165_617L,
2051 DateTime(Date(-1, 1, 1), TimeOfDay(11, 30, 50)));
2052 testDT(DateTime(Date(1, 1, 1), TimeOfDay(13, 30, 50)), -63_165_617L,
2053 DateTime(Date(1, 1, 1), TimeOfDay(13, 30, 33)));
2110 auto dt = DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33));
2112 assert(dt + dur!"weeks"(7) == DateTime(Date(1999, 8, 24), TimeOfDay(12, 30, 33)));
2113 assert(dt + dur!"weeks"(-7) == DateTime(Date(1999, 5, 18), TimeOfDay(12, 30, 33)));
2114 assert(dt + dur!"days"(7) == DateTime(Date(1999, 7, 13), TimeOfDay(12, 30, 33)));
2115 assert(dt + dur!"days"(-7) == DateTime(Date(1999, 6, 29), TimeOfDay(12, 30, 33)));
2117 assert(dt + dur!"hours"(7) == DateTime(Date(1999, 7, 6), TimeOfDay(19, 30, 33)));
2118 assert(dt + dur!"hours"(-7) == DateTime(Date(1999, 7, 6), TimeOfDay(5, 30, 33)));
2119 assert(dt + dur!"minutes"(7) == DateTime(Date(1999, 7, 6), TimeOfDay(12, 37, 33)));
2120 assert(dt + dur!"minutes"(-7) == DateTime(Date(1999, 7, 6), TimeOfDay(12, 23, 33)));
2121 assert(dt + dur!"seconds"(7) == DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 40)));
2122 assert(dt + dur!"seconds"(-7) == DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 26)));
2123 assert(dt + dur!"msecs"(7_000) == DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 40)));
2124 assert(dt + dur!"msecs"(-7_000) == DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 26)));
2125 assert(dt + dur!"usecs"(7_000_000) == DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 40)));
2126 assert(dt + dur!"usecs"(-7_000_000) == DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 26)));
2127 assert(dt + dur!"hnsecs"(70_000_000) == DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 40)));
2128 assert(dt + dur!"hnsecs"(-70_000_000) == DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 26)));
2130 assert(dt - dur!"weeks"(-7) == DateTime(Date(1999, 8, 24), TimeOfDay(12, 30, 33)));
2131 assert(dt - dur!"weeks"(7) == DateTime(Date(1999, 5, 18), TimeOfDay(12, 30, 33)));
2132 assert(dt - dur!"days"(-7) == DateTime(Date(1999, 7, 13), TimeOfDay(12, 30, 33)));
2133 assert(dt - dur!"days"(7) == DateTime(Date(1999, 6, 29), TimeOfDay(12, 30, 33)));
2135 assert(dt - dur!"hours"(-7) == DateTime(Date(1999, 7, 6), TimeOfDay(19, 30, 33)));
2136 assert(dt - dur!"hours"(7) == DateTime(Date(1999, 7, 6), TimeOfDay(5, 30, 33)));
2137 assert(dt - dur!"minutes"(-7) == DateTime(Date(1999, 7, 6), TimeOfDay(12, 37, 33)));
2138 assert(dt - dur!"minutes"(7) == DateTime(Date(1999, 7, 6), TimeOfDay(12, 23, 33)));
2139 assert(dt - dur!"seconds"(-7) == DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 40)));
2140 assert(dt - dur!"seconds"(7) == DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 26)));
2141 assert(dt - dur!"msecs"(-7_000) == DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 40)));
2142 assert(dt - dur!"msecs"(7_000) == DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 26)));
2143 assert(dt - dur!"usecs"(-7_000_000) == DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 40)));
2144 assert(dt - dur!"usecs"(7_000_000) == DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 26)));
2145 assert(dt - dur!"hnsecs"(-70_000_000) == DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 40)));
2146 assert(dt - dur!"hnsecs"(70_000_000) == DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 26)));
2149 const cdt = DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33));
2150 immutable idt = DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33));
2189 assert(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)) + dur!"weeks"(7) ==
2190 DateTime(Date(1999, 8, 24), TimeOfDay(12, 30, 33)));
2191 assert(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)) + dur!"weeks"(-7) ==
2192 DateTime(Date(1999, 5, 18), TimeOfDay(12, 30, 33)));
2193 assert(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)) + dur!"days"(7) ==
2194 DateTime(Date(1999, 7, 13), TimeOfDay(12, 30, 33)));
2195 assert(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)) + dur!"days"(-7) ==
2196 DateTime(Date(1999, 6, 29), TimeOfDay(12, 30, 33)));
2198 assert(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)) + dur!"hours"(7) ==
2199 DateTime(Date(1999, 7, 6), TimeOfDay(19, 30, 33)));
2200 assert(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)) + dur!"hours"(-7) ==
2201 DateTime(Date(1999, 7, 6), TimeOfDay(5, 30, 33)));
2202 assert(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)) + dur!"minutes"(7) ==
2203 DateTime(Date(1999, 7, 6), TimeOfDay(12, 37, 33)));
2204 assert(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)) + dur!"minutes"(-7) ==
2205 DateTime(Date(1999, 7, 6), TimeOfDay(12, 23, 33)));
2206 assert(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)) + dur!"seconds"(7) ==
2207 DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 40)));
2208 assert(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)) + dur!"seconds"(-7) ==
2209 DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 26)));
2210 assert(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)) + dur!"msecs"(7_000) ==
2211 DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 40)));
2212 assert(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)) + dur!"msecs"(-7_000) ==
2213 DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 26)));
2214 assert(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)) + dur!"usecs"(7_000_000) ==
2215 DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 40)));
2216 assert(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)) + dur!"usecs"(-7_000_000) ==
2217 DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 26)));
2218 assert(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)) + dur!"hnsecs"(70_000_000) ==
2219 DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 40)));
2220 assert(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)) + dur!"hnsecs"(-70_000_000) ==
2221 DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 26)));
2223 assert(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)) - dur!"weeks"(-7) ==
2224 DateTime(Date(1999, 8, 24), TimeOfDay(12, 30, 33)));
2225 assert(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)) - dur!"weeks"(7) ==
2226 DateTime(Date(1999, 5, 18), TimeOfDay(12, 30, 33)));
2227 assert(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)) - dur!"days"(-7) ==
2228 DateTime(Date(1999, 7, 13), TimeOfDay(12, 30, 33)));
2229 assert(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)) - dur!"days"(7) ==
2230 DateTime(Date(1999, 6, 29), TimeOfDay(12, 30, 33)));
2232 assert(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)) - dur!"hours"(-7) ==
2233 DateTime(Date(1999, 7, 6), TimeOfDay(19, 30, 33)));
2234 assert(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)) - dur!"hours"(7) ==
2235 DateTime(Date(1999, 7, 6), TimeOfDay(5, 30, 33)));
2236 assert(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)) - dur!"minutes"(-7) ==
2237 DateTime(Date(1999, 7, 6), TimeOfDay(12, 37, 33)));
2238 assert(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)) - dur!"minutes"(7) ==
2239 DateTime(Date(1999, 7, 6), TimeOfDay(12, 23, 33)));
2240 assert(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)) - dur!"seconds"(-7) ==
2241 DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 40)));
2242 assert(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)) - dur!"seconds"(7) ==
2243 DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 26)));
2244 assert(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)) - dur!"msecs"(-7_000) ==
2245 DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 40)));
2246 assert(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)) - dur!"msecs"(7_000) ==
2247 DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 26)));
2248 assert(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)) - dur!"usecs"(-7_000_000) ==
2249 DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 40)));
2250 assert(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)) - dur!"usecs"(7_000_000) ==
2251 DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 26)));
2252 assert(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)) - dur!"hnsecs"(-70_000_000) ==
2253 DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 40)));
2254 assert(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)) - dur!"hnsecs"(70_000_000) ==
2255 DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 26)));
2262 const cdt = DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33));
2263 immutable idt = DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33));
2293 assert(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)) - DateTime(Date(1998, 7, 6), TimeOfDay(12, 30, 33)) ==
2295 assert(DateTime(Date(1998, 7, 6), TimeOfDay(12, 30, 33)) - DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)) ==
2298 assert(DateTime(Date(1999, 8, 6), TimeOfDay(12, 30, 33)) - DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)) ==
2300 assert(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)) - DateTime(Date(1999, 8, 6), TimeOfDay(12, 30, 33)) ==
2303 assert(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)) - DateTime(Date(1999, 7, 5), TimeOfDay(12, 30, 33)) ==
2305 assert(DateTime(Date(1999, 7, 5), TimeOfDay(12, 30, 33)) - DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)) ==
2308 assert(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)) - DateTime(Date(1999, 7, 6), TimeOfDay(11, 30, 33)) ==
2310 assert(DateTime(Date(1999, 7, 6), TimeOfDay(11, 30, 33)) - DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)) ==
2313 assert(DateTime(Date(1999, 7, 6), TimeOfDay(12, 31, 33)) - DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)) ==
2315 assert(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)) - DateTime(Date(1999, 7, 6), TimeOfDay(12, 31, 33)) ==
2318 assert(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 34)) - DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)) ==
2320 assert(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)) - DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 34)) ==
2328 const cdt = DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33));
2329 immutable idt = DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33));
2388 auto dt = DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33));
2389 const cdt = DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33));
2390 immutable idt = DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33));
2415 auto dt = DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33));
2416 const cdt = DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33));
2417 immutable idt = DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33));
2434 auto dt = DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33));
2435 const cdt = DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33));
2436 immutable idt = DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33));
2454 assert(DateTime(Date(1999, 1, 1), TimeOfDay(12, 22, 7)).dayOfYear == 1);
2455 assert(DateTime(Date(1999, 12, 31), TimeOfDay(7, 2, 59)).dayOfYear == 365);
2456 assert(DateTime(Date(2000, 12, 31), TimeOfDay(21, 20, 0)).dayOfYear == 366);
2461 auto dt = DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33));
2462 const cdt = DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33));
2463 immutable idt = DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33));
2484 auto dt = DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33));
2485 const cdt = DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33));
2486 immutable idt = DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33));
2505 assert(DateTime(Date(1, 1, 1), TimeOfDay(0, 0, 0)).dayOfGregorianCal == 1);
2506 assert(DateTime(Date(1, 12, 31), TimeOfDay(23, 59, 59)).dayOfGregorianCal == 365);
2507 assert(DateTime(Date(2, 1, 1), TimeOfDay(2, 2, 2)).dayOfGregorianCal == 366);
2509 assert(DateTime(Date(0, 12, 31), TimeOfDay(7, 7, 7)).dayOfGregorianCal == 0);
2510 assert(DateTime(Date(0, 1, 1), TimeOfDay(19, 30, 0)).dayOfGregorianCal == -365);
2511 assert(DateTime(Date(-1, 12, 31), TimeOfDay(4, 7, 0)).dayOfGregorianCal == -366);
2513 assert(DateTime(Date(2000, 1, 1), TimeOfDay(9, 30, 20)).dayOfGregorianCal == 730_120);
2514 assert(DateTime(Date(2010, 12, 31), TimeOfDay(15, 45, 50)).dayOfGregorianCal == 734_137);
2519 const cdt = DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33));
2520 immutable idt = DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33));
2543 auto dt = DateTime(Date.init, TimeOfDay(12, 0, 0));
2545 assert(dt == DateTime(Date(1, 1, 1), TimeOfDay(12, 0, 0)));
2548 assert(dt == DateTime(Date(1, 12, 31), TimeOfDay(12, 0, 0)));
2551 assert(dt == DateTime(Date(2, 1, 1), TimeOfDay(12, 0, 0)));
2554 assert(dt == DateTime(Date(0, 12, 31), TimeOfDay(12, 0, 0)));
2557 assert(dt == DateTime(Date(-0, 1, 1), TimeOfDay(12, 0, 0)));
2560 assert(dt == DateTime(Date(-1, 12, 31), TimeOfDay(12, 0, 0)));
2563 assert(dt == DateTime(Date(2000, 1, 1), TimeOfDay(12, 0, 0)));
2566 assert(dt == DateTime(Date(2010, 12, 31), TimeOfDay(12, 0, 0)));
2571 const cdt = DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33));
2572 immutable idt = DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33));
2582 $(HTTP en.wikipedia.org/wiki/ISO_week_date, ISO Week Date)
2591 auto dt = DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33));
2592 const cdt = DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33));
2593 immutable idt = DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33));
2616 assert(DateTime(Date(1999, 1, 6), TimeOfDay(0, 0, 0)).endOfMonth ==
2617 DateTime(Date(1999, 1, 31), TimeOfDay(23, 59, 59)));
2619 assert(DateTime(Date(1999, 2, 7), TimeOfDay(19, 30, 0)).endOfMonth ==
2620 DateTime(Date(1999, 2, 28), TimeOfDay(23, 59, 59)));
2622 assert(DateTime(Date(2000, 2, 7), TimeOfDay(5, 12, 27)).endOfMonth ==
2623 DateTime(Date(2000, 2, 29), TimeOfDay(23, 59, 59)));
2625 assert(DateTime(Date(2000, 6, 4), TimeOfDay(12, 22, 9)).endOfMonth ==
2626 DateTime(Date(2000, 6, 30), TimeOfDay(23, 59, 59)));
2661 const cdt = DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33));
2662 immutable idt = DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33));
2679 assert(DateTime(Date(1999, 1, 6), TimeOfDay(0, 0, 0)).daysInMonth == 31);
2680 assert(DateTime(Date(1999, 2, 7), TimeOfDay(19, 30, 0)).daysInMonth == 28);
2681 assert(DateTime(Date(2000, 2, 7), TimeOfDay(5, 12, 27)).daysInMonth == 29);
2682 assert(DateTime(Date(2000, 6, 4), TimeOfDay(12, 22, 9)).daysInMonth == 30);
2687 const cdt = DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33));
2688 immutable idt = DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33));
2705 assert(DateTime(Date(1, 1, 1), TimeOfDay(12, 7, 0)).isAD);
2706 assert(DateTime(Date(2010, 12, 31), TimeOfDay(0, 0, 0)).isAD);
2707 assert(!DateTime(Date(0, 12, 31), TimeOfDay(23, 59, 59)).isAD);
2708 assert(!DateTime(Date(-2010, 1, 1), TimeOfDay(2, 2, 2)).isAD);
2713 const cdt = DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33));
2714 immutable idt = DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33));
2737 assert(DateTime(Date(-4713, 11, 24), TimeOfDay(0, 0, 0)).julianDay == -1);
2738 assert(DateTime(Date(-4713, 11, 24), TimeOfDay(12, 0, 0)).julianDay == 0);
2740 assert(DateTime(Date(0, 12, 31), TimeOfDay(0, 0, 0)).julianDay == 1_721_424);
2741 assert(DateTime(Date(0, 12, 31), TimeOfDay(12, 0, 0)).julianDay == 1_721_425);
2743 assert(DateTime(Date(1, 1, 1), TimeOfDay(0, 0, 0)).julianDay == 1_721_425);
2744 assert(DateTime(Date(1, 1, 1), TimeOfDay(12, 0, 0)).julianDay == 1_721_426);
2746 assert(DateTime(Date(1582, 10, 15), TimeOfDay(0, 0, 0)).julianDay == 2_299_160);
2747 assert(DateTime(Date(1582, 10, 15), TimeOfDay(12, 0, 0)).julianDay == 2_299_161);
2749 assert(DateTime(Date(1858, 11, 17), TimeOfDay(0, 0, 0)).julianDay == 2_400_000);
2750 assert(DateTime(Date(1858, 11, 17), TimeOfDay(12, 0, 0)).julianDay == 2_400_001);
2752 assert(DateTime(Date(1982, 1, 4), TimeOfDay(0, 0, 0)).julianDay == 2_444_973);
2753 assert(DateTime(Date(1982, 1, 4), TimeOfDay(12, 0, 0)).julianDay == 2_444_974);
2755 assert(DateTime(Date(1996, 3, 31), TimeOfDay(0, 0, 0)).julianDay == 2_450_173);
2756 assert(DateTime(Date(1996, 3, 31), TimeOfDay(12, 0, 0)).julianDay == 2_450_174);
2758 assert(DateTime(Date(2010, 8, 24), TimeOfDay(0, 0, 0)).julianDay == 2_455_432);
2759 assert(DateTime(Date(2010, 8, 24), TimeOfDay(12, 0, 0)).julianDay == 2_455_433);
2761 const cdt = DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33));
2762 immutable idt = DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33));
2779 assert(DateTime(Date(1858, 11, 17), TimeOfDay(0, 0, 0)).modJulianDay == 0);
2780 assert(DateTime(Date(1858, 11, 17), TimeOfDay(12, 0, 0)).modJulianDay == 0);
2782 assert(DateTime(Date(2010, 8, 24), TimeOfDay(0, 0, 0)).modJulianDay == 55_432);
2783 assert(DateTime(Date(2010, 8, 24), TimeOfDay(12, 0, 0)).modJulianDay == 55_432);
2785 const cdt = DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33));
2786 immutable idt = DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33));
2816 assert(DateTime(Date(2010, 7, 4), TimeOfDay(7, 6, 12)).toISOString() ==
2819 assert(DateTime(Date(1998, 12, 25), TimeOfDay(2, 15, 0)).toISOString() ==
2822 assert(DateTime(Date(0, 1, 5), TimeOfDay(23, 9, 59)).toISOString() ==
2825 assert(DateTime(Date(-4, 1, 5), TimeOfDay(0, 0, 2)).toISOString() ==
2832 assert(DateTime(Date(9, 12, 4), TimeOfDay(0, 0, 0)).toISOString() == "00091204T000000");
2833 assert(DateTime(Date(99, 12, 4), TimeOfDay(5, 6, 12)).toISOString() == "00991204T050612");
2834 assert(DateTime(Date(999, 12, 4), TimeOfDay(13, 44, 59)).toISOString() == "09991204T134459");
2835 assert(DateTime(Date(9999, 7, 4), TimeOfDay(23, 59, 59)).toISOString() == "99990704T235959");
2836 assert(DateTime(Date(10000, 10, 20), TimeOfDay(1, 1, 1)).toISOString() == "+100001020T010101");
2839 assert(DateTime(Date(0, 12, 4), TimeOfDay(0, 12, 4)).toISOString() == "00001204T001204");
2840 assert(DateTime(Date(-9, 12, 4), TimeOfDay(0, 0, 0)).toISOString() == "-00091204T000000");
2841 assert(DateTime(Date(-99, 12, 4), TimeOfDay(5, 6, 12)).toISOString() == "-00991204T050612");
2842 assert(DateTime(Date(-999, 12, 4), TimeOfDay(13, 44, 59)).toISOString() == "-09991204T134459");
2843 assert(DateTime(Date(-9999, 7, 4), TimeOfDay(23, 59, 59)).toISOString() == "-99990704T235959");
2844 assert(DateTime(Date(-10000, 10, 20), TimeOfDay(1, 1, 1)).toISOString() == "-100001020T010101");
2878 assert(DateTime(Date(2010, 7, 4), TimeOfDay(7, 6, 12)).toISOExtString() ==
2881 assert(DateTime(Date(1998, 12, 25), TimeOfDay(2, 15, 0)).toISOExtString() ==
2884 assert(DateTime(Date(0, 1, 5), TimeOfDay(23, 9, 59)).toISOExtString() ==
2887 assert(DateTime(Date(-4, 1, 5), TimeOfDay(0, 0, 2)).toISOExtString() ==
2894 assert(DateTime(Date(9, 12, 4), TimeOfDay(0, 0, 0)).toISOExtString() == "0009-12-04T00:00:00");
2895 assert(DateTime(Date(99, 12, 4), TimeOfDay(5, 6, 12)).toISOExtString() == "0099-12-04T05:06:12");
2896 assert(DateTime(Date(999, 12, 4), TimeOfDay(13, 44, 59)).toISOExtString() == "0999-12-04T13:44:59");
2897 assert(DateTime(Date(9999, 7, 4), TimeOfDay(23, 59, 59)).toISOExtString() == "9999-07-04T23:59:59");
2898 assert(DateTime(Date(10000, 10, 20), TimeOfDay(1, 1, 1)).toISOExtString() == "+10000-10-20T01:01:01");
2901 assert(DateTime(Date(0, 12, 4), TimeOfDay(0, 12, 4)).toISOExtString() == "0000-12-04T00:12:04");
2902 assert(DateTime(Date(-9, 12, 4), TimeOfDay(0, 0, 0)).toISOExtString() == "-0009-12-04T00:00:00");
2903 assert(DateTime(Date(-99, 12, 4), TimeOfDay(5, 6, 12)).toISOExtString() == "-0099-12-04T05:06:12");
2904 assert(DateTime(Date(-999, 12, 4), TimeOfDay(13, 44, 59)).toISOExtString() == "-0999-12-04T13:44:59");
2905 assert(DateTime(Date(-9999, 7, 4), TimeOfDay(23, 59, 59)).toISOExtString() == "-9999-07-04T23:59:59");
2906 assert(DateTime(Date(-10000, 10, 20), TimeOfDay(1, 1, 1)).toISOExtString() == "-10000-10-20T01:01:01");
2939 assert(DateTime(Date(2010, 7, 4), TimeOfDay(7, 6, 12)).toSimpleString() ==
2942 assert(DateTime(Date(1998, 12, 25), TimeOfDay(2, 15, 0)).toSimpleString() ==
2945 assert(DateTime(Date(0, 1, 5), TimeOfDay(23, 9, 59)).toSimpleString() ==
2948 assert(DateTime(Date(-4, 1, 5), TimeOfDay(0, 0, 2)).toSimpleString() ==
2955 assert(DateTime(Date(9, 12, 4), TimeOfDay(0, 0, 0)).toSimpleString() == "0009-Dec-04 00:00:00");
2956 assert(DateTime(Date(99, 12, 4), TimeOfDay(5, 6, 12)).toSimpleString() == "0099-Dec-04 05:06:12");
2957 assert(DateTime(Date(999, 12, 4), TimeOfDay(13, 44, 59)).toSimpleString() == "0999-Dec-04 13:44:59");
2958 assert(DateTime(Date(9999, 7, 4), TimeOfDay(23, 59, 59)).toSimpleString() == "9999-Jul-04 23:59:59");
2959 assert(DateTime(Date(10000, 10, 20), TimeOfDay(1, 1, 1)).toSimpleString() == "+10000-Oct-20 01:01:01");
2962 assert(DateTime(Date(0, 12, 4), TimeOfDay(0, 12, 4)).toSimpleString() == "0000-Dec-04 00:12:04");
2963 assert(DateTime(Date(-9, 12, 4), TimeOfDay(0, 0, 0)).toSimpleString() == "-0009-Dec-04 00:00:00");
2964 assert(DateTime(Date(-99, 12, 4), TimeOfDay(5, 6, 12)).toSimpleString() == "-0099-Dec-04 05:06:12");
2965 assert(DateTime(Date(-999, 12, 4), TimeOfDay(13, 44, 59)).toSimpleString() == "-0999-Dec-04 13:44:59");
2966 assert(DateTime(Date(-9999, 7, 4), TimeOfDay(23, 59, 59)).toSimpleString() == "-9999-Jul-04 23:59:59");
2967 assert(DateTime(Date(-10000, 10, 20), TimeOfDay(1, 1, 1)).toSimpleString() == "-10000-Oct-20 01:01:01");
3006 auto dt = DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33));
3007 const cdt = DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33));
3008 immutable idt = DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33));
3043 immutable date = Date.fromISOString(str[0 .. t]);
3053 DateTime(Date(2010, 7, 4), TimeOfDay(7, 6, 12)));
3056 DateTime(Date(1998, 12, 25), TimeOfDay(2, 15, 0)));
3059 DateTime(Date(0, 1, 5), TimeOfDay(23, 9, 59)));
3062 DateTime(Date(-4, 1, 5), TimeOfDay(0, 0, 2)));
3065 DateTime(Date(2010, 7, 4), TimeOfDay(7, 6, 12)));
3093 assert(DateTime.fromISOString("20101222T172201") == DateTime(Date(2010, 12, 22), TimeOfDay(17, 22, 01)));
3094 assert(DateTime.fromISOString("19990706T123033") == DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)));
3095 assert(DateTime.fromISOString("-19990706T123033") == DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 33)));
3096 assert(DateTime.fromISOString("+019990706T123033") == DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)));
3097 assert(DateTime.fromISOString("19990706T123033 ") == DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)));
3098 assert(DateTime.fromISOString(" 19990706T123033") == DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)));
3099 assert(DateTime.fromISOString(" 19990706T123033 ") == DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)));
3143 immutable date = Date.fromISOExtString(str[0 .. t]);
3153 DateTime(Date(2010, 7, 4), TimeOfDay(7, 6, 12)));
3156 DateTime(Date(1998, 12, 25), TimeOfDay(2, 15, 0)));
3159 DateTime(Date(0, 1, 5), TimeOfDay(23, 9, 59)));
3162 DateTime(Date(-4, 1, 5), TimeOfDay(0, 0, 2)));
3165 DateTime(Date(2010, 7, 4), TimeOfDay(7, 6, 12)));
3192 assert(DateTime.fromISOExtString("2010-12-22T17:22:01") == DateTime(Date(2010, 12, 22), TimeOfDay(17, 22, 01)));
3193 assert(DateTime.fromISOExtString("1999-07-06T12:30:33") == DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)));
3194 assert(DateTime.fromISOExtString("-1999-07-06T12:30:33") == DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 33)));
3195 assert(DateTime.fromISOExtString("+01999-07-06T12:30:33") == DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)));
3196 assert(DateTime.fromISOExtString("1999-07-06T12:30:33 ") == DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)));
3197 assert(DateTime.fromISOExtString(" 1999-07-06T12:30:33") == DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)));
3198 assert(DateTime.fromISOExtString(" 1999-07-06T12:30:33 ") == DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)));
3242 immutable date = Date.fromSimpleString(str[0 .. t]);
3252 DateTime(Date(2010, 7, 4), TimeOfDay(7, 6, 12)));
3254 DateTime(Date(1998, 12, 25), TimeOfDay(2, 15, 0)));
3256 DateTime(Date(0, 1, 5), TimeOfDay(23, 9, 59)));
3258 DateTime(Date(-4, 1, 5), TimeOfDay(0, 0, 2)));
3260 DateTime(Date(2010, 7, 4), TimeOfDay(7, 6, 12)));
3289 DateTime(Date(2010, 12, 22), TimeOfDay(17, 22, 01)));
3291 DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)));
3293 DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 33)));
3295 DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)));
3297 DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)));
3299 DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)));
3301 DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)));
3324 assert(result._date == Date.min);
3351 assert(result._date == Date.max);
3584 Date _date;
3595 Year, month, and day are kept separately internally so that $(D Date) is
3598 $(D Date) uses the Proleptic Gregorian Calendar, so it assumes the Gregorian
3606 struct Date
3613 $(LREF Date) would not be valid.
3635 assert(Date(1, 1, 1) == Date.init);
3637 static void testDate(in Date date, int year, int month, int day)
3644 testDate(Date(1999, 1 , 1), 1999, Month.jan, 1);
3645 testDate(Date(1999, 7 , 1), 1999, Month.jul, 1);
3646 testDate(Date(1999, 7 , 6), 1999, Month.jul, 6);
3649 assertThrown!DateTimeException(Date(1, 0, 1));
3650 assertThrown!DateTimeException(Date(1, 1, 0));
3651 assertThrown!DateTimeException(Date(1999, 13, 1));
3652 assertThrown!DateTimeException(Date(1999, 1, 32));
3653 assertThrown!DateTimeException(Date(1999, 2, 29));
3654 assertThrown!DateTimeException(Date(2000, 2, 30));
3655 assertThrown!DateTimeException(Date(1999, 3, 32));
3656 assertThrown!DateTimeException(Date(1999, 4, 31));
3657 assertThrown!DateTimeException(Date(1999, 5, 32));
3658 assertThrown!DateTimeException(Date(1999, 6, 31));
3659 assertThrown!DateTimeException(Date(1999, 7, 32));
3660 assertThrown!DateTimeException(Date(1999, 8, 32));
3661 assertThrown!DateTimeException(Date(1999, 9, 31));
3662 assertThrown!DateTimeException(Date(1999, 10, 32));
3663 assertThrown!DateTimeException(Date(1999, 11, 31));
3664 assertThrown!DateTimeException(Date(1999, 12, 32));
3666 assertNotThrown!DateTimeException(Date(1999, 1, 31));
3667 assertNotThrown!DateTimeException(Date(1999, 2, 28));
3668 assertNotThrown!DateTimeException(Date(2000, 2, 29));
3669 assertNotThrown!DateTimeException(Date(1999, 3, 31));
3670 assertNotThrown!DateTimeException(Date(1999, 4, 30));
3671 assertNotThrown!DateTimeException(Date(1999, 5, 31));
3672 assertNotThrown!DateTimeException(Date(1999, 6, 30));
3673 assertNotThrown!DateTimeException(Date(1999, 7, 31));
3674 assertNotThrown!DateTimeException(Date(1999, 8, 31));
3675 assertNotThrown!DateTimeException(Date(1999, 9, 30));
3676 assertNotThrown!DateTimeException(Date(1999, 10, 31));
3677 assertNotThrown!DateTimeException(Date(1999, 11, 30));
3678 assertNotThrown!DateTimeException(Date(1999, 12, 31));
3681 assertNotThrown!DateTimeException(Date(0, 1, 1));
3682 assertNotThrown!DateTimeException(Date(-1, 1, 1));
3683 assertNotThrown!DateTimeException(Date(-1, 12, 31));
3684 assertNotThrown!DateTimeException(Date(-1, 2, 28));
3685 assertNotThrown!DateTimeException(Date(-4, 2, 29));
3687 assertThrown!DateTimeException(Date(-1, 2, 29));
3688 assertThrown!DateTimeException(Date(-2, 2, 29));
3689 assertThrown!DateTimeException(Date(-3, 2, 29));
3696 $(LREF Date) will be for.
3818 assert(Date(gd.day) == gd.date);
3823 Compares this $(LREF Date) with the given $(LREF Date).
3832 int opCmp(in Date rhs) const @safe pure nothrow @nogc
3855 assert(Date(1, 1, 1).opCmp(Date.init) == 0);
3857 assert(Date(1999, 1, 1).opCmp(Date(1999, 1, 1)) == 0);
3858 assert(Date(1, 7, 1).opCmp(Date(1, 7, 1)) == 0);
3859 assert(Date(1, 1, 6).opCmp(Date(1, 1, 6)) == 0);
3861 assert(Date(1999, 7, 1).opCmp(Date(1999, 7, 1)) == 0);
3862 assert(Date(1999, 7, 6).opCmp(Date(1999, 7, 6)) == 0);
3864 assert(Date(1, 7, 6).opCmp(Date(1, 7, 6)) == 0);
3866 assert(Date(1999, 7, 6).opCmp(Date(2000, 7, 6)) < 0);
3867 assert(Date(2000, 7, 6).opCmp(Date(1999, 7, 6)) > 0);
3868 assert(Date(1999, 7, 6).opCmp(Date(1999, 8, 6)) < 0);
3869 assert(Date(1999, 8, 6).opCmp(Date(1999, 7, 6)) > 0);
3870 assert(Date(1999, 7, 6).opCmp(Date(1999, 7, 7)) < 0);
3871 assert(Date(1999, 7, 7).opCmp(Date(1999, 7, 6)) > 0);
3873 assert(Date(1999, 8, 7).opCmp(Date(2000, 7, 6)) < 0);
3874 assert(Date(2000, 8, 6).opCmp(Date(1999, 7, 7)) > 0);
3875 assert(Date(1999, 7, 7).opCmp(Date(2000, 7, 6)) < 0);
3876 assert(Date(2000, 7, 6).opCmp(Date(1999, 7, 7)) > 0);
3877 assert(Date(1999, 7, 7).opCmp(Date(1999, 8, 6)) < 0);
3878 assert(Date(1999, 8, 6).opCmp(Date(1999, 7, 7)) > 0);
3881 assert(Date(0, 1, 1).opCmp(Date(0, 1, 1)) == 0);
3882 assert(Date(-1, 1, 1).opCmp(Date(-1, 1, 1)) == 0);
3883 assert(Date(-1, 7, 1).opCmp(Date(-1, 7, 1)) == 0);
3884 assert(Date(-1, 1, 6).opCmp(Date(-1, 1, 6)) == 0);
3886 assert(Date(-1999, 7, 1).opCmp(Date(-1999, 7, 1)) == 0);
3887 assert(Date(-1999, 7, 6).opCmp(Date(-1999, 7, 6)) == 0);
3889 assert(Date(-1, 7, 6).opCmp(Date(-1, 7, 6)) == 0);
3891 assert(Date(-2000, 7, 6).opCmp(Date(-1999, 7, 6)) < 0);
3892 assert(Date(-1999, 7, 6).opCmp(Date(-2000, 7, 6)) > 0);
3893 assert(Date(-1999, 7, 6).opCmp(Date(-1999, 8, 6)) < 0);
3894 assert(Date(-1999, 8, 6).opCmp(Date(-1999, 7, 6)) > 0);
3895 assert(Date(-1999, 7, 6).opCmp(Date(-1999, 7, 7)) < 0);
3896 assert(Date(-1999, 7, 7).opCmp(Date(-1999, 7, 6)) > 0);
3898 assert(Date(-2000, 8, 6).opCmp(Date(-1999, 7, 7)) < 0);
3899 assert(Date(-1999, 8, 7).opCmp(Date(-2000, 7, 6)) > 0);
3900 assert(Date(-2000, 7, 6).opCmp(Date(-1999, 7, 7)) < 0);
3901 assert(Date(-1999, 7, 7).opCmp(Date(-2000, 7, 6)) > 0);
3902 assert(Date(-1999, 7, 7).opCmp(Date(-1999, 8, 6)) < 0);
3903 assert(Date(-1999, 8, 6).opCmp(Date(-1999, 7, 7)) > 0);
3906 assert(Date(-1999, 7, 6).opCmp(Date(1999, 7, 6)) < 0);
3907 assert(Date(1999, 7, 6).opCmp(Date(-1999, 7, 6)) > 0);
3909 assert(Date(-1999, 8, 6).opCmp(Date(1999, 7, 6)) < 0);
3910 assert(Date(1999, 7, 6).opCmp(Date(-1999, 8, 6)) > 0);
3912 assert(Date(-1999, 7, 7).opCmp(Date(1999, 7, 6)) < 0);
3913 assert(Date(1999, 7, 6).opCmp(Date(-1999, 7, 7)) > 0);
3915 assert(Date(-1999, 8, 7).opCmp(Date(1999, 7, 6)) < 0);
3916 assert(Date(1999, 7, 6).opCmp(Date(-1999, 8, 7)) > 0);
3918 assert(Date(-1999, 8, 6).opCmp(Date(1999, 6, 6)) < 0);
3919 assert(Date(1999, 6, 8).opCmp(Date(-1999, 7, 6)) > 0);
3921 auto date = Date(1999, 7, 6);
3922 const cdate = Date(1999, 7, 6);
3923 immutable idate = Date(1999, 7, 6);
3948 assert(Date(1999, 7, 6).year == 1999);
3949 assert(Date(2010, 10, 4).year == 2010);
3950 assert(Date(-7, 4, 5).year == -7);
3955 assert(Date.init.year == 1);
3956 assert(Date(1999, 7, 6).year == 1999);
3957 assert(Date(-1999, 7, 6).year == -1999);
3959 const cdate = Date(1999, 7, 6);
3960 immutable idate = Date(1999, 7, 6);
3970 year = The year to set this Date's year to.
3985 assert(Date(1999, 7, 6).year == 1999);
3986 assert(Date(2010, 10, 4).year == 2010);
3987 assert(Date(-7, 4, 5).year == -7);
3992 static void testDateInvalid(Date date, int year)
3997 static void testDate(Date date, int year, in Date expected)
4003 assertThrown!DateTimeException(testDateInvalid(Date(4, 2, 29), 1));
4005 testDate(Date(1, 1, 1), 1999, Date(1999, 1, 1));
4006 testDate(Date(1, 1, 1), 0, Date(0, 1, 1));
4007 testDate(Date(1, 1, 1), -1999, Date(-1999, 1, 1));
4009 const cdate = Date(1999, 7, 6);
4010 immutable idate = Date(1999, 7, 6);
4034 assert(Date(0, 1, 1).yearBC == 1);
4035 assert(Date(-1, 1, 1).yearBC == 2);
4036 assert(Date(-100, 1, 1).yearBC == 101);
4041 assertThrown!DateTimeException((in Date date){date.yearBC;}(Date(1, 1, 1)));
4043 auto date = Date(0, 7, 6);
4044 const cdate = Date(0, 7, 6);
4045 immutable idate = Date(0, 7, 6);
4056 year = The year B.C. to set this $(LREF Date)'s year to.
4072 auto date = Date(2010, 1, 1);
4074 assert(date == Date(0, 1, 1));
4077 assert(date == Date(-9, 1, 1));
4082 assertThrown!DateTimeException((Date date){date.yearBC = -1;}(Date(1, 1, 1)));
4084 auto date = Date(0, 7, 6);
4085 const cdate = Date(0, 7, 6);
4086 immutable idate = Date(0, 7, 6);
4105 assert(Date(1999, 7, 6).month == 7);
4106 assert(Date(2010, 10, 4).month == 10);
4107 assert(Date(-7, 4, 5).month == 4);
4112 assert(Date.init.month == 1);
4113 assert(Date(1999, 7, 6).month == 7);
4114 assert(Date(-1999, 7, 6).month == 7);
4116 const cdate = Date(1999, 7, 6);
4117 immutable idate = Date(1999, 7, 6);
4126 month = The month to set this $(LREF Date)'s month to.
4142 static void testDate(Date date, Month month, in Date expected = Date.init)
4145 assert(expected != Date.init);
4149 assertThrown!DateTimeException(testDate(Date(1, 1, 1), cast(Month) 0));
4150 assertThrown!DateTimeException(testDate(Date(1, 1, 1), cast(Month) 13));
4151 assertThrown!DateTimeException(testDate(Date(1, 1, 29), cast(Month) 2));
4152 assertThrown!DateTimeException(testDate(Date(0, 1, 30), cast(Month) 2));
4154 testDate(Date(1, 1, 1), cast(Month) 7, Date(1, 7, 1));
4155 testDate(Date(-1, 1, 1), cast(Month) 7, Date(-1, 7, 1));
4157 const cdate = Date(1999, 7, 6);
4158 immutable idate = Date(1999, 7, 6);
4175 assert(Date(1999, 7, 6).day == 6);
4176 assert(Date(2010, 10, 4).day == 4);
4177 assert(Date(-7, 4, 5).day == 5);
4185 static void test(Date date, int expected)
4193 test(Date(year, md.month, md.day), md.day);
4196 const cdate = Date(1999, 7, 6);
4197 immutable idate = Date(1999, 7, 6);
4206 day = The day of the month to set this $(LREF Date)'s day to.
4222 static void testDate(Date date, int day)
4228 assertThrown!DateTimeException(testDate(Date(1, 1, 1), 0));
4229 assertThrown!DateTimeException(testDate(Date(1, 1, 1), 32));
4230 assertThrown!DateTimeException(testDate(Date(1, 2, 1), 29));
4231 assertThrown!DateTimeException(testDate(Date(4, 2, 1), 30));
4232 assertThrown!DateTimeException(testDate(Date(1, 3, 1), 32));
4233 assertThrown!DateTimeException(testDate(Date(1, 4, 1), 31));
4234 assertThrown!DateTimeException(testDate(Date(1, 5, 1), 32));
4235 assertThrown!DateTimeException(testDate(Date(1, 6, 1), 31));
4236 assertThrown!DateTimeException(testDate(Date(1, 7, 1), 32));
4237 assertThrown!DateTimeException(testDate(Date(1, 8, 1), 32));
4238 assertThrown!DateTimeException(testDate(Date(1, 9, 1), 31));
4239 assertThrown!DateTimeException(testDate(Date(1, 10, 1), 32));
4240 assertThrown!DateTimeException(testDate(Date(1, 11, 1), 31));
4241 assertThrown!DateTimeException(testDate(Date(1, 12, 1), 32));
4243 assertNotThrown!DateTimeException(testDate(Date(1, 1, 1), 31));
4244 assertNotThrown!DateTimeException(testDate(Date(1, 2, 1), 28));
4245 assertNotThrown!DateTimeException(testDate(Date(4, 2, 1), 29));
4246 assertNotThrown!DateTimeException(testDate(Date(1, 3, 1), 31));
4247 assertNotThrown!DateTimeException(testDate(Date(1, 4, 1), 30));
4248 assertNotThrown!DateTimeException(testDate(Date(1, 5, 1), 31));
4249 assertNotThrown!DateTimeException(testDate(Date(1, 6, 1), 30));
4250 assertNotThrown!DateTimeException(testDate(Date(1, 7, 1), 31));
4251 assertNotThrown!DateTimeException(testDate(Date(1, 8, 1), 31));
4252 assertNotThrown!DateTimeException(testDate(Date(1, 9, 1), 30));
4253 assertNotThrown!DateTimeException(testDate(Date(1, 10, 1), 31));
4254 assertNotThrown!DateTimeException(testDate(Date(1, 11, 1), 30));
4255 assertNotThrown!DateTimeException(testDate(Date(1, 12, 1), 31));
4258 auto date = Date(1, 1, 1);
4260 assert(date == Date(1, 1, 6));
4264 assertThrown!DateTimeException(testDate(Date(-1, 1, 1), 0));
4265 assertThrown!DateTimeException(testDate(Date(-1, 1, 1), 32));
4266 assertThrown!DateTimeException(testDate(Date(-1, 2, 1), 29));
4267 assertThrown!DateTimeException(testDate(Date(0, 2, 1), 30));
4268 assertThrown!DateTimeException(testDate(Date(-1, 3, 1), 32));
4269 assertThrown!DateTimeException(testDate(Date(-1, 4, 1), 31));
4270 assertThrown!DateTimeException(testDate(Date(-1, 5, 1), 32));
4271 assertThrown!DateTimeException(testDate(Date(-1, 6, 1), 31));
4272 assertThrown!DateTimeException(testDate(Date(-1, 7, 1), 32));
4273 assertThrown!DateTimeException(testDate(Date(-1, 8, 1), 32));
4274 assertThrown!DateTimeException(testDate(Date(-1, 9, 1), 31));
4275 assertThrown!DateTimeException(testDate(Date(-1, 10, 1), 32));
4276 assertThrown!DateTimeException(testDate(Date(-1, 11, 1), 31));
4277 assertThrown!DateTimeException(testDate(Date(-1, 12, 1), 32));
4279 assertNotThrown!DateTimeException(testDate(Date(-1, 1, 1), 31));
4280 assertNotThrown!DateTimeException(testDate(Date(-1, 2, 1), 28));
4281 assertNotThrown!DateTimeException(testDate(Date(0, 2, 1), 29));
4282 assertNotThrown!DateTimeException(testDate(Date(-1, 3, 1), 31));
4283 assertNotThrown!DateTimeException(testDate(Date(-1, 4, 1), 30));
4284 assertNotThrown!DateTimeException(testDate(Date(-1, 5, 1), 31));
4285 assertNotThrown!DateTimeException(testDate(Date(-1, 6, 1), 30));
4286 assertNotThrown!DateTimeException(testDate(Date(-1, 7, 1), 31));
4287 assertNotThrown!DateTimeException(testDate(Date(-1, 8, 1), 31));
4288 assertNotThrown!DateTimeException(testDate(Date(-1, 9, 1), 30));
4289 assertNotThrown!DateTimeException(testDate(Date(-1, 10, 1), 31));
4290 assertNotThrown!DateTimeException(testDate(Date(-1, 11, 1), 30));
4291 assertNotThrown!DateTimeException(testDate(Date(-1, 12, 1), 31));
4294 auto date = Date(-1, 1, 1);
4296 assert(date == Date(-1, 1, 6));
4299 const cdate = Date(1999, 7, 6);
4300 immutable idate = Date(1999, 7, 6);
4307 Adds the given number of years or months to this $(LREF Date). A
4321 $(LREF Date).
4326 ref Date add(string units)(long value, AllowDayOverflow allowOverflow = AllowDayOverflow.yes)
4348 auto d1 = Date(2010, 1, 1);
4350 assert(d1 == Date(2010, 12, 1));
4352 auto d2 = Date(2010, 1, 1);
4354 assert(d2 == Date(2009, 2, 1));
4356 auto d3 = Date(2000, 2, 29);
4358 assert(d3 == Date(2001, 3, 1));
4360 auto d4 = Date(2000, 2, 29);
4362 assert(d4 == Date(2001, 2, 28));
4370 auto date = Date(1999, 7, 6);
4372 assert(date == Date(2006, 7, 6));
4374 assert(date == Date(1997, 7, 6));
4378 auto date = Date(1999, 2, 28);
4380 assert(date == Date(2000, 2, 28));
4384 auto date = Date(2000, 2, 29);
4386 assert(date == Date(1999, 3, 1));
4391 auto date = Date(-1999, 7, 6);
4393 assert(date == Date(-2006, 7, 6));
4395 assert(date == Date(-1997, 7, 6));
4399 auto date = Date(-1999, 2, 28);
4401 assert(date == Date(-2000, 2, 28));
4405 auto date = Date(-2000, 2, 29);
4407 assert(date == Date(-1999, 3, 1));
4412 auto date = Date(4, 7, 6);
4414 assert(date == Date(-1, 7, 6));
4416 assert(date == Date(4, 7, 6));
4420 auto date = Date(-4, 7, 6);
4422 assert(date == Date(1, 7, 6));
4424 assert(date == Date(-4, 7, 6));
4428 auto date = Date(4, 7, 6);
4430 assert(date == Date(-4, 7, 6));
4432 assert(date == Date(4, 7, 6));
4436 auto date = Date(-4, 7, 6);
4438 assert(date == Date(4, 7, 6));
4440 assert(date == Date(-4, 7, 6));
4444 auto date = Date(-4, 2, 29);
4446 assert(date == Date(1, 3, 1));
4450 auto date = Date(4, 2, 29);
4452 assert(date == Date(-1, 3, 1));
4456 auto date = Date(4, 2, 29);
4458 assert(date == Date(6, 3, 1));
4461 const cdate = Date(1999, 7, 6);
4462 immutable idate = Date(1999, 7, 6);
4472 auto date = Date(1999, 7, 6);
4474 assert(date == Date(2006, 7, 6));
4476 assert(date == Date(1997, 7, 6));
4480 auto date = Date(1999, 2, 28);
4482 assert(date == Date(2000, 2, 28));
4486 auto date = Date(2000, 2, 29);
4488 assert(date == Date(1999, 2, 28));
4493 auto date = Date(-1999, 7, 6);
4495 assert(date == Date(-2006, 7, 6));
4497 assert(date == Date(-1997, 7, 6));
4501 auto date = Date(-1999, 2, 28);
4503 assert(date == Date(-2000, 2, 28));
4507 auto date = Date(-2000, 2, 29);
4509 assert(date == Date(-1999, 2, 28));
4514 auto date = Date(4, 7, 6);
4516 assert(date == Date(-1, 7, 6));
4518 assert(date == Date(4, 7, 6));
4522 auto date = Date(-4, 7, 6);
4524 assert(date == Date(1, 7, 6));
4526 assert(date == Date(-4, 7, 6));
4530 auto date = Date(4, 7, 6);
4532 assert(date == Date(-4, 7, 6));
4534 assert(date == Date(4, 7, 6));
4538 auto date = Date(-4, 7, 6);
4540 assert(date == Date(4, 7, 6));
4542 assert(date == Date(-4, 7, 6));
4546 auto date = Date(-4, 2, 29);
4548 assert(date == Date(1, 2, 28));
4552 auto date = Date(4, 2, 29);
4554 assert(date == Date(-1, 2, 28));
4558 auto date = Date(4, 2, 29);
4560 assert(date == Date(6, 2, 28));
4567 ref Date add(string units)(long months, AllowDayOverflow allowOverflow = AllowDayOverflow.yes)
4613 auto date = Date(1999, 7, 6);
4615 assert(date == Date(1999, 10, 6));
4617 assert(date == Date(1999, 6, 6));
4621 auto date = Date(1999, 7, 6);
4623 assert(date == Date(2000, 1, 6));
4625 assert(date == Date(1999, 7, 6));
4629 auto date = Date(1999, 7, 6);
4631 assert(date == Date(2001, 10, 6));
4633 assert(date == Date(1999, 6, 6));
4637 auto date = Date(1999, 5, 31);
4639 assert(date == Date(1999, 7, 1));
4643 auto date = Date(1999, 5, 31);
4645 assert(date == Date(1999, 5, 1));
4649 auto date = Date(1999, 2, 28);
4651 assert(date == Date(2000, 2, 28));
4655 auto date = Date(2000, 2, 29);
4657 assert(date == Date(2001, 3, 1));
4661 auto date = Date(1999, 7, 31);
4663 assert(date == Date(1999, 8, 31));
4665 assert(date == Date(1999, 10, 1));
4669 auto date = Date(1998, 8, 31);
4671 assert(date == Date(1999, 10, 1));
4673 assert(date == Date(1998, 9, 1));
4677 auto date = Date(1997, 12, 31);
4679 assert(date == Date(1999, 1, 31));
4681 assert(date == Date(1997, 12, 31));
4685 auto date = Date(1997, 12, 31);
4687 assert(date == Date(1999, 3, 3));
4689 assert(date == Date(1998, 1, 3));
4693 auto date = Date(1998, 12, 31);
4695 assert(date == Date(2000, 3, 2));
4697 assert(date == Date(1999, 1, 2));
4701 auto date = Date(1999, 12, 31);
4703 assert(date == Date(2001, 3, 3));
4705 assert(date == Date(2000, 1, 3));
4710 auto date = Date(-1999, 7, 6);
4712 assert(date == Date(-1999, 10, 6));
4714 assert(date == Date(-1999, 6, 6));
4718 auto date = Date(-1999, 7, 6);
4720 assert(date == Date(-1998, 1, 6));
4722 assert(date == Date(-1999, 7, 6));
4726 auto date = Date(-1999, 7, 6);
4728 assert(date == Date(-2001, 4, 6));
4730 assert(date == Date(-1999, 8, 6));
4734 auto date = Date(-1999, 5, 31);
4736 assert(date == Date(-1999, 7, 1));
4740 auto date = Date(-1999, 5, 31);
4742 assert(date == Date(-1999, 5, 1));
4746 auto date = Date(-1999, 2, 28);
4748 assert(date == Date(-2000, 2, 28));
4752 auto date = Date(-2000, 2, 29);
4754 assert(date == Date(-2001, 3, 1));
4758 auto date = Date(-1999, 7, 31);
4760 assert(date == Date(-1999, 8, 31));
4762 assert(date == Date(-1999, 10, 1));
4766 auto date = Date(-1998, 8, 31);
4768 assert(date == Date(-1997, 10, 1));
4770 assert(date == Date(-1998, 9, 1));
4774 auto date = Date(-1997, 12, 31);
4776 assert(date == Date(-1995, 1, 31));
4778 assert(date == Date(-1997, 12, 31));
4782 auto date = Date(-1997, 12, 31);
4784 assert(date == Date(-1995, 3, 3));
4786 assert(date == Date(-1996, 1, 3));
4790 auto date = Date(-2002, 12, 31);
4792 assert(date == Date(-2000, 3, 2));
4794 assert(date == Date(-2001, 1, 2));
4798 auto date = Date(-2001, 12, 31);
4800 assert(date == Date(-1999, 3, 3));
4802 assert(date == Date(-2000, 1, 3));
4807 auto date = Date(1, 1, 1);
4809 assert(date == Date(0, 12, 1));
4811 assert(date == Date(1, 1, 1));
4815 auto date = Date(4, 1, 1);
4817 assert(date == Date(0, 1, 1));
4819 assert(date == Date(4, 1, 1));
4823 auto date = Date(4, 3, 31);
4825 assert(date == Date(0, 3, 2));
4827 assert(date == Date(4, 4, 2));
4831 auto date = Date(4, 3, 31);
4833 assert(date == Date(-3, 3, 3));
4835 assert(date == Date(4, 4, 3));
4839 auto date = Date(-3, 3, 31);
4841 assert(date == Date(-3, 6, 1));
4844 const cdate = Date(1999, 7, 6);
4845 immutable idate = Date(1999, 7, 6);
4855 auto date = Date(1999, 7, 6);
4857 assert(date == Date(1999, 10, 6));
4859 assert(date == Date(1999, 6, 6));
4863 auto date = Date(1999, 7, 6);
4865 assert(date == Date(2000, 1, 6));
4867 assert(date == Date(1999, 7, 6));
4871 auto date = Date(1999, 7, 6);
4873 assert(date == Date(2001, 10, 6));
4875 assert(date == Date(1999, 6, 6));
4879 auto date = Date(1999, 5, 31);
4881 assert(date == Date(1999, 6, 30));
4885 auto date = Date(1999, 5, 31);
4887 assert(date == Date(1999, 4, 30));
4891 auto date = Date(1999, 2, 28);
4893 assert(date == Date(2000, 2, 28));
4897 auto date = Date(2000, 2, 29);
4899 assert(date == Date(2001, 2, 28));
4903 auto date = Date(1999, 7, 31);
4905 assert(date == Date(1999, 8, 31));
4907 assert(date == Date(1999, 9, 30));
4911 auto date = Date(1998, 8, 31);
4913 assert(date == Date(1999, 9, 30));
4915 assert(date == Date(1998, 8, 30));
4919 auto date = Date(1997, 12, 31);
4921 assert(date == Date(1999, 1, 31));
4923 assert(date == Date(1997, 12, 31));
4927 auto date = Date(1997, 12, 31);
4929 assert(date == Date(1999, 2, 28));
4931 assert(date == Date(1997, 12, 28));
4935 auto date = Date(1998, 12, 31);
4937 assert(date == Date(2000, 2, 29));
4939 assert(date == Date(1998, 12, 29));
4943 auto date = Date(1999, 12, 31);
4945 assert(date == Date(2001, 2, 28));
4947 assert(date == Date(1999, 12, 28));
4952 auto date = Date(-1999, 7, 6);
4954 assert(date == Date(-1999, 10, 6));
4956 assert(date == Date(-1999, 6, 6));
4960 auto date = Date(-1999, 7, 6);
4962 assert(date == Date(-1998, 1, 6));
4964 assert(date == Date(-1999, 7, 6));
4968 auto date = Date(-1999, 7, 6);
4970 assert(date == Date(-2001, 4, 6));
4972 assert(date == Date(-1999, 8, 6));
4976 auto date = Date(-1999, 5, 31);
4978 assert(date == Date(-1999, 6, 30));
4982 auto date = Date(-1999, 5, 31);
4984 assert(date == Date(-1999, 4, 30));
4988 auto date = Date(-1999, 2, 28);
4990 assert(date == Date(-2000, 2, 28));
4994 auto date = Date(-2000, 2, 29);
4996 assert(date == Date(-2001, 2, 28));
5000 auto date = Date(-1999, 7, 31);
5002 assert(date == Date(-1999, 8, 31));
5004 assert(date == Date(-1999, 9, 30));
5008 auto date = Date(-1998, 8, 31);
5010 assert(date == Date(-1997, 9, 30));
5012 assert(date == Date(-1998, 8, 30));
5016 auto date = Date(-1997, 12, 31);
5018 assert(date == Date(-1995, 1, 31));
5020 assert(date == Date(-1997, 12, 31));
5024 auto date = Date(-1997, 12, 31);
5026 assert(date == Date(-1995, 2, 28));
5028 assert(date == Date(-1997, 12, 28));
5032 auto date = Date(-2002, 12, 31);
5034 assert(date == Date(-2000, 2, 29));
5036 assert(date == Date(-2002, 12, 29));
5040 auto date = Date(-2001, 12, 31);
5042 assert(date == Date(-1999, 2, 28));
5044 assert(date == Date(-2001, 12, 28));
5049 auto date = Date(1, 1, 1);
5051 assert(date == Date(0, 12, 1));
5053 assert(date == Date(1, 1, 1));
5057 auto date = Date(4, 1, 1);
5059 assert(date == Date(0, 1, 1));
5061 assert(date == Date(4, 1, 1));
5065 auto date = Date(4, 3, 31);
5067 assert(date == Date(0, 2, 29));
5069 assert(date == Date(4, 3, 29));
5073 auto date = Date(4, 3, 31);
5075 assert(date == Date(-3, 2, 28));
5077 assert(date == Date(4, 3, 28));
5081 auto date = Date(-3, 3, 31);
5083 assert(date == Date(-3, 5, 30));
5089 Adds the given number of years or months to this $(LREF Date). A negative
5093 affect larger units. Rolling a $(LREF Date) 12 months gets
5094 the exact same $(LREF Date). However, the days can still be affected due
5103 $(LREF Date).
5108 ref Date roll(string units)(long value, AllowDayOverflow allowOverflow = AllowDayOverflow.yes)
5117 auto d1 = Date(2010, 1, 1);
5119 assert(d1 == Date(2010, 2, 1));
5121 auto d2 = Date(2010, 1, 1);
5123 assert(d2 == Date(2010, 12, 1));
5125 auto d3 = Date(1999, 1, 29);
5127 assert(d3 == Date(1999, 3, 1));
5129 auto d4 = Date(1999, 1, 29);
5131 assert(d4 == Date(1999, 2, 28));
5133 auto d5 = Date(2000, 2, 29);
5135 assert(d5 == Date(2001, 3, 1));
5137 auto d6 = Date(2000, 2, 29);
5139 assert(d6 == Date(2001, 2, 28));
5144 const cdate = Date(1999, 7, 6);
5145 immutable idate = Date(1999, 7, 6);
5153 ref Date roll(string units)(long months, AllowDayOverflow allowOverflow = AllowDayOverflow.yes)
5194 auto date = Date(1999, 7, 6);
5196 assert(date == Date(1999, 10, 6));
5198 assert(date == Date(1999, 6, 6));
5202 auto date = Date(1999, 7, 6);
5204 assert(date == Date(1999, 1, 6));
5206 assert(date == Date(1999, 7, 6));
5210 auto date = Date(1999, 7, 6);
5212 assert(date == Date(1999, 10, 6));
5214 assert(date == Date(1999, 6, 6));
5218 auto date = Date(1999, 5, 31);
5220 assert(date == Date(1999, 7, 1));
5224 auto date = Date(1999, 5, 31);
5226 assert(date == Date(1999, 5, 1));
5230 auto date = Date(1999, 2, 28);
5232 assert(date == Date(1999, 2, 28));
5236 auto date = Date(2000, 2, 29);
5238 assert(date == Date(2000, 2, 29));
5242 auto date = Date(1999, 7, 31);
5244 assert(date == Date(1999, 8, 31));
5246 assert(date == Date(1999, 10, 1));
5250 auto date = Date(1998, 8, 31);
5252 assert(date == Date(1998, 10, 1));
5254 assert(date == Date(1998, 9, 1));
5258 auto date = Date(1997, 12, 31);
5260 assert(date == Date(1997, 1, 31));
5262 assert(date == Date(1997, 12, 31));
5266 auto date = Date(1997, 12, 31);
5268 assert(date == Date(1997, 3, 3));
5270 assert(date == Date(1997, 1, 3));
5274 auto date = Date(1998, 12, 31);
5276 assert(date == Date(1998, 3, 3));
5278 assert(date == Date(1998, 1, 3));
5282 auto date = Date(1999, 12, 31);
5284 assert(date == Date(1999, 3, 3));
5286 assert(date == Date(1999, 1, 3));
5291 auto date = Date(-1999, 7, 6);
5293 assert(date == Date(-1999, 10, 6));
5295 assert(date == Date(-1999, 6, 6));
5299 auto date = Date(-1999, 7, 6);
5301 assert(date == Date(-1999, 1, 6));
5303 assert(date == Date(-1999, 7, 6));
5307 auto date = Date(-1999, 7, 6);
5309 assert(date == Date(-1999, 4, 6));
5311 assert(date == Date(-1999, 8, 6));
5315 auto date = Date(-1999, 5, 31);
5317 assert(date == Date(-1999, 7, 1));
5321 auto date = Date(-1999, 5, 31);
5323 assert(date == Date(-1999, 5, 1));
5327 auto date = Date(-1999, 2, 28);
5329 assert(date == Date(-1999, 2, 28));
5333 auto date = Date(-2000, 2, 29);
5335 assert(date == Date(-2000, 2, 29));
5339 auto date = Date(-1999, 7, 31);
5341 assert(date == Date(-1999, 8, 31));
5343 assert(date == Date(-1999, 10, 1));
5347 auto date = Date(-1998, 8, 31);
5349 assert(date == Date(-1998, 10, 1));
5351 assert(date == Date(-1998, 9, 1));
5355 auto date = Date(-1997, 12, 31);
5357 assert(date == Date(-1997, 1, 31));
5359 assert(date == Date(-1997, 12, 31));
5363 auto date = Date(-1997, 12, 31);
5365 assert(date == Date(-1997, 3, 3));
5367 assert(date == Date(-1997, 1, 3));
5371 auto date = Date(-2002, 12, 31);
5373 assert(date == Date(-2002, 3, 3));
5375 assert(date == Date(-2002, 1, 3));
5379 auto date = Date(-2001, 12, 31);
5381 assert(date == Date(-2001, 3, 3));
5383 assert(date == Date(-2001, 1, 3));
5388 auto date = Date(1, 1, 1);
5390 assert(date == Date(1, 12, 1));
5392 assert(date == Date(1, 1, 1));
5396 auto date = Date(4, 1, 1);
5398 assert(date == Date(4, 1, 1));
5400 assert(date == Date(4, 1, 1));
5404 auto date = Date(4, 3, 31);
5406 assert(date == Date(4, 3, 2));
5408 assert(date == Date(4, 4, 2));
5412 auto date = Date(4, 3, 31);
5414 assert(date == Date(4, 3, 2));
5416 assert(date == Date(4, 4, 2));
5420 auto date = Date(-1, 1, 1);
5422 assert(date == Date(-1, 12, 1));
5424 assert(date == Date(-1, 1, 1));
5428 auto date = Date(-4, 1, 1);
5430 assert(date == Date(-4, 1, 1));
5432 assert(date == Date(-4, 1, 1));
5436 auto date = Date(-4, 3, 31);
5438 assert(date == Date(-4, 3, 2));
5440 assert(date == Date(-4, 4, 2));
5444 auto date = Date(-4, 3, 31);
5446 assert(date == Date(-4, 3, 2));
5448 assert(date == Date(-4, 4, 2));
5452 auto date = Date(-3, 3, 31);
5454 assert(date == Date(-3, 6, 1));
5457 const cdate = Date(1999, 7, 6);
5458 immutable idate = Date(1999, 7, 6);
5468 auto date = Date(1999, 7, 6);
5470 assert(date == Date(1999, 10, 6));
5472 assert(date == Date(1999, 6, 6));
5476 auto date = Date(1999, 7, 6);
5478 assert(date == Date(1999, 1, 6));
5480 assert(date == Date(1999, 7, 6));
5484 auto date = Date(1999, 7, 6);
5486 assert(date == Date(1999, 10, 6));
5488 assert(date == Date(1999, 6, 6));
5492 auto date = Date(1999, 5, 31);
5494 assert(date == Date(1999, 6, 30));
5498 auto date = Date(1999, 5, 31);
5500 assert(date == Date(1999, 4, 30));
5504 auto date = Date(1999, 2, 28);
5506 assert(date == Date(1999, 2, 28));
5510 auto date = Date(2000, 2, 29);
5512 assert(date == Date(2000, 2, 29));
5516 auto date = Date(1999, 7, 31);
5518 assert(date == Date(1999, 8, 31));
5520 assert(date == Date(1999, 9, 30));
5524 auto date = Date(1998, 8, 31);
5526 assert(date == Date(1998, 9, 30));
5528 assert(date == Date(1998, 8, 30));
5532 auto date = Date(1997, 12, 31);
5534 assert(date == Date(1997, 1, 31));
5536 assert(date == Date(1997, 12, 31));
5540 auto date = Date(1997, 12, 31);
5542 assert(date == Date(1997, 2, 28));
5544 assert(date == Date(1997, 12, 28));
5548 auto date = Date(1998, 12, 31);
5550 assert(date == Date(1998, 2, 28));
5552 assert(date == Date(1998, 12, 28));
5556 auto date = Date(1999, 12, 31);
5558 assert(date == Date(1999, 2, 28));
5560 assert(date == Date(1999, 12, 28));
5565 auto date = Date(-1999, 7, 6);
5567 assert(date == Date(-1999, 10, 6));
5569 assert(date == Date(-1999, 6, 6));
5573 auto date = Date(-1999, 7, 6);
5575 assert(date == Date(-1999, 1, 6));
5577 assert(date == Date(-1999, 7, 6));
5581 auto date = Date(-1999, 7, 6);
5583 assert(date == Date(-1999, 4, 6));
5585 assert(date == Date(-1999, 8, 6));
5589 auto date = Date(-1999, 5, 31);
5591 assert(date == Date(-1999, 6, 30));
5595 auto date = Date(-1999, 5, 31);
5597 assert(date == Date(-1999, 4, 30));
5601 auto date = Date(-1999, 2, 28);
5603 assert(date == Date(-1999, 2, 28));
5607 auto date = Date(-2000, 2, 29);
5609 assert(date == Date(-2000, 2, 29));
5613 auto date = Date(-1999, 7, 31);
5615 assert(date == Date(-1999, 8, 31));
5617 assert(date == Date(-1999, 9, 30));
5621 auto date = Date(-1998, 8, 31);
5623 assert(date == Date(-1998, 9, 30));
5625 assert(date == Date(-1998, 8, 30));
5629 auto date = Date(-1997, 12, 31);
5631 assert(date == Date(-1997, 1, 31));
5633 assert(date == Date(-1997, 12, 31));
5637 auto date = Date(-1997, 12, 31);
5639 assert(date == Date(-1997, 2, 28));
5641 assert(date == Date(-1997, 12, 28));
5645 auto date = Date(-2002, 12, 31);
5647 assert(date == Date(-2002, 2, 28));
5649 assert(date == Date(-2002, 12, 28));
5653 auto date = Date(-2001, 12, 31);
5655 assert(date == Date(-2001, 2, 28));
5657 assert(date == Date(-2001, 12, 28));
5662 auto date = Date(1, 1, 1);
5664 assert(date == Date(1, 12, 1));
5666 assert(date == Date(1, 1, 1));
5670 auto date = Date(4, 1, 1);
5672 assert(date == Date(4, 1, 1));
5674 assert(date == Date(4, 1, 1));
5678 auto date = Date(4, 3, 31);
5680 assert(date == Date(4, 2, 29));
5682 assert(date == Date(4, 3, 29));
5686 auto date = Date(4, 3, 31);
5688 assert(date == Date(4, 2, 29));
5690 assert(date == Date(4, 3, 29));
5694 auto date = Date(-1, 1, 1);
5696 assert(date == Date(-1, 12, 1));
5698 assert(date == Date(-1, 1, 1));
5702 auto date = Date(-4, 1, 1);
5704 assert(date == Date(-4, 1, 1));
5706 assert(date == Date(-4, 1, 1));
5710 auto date = Date(-4, 3, 31);
5712 assert(date == Date(-4, 2, 29));
5714 assert(date == Date(-4, 3, 29));
5718 auto date = Date(-4, 3, 31);
5720 assert(date == Date(-4, 2, 29));
5722 assert(date == Date(-4, 3, 29));
5726 auto date = Date(-3, 3, 31);
5728 assert(date == Date(-3, 5, 30));
5734 Adds the given number of units to this $(LREF Date). A negative number
5738 affect larger units. For instance, rolling a $(LREF Date) one
5739 year's worth of days gets the exact same $(LREF Date).
5745 days = The number of days to add to this $(LREF Date).
5747 ref Date roll(string units)(long days) @safe pure nothrow @nogc
5769 auto d = Date(2010, 1, 1);
5771 assert(d == Date(2010, 1, 2));
5773 assert(d == Date(2010, 1, 26));
5775 assert(d == Date(2010, 1, 25));
5782 auto date = Date(1999, 2, 28);
5784 assert(date == Date(1999, 2, 1));
5786 assert(date == Date(1999, 2, 28));
5790 auto date = Date(2000, 2, 28);
5792 assert(date == Date(2000, 2, 29));
5794 assert(date == Date(2000, 2, 1));
5796 assert(date == Date(2000, 2, 29));
5800 auto date = Date(1999, 6, 30);
5802 assert(date == Date(1999, 6, 1));
5804 assert(date == Date(1999, 6, 30));
5808 auto date = Date(1999, 7, 31);
5810 assert(date == Date(1999, 7, 1));
5812 assert(date == Date(1999, 7, 31));
5816 auto date = Date(1999, 1, 1);
5818 assert(date == Date(1999, 1, 31));
5820 assert(date == Date(1999, 1, 1));
5824 auto date = Date(1999, 7, 6);
5826 assert(date == Date(1999, 7, 15));
5828 assert(date == Date(1999, 7, 4));
5830 assert(date == Date(1999, 7, 3));
5832 assert(date == Date(1999, 7, 31));
5836 auto date = Date(1999, 7, 6);
5838 assert(date == Date(1999, 7, 30));
5840 assert(date == Date(1999, 7, 6));
5842 assert(date == Date(1999, 7, 31));
5844 assert(date == Date(1999, 7, 17));
5846 assert(date == Date(1999, 7, 6));
5850 auto date = Date(1999, 2, 6);
5852 assert(date == Date(1999, 2, 7));
5854 assert(date == Date(1999, 2, 6));
5856 assert(date == Date(1999, 2, 8));
5858 assert(date == Date(1999, 2, 10));
5860 assert(date == Date(1999, 2, 6));
5865 auto date = Date(-1999, 2, 28);
5867 assert(date == Date(-1999, 2, 1));
5869 assert(date == Date(-1999, 2, 28));
5873 auto date = Date(-2000, 2, 28);
5875 assert(date == Date(-2000, 2, 29));
5877 assert(date == Date(-2000, 2, 1));
5879 assert(date == Date(-2000, 2, 29));
5883 auto date = Date(-1999, 6, 30);
5885 assert(date == Date(-1999, 6, 1));
5887 assert(date == Date(-1999, 6, 30));
5891 auto date = Date(-1999, 7, 31);
5893 assert(date == Date(-1999, 7, 1));
5895 assert(date == Date(-1999, 7, 31));
5899 auto date = Date(-1999, 1, 1);
5901 assert(date == Date(-1999, 1, 31));
5903 assert(date == Date(-1999, 1, 1));
5907 auto date = Date(-1999, 7, 6);
5909 assert(date == Date(-1999, 7, 15));
5911 assert(date == Date(-1999, 7, 4));
5913 assert(date == Date(-1999, 7, 3));
5915 assert(date == Date(-1999, 7, 31));
5919 auto date = Date(-1999, 7, 6);
5921 assert(date == Date(-1999, 7, 30));
5923 assert(date == Date(-1999, 7, 6));
5925 assert(date == Date(-1999, 7, 31));
5927 assert(date == Date(-1999, 7, 17));
5929 assert(date == Date(-1999, 7, 6));
5934 auto date = Date(1, 7, 6);
5936 assert(date == Date(1, 7, 13));
5938 assert(date == Date(1, 7, 6));
5940 assert(date == Date(1, 7, 19));
5942 assert(date == Date(1, 7, 5));
5946 auto date = Date(0, 7, 6);
5948 assert(date == Date(0, 7, 13));
5950 assert(date == Date(0, 7, 6));
5952 assert(date == Date(0, 7, 19));
5954 assert(date == Date(0, 7, 5));
5958 auto date = Date(0, 7, 6);
5960 assert(date == Date(0, 7, 8));
5963 const cdate = Date(1999, 7, 6);
5964 immutable idate = Date(1999, 7, 6);
5974 The legal types of arithmetic for $(LREF Date) using this operator are
5977 $(TR $(TD Date) $(TD +) $(TD Duration) $(TD -->) $(TD Date))
5978 $(TR $(TD Date) $(TD -) $(TD Duration) $(TD -->) $(TD Date))
5983 this $(LREF Date).
5985 Date opBinary(string op)(Duration duration) const @safe pure nothrow @nogc
5988 Date retval = this;
5998 assert(Date(2015, 12, 31) + days(1) == Date(2016, 1, 1));
5999 assert(Date(2004, 2, 26) + days(4) == Date(2004, 3, 1));
6001 assert(Date(2016, 1, 1) - days(1) == Date(2015, 12, 31));
6002 assert(Date(2004, 3, 1) - days(4) == Date(2004, 2, 26));
6007 auto date = Date(1999, 7, 6);
6009 assert(date + dur!"weeks"(7) == Date(1999, 8, 24));
6010 assert(date + dur!"weeks"(-7) == Date(1999, 5, 18));
6011 assert(date + dur!"days"(7) == Date(1999, 7, 13));
6012 assert(date + dur!"days"(-7) == Date(1999, 6, 29));
6014 assert(date + dur!"hours"(24) == Date(1999, 7, 7));
6015 assert(date + dur!"hours"(-24) == Date(1999, 7, 5));
6016 assert(date + dur!"minutes"(1440) == Date(1999, 7, 7));
6017 assert(date + dur!"minutes"(-1440) == Date(1999, 7, 5));
6018 assert(date + dur!"seconds"(86_400) == Date(1999, 7, 7));
6019 assert(date + dur!"seconds"(-86_400) == Date(1999, 7, 5));
6020 assert(date + dur!"msecs"(86_400_000) == Date(1999, 7, 7));
6021 assert(date + dur!"msecs"(-86_400_000) == Date(1999, 7, 5));
6022 assert(date + dur!"usecs"(86_400_000_000) == Date(1999, 7, 7));
6023 assert(date + dur!"usecs"(-86_400_000_000) == Date(1999, 7, 5));
6024 assert(date + dur!"hnsecs"(864_000_000_000) == Date(1999, 7, 7));
6025 assert(date + dur!"hnsecs"(-864_000_000_000) == Date(1999, 7, 5));
6027 assert(date - dur!"weeks"(-7) == Date(1999, 8, 24));
6028 assert(date - dur!"weeks"(7) == Date(1999, 5, 18));
6029 assert(date - dur!"days"(-7) == Date(1999, 7, 13));
6030 assert(date - dur!"days"(7) == Date(1999, 6, 29));
6032 assert(date - dur!"hours"(-24) == Date(1999, 7, 7));
6033 assert(date - dur!"hours"(24) == Date(1999, 7, 5));
6034 assert(date - dur!"minutes"(-1440) == Date(1999, 7, 7));
6035 assert(date - dur!"minutes"(1440) == Date(1999, 7, 5));
6036 assert(date - dur!"seconds"(-86_400) == Date(1999, 7, 7));
6037 assert(date - dur!"seconds"(86_400) == Date(1999, 7, 5));
6038 assert(date - dur!"msecs"(-86_400_000) == Date(1999, 7, 7));
6039 assert(date - dur!"msecs"(86_400_000) == Date(1999, 7, 5));
6040 assert(date - dur!"usecs"(-86_400_000_000) == Date(1999, 7, 7));
6041 assert(date - dur!"usecs"(86_400_000_000) == Date(1999, 7, 5));
6042 assert(date - dur!"hnsecs"(-864_000_000_000) == Date(1999, 7, 7));
6043 assert(date - dur!"hnsecs"(864_000_000_000) == Date(1999, 7, 5));
6046 const cdate = Date(1999, 7, 6);
6047 immutable idate = Date(1999, 7, 6);
6048 assert(date + duration == Date(1999, 7, 18));
6049 assert(cdate + duration == Date(1999, 7, 18));
6050 assert(idate + duration == Date(1999, 7, 18));
6052 assert(date - duration == Date(1999, 6, 24));
6053 assert(cdate - duration == Date(1999, 6, 24));
6054 assert(idate - duration == Date(1999, 6, 24));
6060 from this $(LREF Date), as well as assigning the result to this
6061 $(LREF Date).
6063 The legal types of arithmetic for $(LREF Date) using this operator are
6066 $(TR $(TD Date) $(TD +) $(TD Duration) $(TD -->) $(TD Date))
6067 $(TR $(TD Date) $(TD -) $(TD Duration) $(TD -->) $(TD Date))
6072 this $(LREF Date).
6074 ref Date opOpAssign(string op)(Duration duration) @safe pure nothrow @nogc
6083 assert(Date(1999, 7, 6) + dur!"weeks"(7) == Date(1999, 8, 24));
6084 assert(Date(1999, 7, 6) + dur!"weeks"(-7) == Date(1999, 5, 18));
6085 assert(Date(1999, 7, 6) + dur!"days"(7) == Date(1999, 7, 13));
6086 assert(Date(1999, 7, 6) + dur!"days"(-7) == Date(1999, 6, 29));
6088 assert(Date(1999, 7, 6) + dur!"hours"(24) == Date(1999, 7, 7));
6089 assert(Date(1999, 7, 6) + dur!"hours"(-24) == Date(1999, 7, 5));
6090 assert(Date(1999, 7, 6) + dur!"minutes"(1440) == Date(1999, 7, 7));
6091 assert(Date(1999, 7, 6) + dur!"minutes"(-1440) == Date(1999, 7, 5));
6092 assert(Date(1999, 7, 6) + dur!"seconds"(86_400) == Date(1999, 7, 7));
6093 assert(Date(1999, 7, 6) + dur!"seconds"(-86_400) == Date(1999, 7, 5));
6094 assert(Date(1999, 7, 6) + dur!"msecs"(86_400_000) == Date(1999, 7, 7));
6095 assert(Date(1999, 7, 6) + dur!"msecs"(-86_400_000) == Date(1999, 7, 5));
6096 assert(Date(1999, 7, 6) + dur!"usecs"(86_400_000_000) == Date(1999, 7, 7));
6097 assert(Date(1999, 7, 6) + dur!"usecs"(-86_400_000_000) == Date(1999, 7, 5));
6098 assert(Date(1999, 7, 6) + dur!"hnsecs"(864_000_000_000) == Date(1999, 7, 7));
6099 assert(Date(1999, 7, 6) + dur!"hnsecs"(-864_000_000_000) == Date(1999, 7, 5));
6101 assert(Date(1999, 7, 6) - dur!"weeks"(-7) == Date(1999, 8, 24));
6102 assert(Date(1999, 7, 6) - dur!"weeks"(7) == Date(1999, 5, 18));
6103 assert(Date(1999, 7, 6) - dur!"days"(-7) == Date(1999, 7, 13));
6104 assert(Date(1999, 7, 6) - dur!"days"(7) == Date(1999, 6, 29));
6106 assert(Date(1999, 7, 6) - dur!"hours"(-24) == Date(1999, 7, 7));
6107 assert(Date(1999, 7, 6) - dur!"hours"(24) == Date(1999, 7, 5));
6108 assert(Date(1999, 7, 6) - dur!"minutes"(-1440) == Date(1999, 7, 7));
6109 assert(Date(1999, 7, 6) - dur!"minutes"(1440) == Date(1999, 7, 5));
6110 assert(Date(1999, 7, 6) - dur!"seconds"(-86_400) == Date(1999, 7, 7));
6111 assert(Date(1999, 7, 6) - dur!"seconds"(86_400) == Date(1999, 7, 5));
6112 assert(Date(1999, 7, 6) - dur!"msecs"(-86_400_000) == Date(1999, 7, 7));
6113 assert(Date(1999, 7, 6) - dur!"msecs"(86_400_000) == Date(1999, 7, 5));
6114 assert(Date(1999, 7, 6) - dur!"usecs"(-86_400_000_000) == Date(1999, 7, 7));
6115 assert(Date(1999, 7, 6) - dur!"usecs"(86_400_000_000) == Date(1999, 7, 5));
6116 assert(Date(1999, 7, 6) - dur!"hnsecs"(-864_000_000_000) == Date(1999, 7, 7));
6117 assert(Date(1999, 7, 6) - dur!"hnsecs"(864_000_000_000) == Date(1999, 7, 5));
6120 auto date = Date(0, 1, 31);
6122 assert(date == Date(1, 6, 19));
6126 auto date = Date(1999, 7, 6);
6127 const cdate = Date(1999, 7, 6);
6128 immutable idate = Date(1999, 7, 6);
6140 Gives the difference between two $(LREF Date)s.
6142 The legal types of arithmetic for $(LREF Date) using this operator are
6145 $(TR $(TD Date) $(TD -) $(TD Date) $(TD -->) $(TD duration))
6148 Duration opBinary(string op)(in Date rhs) const @safe pure nothrow @nogc
6156 auto date = Date(1999, 7, 6);
6158 assert(Date(1999, 7, 6) - Date(1998, 7, 6) == dur!"days"(365));
6159 assert(Date(1998, 7, 6) - Date(1999, 7, 6) == dur!"days"(-365));
6160 assert(Date(1999, 6, 6) - Date(1999, 5, 6) == dur!"days"(31));
6161 assert(Date(1999, 5, 6) - Date(1999, 6, 6) == dur!"days"(-31));
6162 assert(Date(1999, 1, 1) - Date(1998, 12, 31) == dur!"days"(1));
6163 assert(Date(1998, 12, 31) - Date(1999, 1, 1) == dur!"days"(-1));
6165 const cdate = Date(1999, 7, 6);
6166 immutable idate = Date(1999, 7, 6);
6182 Returns the difference between the two $(LREF Date)s in months.
6185 of two $(LREF Date)s. To get the difference in days or weeks,
6186 subtract the $(LREF Date)s themselves and use the
6194 either $(LREF Date) is is irrelevant. It is the difference in the month
6200 rhs = The $(LREF Date) to subtract from this one.
6202 int diffMonths(in Date rhs) const @safe pure nothrow @nogc
6213 assert(Date(1999, 2, 1).diffMonths(Date(1999, 1, 31)) == 1);
6214 assert(Date(1999, 1, 31).diffMonths(Date(1999, 2, 1)) == -1);
6215 assert(Date(1999, 3, 1).diffMonths(Date(1999, 1, 1)) == 2);
6216 assert(Date(1999, 1, 1).diffMonths(Date(1999, 3, 31)) == -2);
6221 auto date = Date(1999, 7, 6);
6224 assert(date.diffMonths(Date(1998, 6, 5)) == 13);
6225 assert(date.diffMonths(Date(1998, 7, 5)) == 12);
6226 assert(date.diffMonths(Date(1998, 8, 5)) == 11);
6227 assert(date.diffMonths(Date(1998, 9, 5)) == 10);
6228 assert(date.diffMonths(Date(1998, 10, 5)) == 9);
6229 assert(date.diffMonths(Date(1998, 11, 5)) == 8);
6230 assert(date.diffMonths(Date(1998, 12, 5)) == 7);
6231 assert(date.diffMonths(Date(1999, 1, 5)) == 6);
6232 assert(date.diffMonths(Date(1999, 2, 6)) == 5);
6233 assert(date.diffMonths(Date(1999, 3, 6)) == 4);
6234 assert(date.diffMonths(Date(1999, 4, 6)) == 3);
6235 assert(date.diffMonths(Date(1999, 5, 6)) == 2);
6236 assert(date.diffMonths(Date(1999, 6, 6)) == 1);
6238 assert(date.diffMonths(Date(1999, 8, 6)) == -1);
6239 assert(date.diffMonths(Date(1999, 9, 6)) == -2);
6240 assert(date.diffMonths(Date(1999, 10, 6)) == -3);
6241 assert(date.diffMonths(Date(1999, 11, 6)) == -4);
6242 assert(date.diffMonths(Date(1999, 12, 6)) == -5);
6243 assert(date.diffMonths(Date(2000, 1, 6)) == -6);
6244 assert(date.diffMonths(Date(2000, 2, 6)) == -7);
6245 assert(date.diffMonths(Date(2000, 3, 6)) == -8);
6246 assert(date.diffMonths(Date(2000, 4, 6)) == -9);
6247 assert(date.diffMonths(Date(2000, 5, 6)) == -10);
6248 assert(date.diffMonths(Date(2000, 6, 6)) == -11);
6249 assert(date.diffMonths(Date(2000, 7, 6)) == -12);
6250 assert(date.diffMonths(Date(2000, 8, 6)) == -13);
6252 assert(Date(1998, 6, 5).diffMonths(date) == -13);
6253 assert(Date(1998, 7, 5).diffMonths(date) == -12);
6254 assert(Date(1998, 8, 5).diffMonths(date) == -11);
6255 assert(Date(1998, 9, 5).diffMonths(date) == -10);
6256 assert(Date(1998, 10, 5).diffMonths(date) == -9);
6257 assert(Date(1998, 11, 5).diffMonths(date) == -8);
6258 assert(Date(1998, 12, 5).diffMonths(date) == -7);
6259 assert(Date(1999, 1, 5).diffMonths(date) == -6);
6260 assert(Date(1999, 2, 6).diffMonths(date) == -5);
6261 assert(Date(1999, 3, 6).diffMonths(date) == -4);
6262 assert(Date(1999, 4, 6).diffMonths(date) == -3);
6263 assert(Date(1999, 5, 6).diffMonths(date) == -2);
6264 assert(Date(1999, 6, 6).diffMonths(date) == -1);
6265 assert(Date(1999, 8, 6).diffMonths(date) == 1);
6266 assert(Date(1999, 9, 6).diffMonths(date) == 2);
6267 assert(Date(1999, 10, 6).diffMonths(date) == 3);
6268 assert(Date(1999, 11, 6).diffMonths(date) == 4);
6269 assert(Date(1999, 12, 6).diffMonths(date) == 5);
6270 assert(Date(2000, 1, 6).diffMonths(date) == 6);
6271 assert(Date(2000, 2, 6).diffMonths(date) == 7);
6272 assert(Date(2000, 3, 6).diffMonths(date) == 8);
6273 assert(Date(2000, 4, 6).diffMonths(date) == 9);
6274 assert(Date(2000, 5, 6).diffMonths(date) == 10);
6275 assert(Date(2000, 6, 6).diffMonths(date) == 11);
6276 assert(Date(2000, 7, 6).diffMonths(date) == 12);
6277 assert(Date(2000, 8, 6).diffMonths(date) == 13);
6279 assert(date.diffMonths(Date(1999, 6, 30)) == 1);
6280 assert(date.diffMonths(Date(1999, 7, 1)) == 0);
6281 assert(date.diffMonths(Date(1999, 7, 6)) == 0);
6282 assert(date.diffMonths(Date(1999, 7, 11)) == 0);
6283 assert(date.diffMonths(Date(1999, 7, 16)) == 0);
6284 assert(date.diffMonths(Date(1999, 7, 21)) == 0);
6285 assert(date.diffMonths(Date(1999, 7, 26)) == 0);
6286 assert(date.diffMonths(Date(1999, 7, 31)) == 0);
6287 assert(date.diffMonths(Date(1999, 8, 1)) == -1);
6289 assert(date.diffMonths(Date(1990, 6, 30)) == 109);
6290 assert(date.diffMonths(Date(1990, 7, 1)) == 108);
6291 assert(date.diffMonths(Date(1990, 7, 6)) == 108);
6292 assert(date.diffMonths(Date(1990, 7, 11)) == 108);
6293 assert(date.diffMonths(Date(1990, 7, 16)) == 108);
6294 assert(date.diffMonths(Date(1990, 7, 21)) == 108);
6295 assert(date.diffMonths(Date(1990, 7, 26)) == 108);
6296 assert(date.diffMonths(Date(1990, 7, 31)) == 108);
6297 assert(date.diffMonths(Date(1990, 8, 1)) == 107);
6299 assert(Date(1999, 6, 30).diffMonths(date) == -1);
6300 assert(Date(1999, 7, 1).diffMonths(date) == 0);
6301 assert(Date(1999, 7, 6).diffMonths(date) == 0);
6302 assert(Date(1999, 7, 11).diffMonths(date) == 0);
6303 assert(Date(1999, 7, 16).diffMonths(date) == 0);
6304 assert(Date(1999, 7, 21).diffMonths(date) == 0);
6305 assert(Date(1999, 7, 26).diffMonths(date) == 0);
6306 assert(Date(1999, 7, 31).diffMonths(date) == 0);
6307 assert(Date(1999, 8, 1).diffMonths(date) == 1);
6309 assert(Date(1990, 6, 30).diffMonths(date) == -109);
6310 assert(Date(1990, 7, 1).diffMonths(date) == -108);
6311 assert(Date(1990, 7, 6).diffMonths(date) == -108);
6312 assert(Date(1990, 7, 11).diffMonths(date) == -108);
6313 assert(Date(1990, 7, 16).diffMonths(date) == -108);
6314 assert(Date(1990, 7, 21).diffMonths(date) == -108);
6315 assert(Date(1990, 7, 26).diffMonths(date) == -108);
6316 assert(Date(1990, 7, 31).diffMonths(date) == -108);
6317 assert(Date(1990, 8, 1).diffMonths(date) == -107);
6320 auto dateBC = Date(-1999, 7, 6);
6322 assert(dateBC.diffMonths(Date(-2000, 6, 5)) == 13);
6323 assert(dateBC.diffMonths(Date(-2000, 7, 5)) == 12);
6324 assert(dateBC.diffMonths(Date(-2000, 8, 5)) == 11);
6325 assert(dateBC.diffMonths(Date(-2000, 9, 5)) == 10);
6326 assert(dateBC.diffMonths(Date(-2000, 10, 5)) == 9);
6327 assert(dateBC.diffMonths(Date(-2000, 11, 5)) == 8);
6328 assert(dateBC.diffMonths(Date(-2000, 12, 5)) == 7);
6329 assert(dateBC.diffMonths(Date(-1999, 1, 5)) == 6);
6330 assert(dateBC.diffMonths(Date(-1999, 2, 6)) == 5);
6331 assert(dateBC.diffMonths(Date(-1999, 3, 6)) == 4);
6332 assert(dateBC.diffMonths(Date(-1999, 4, 6)) == 3);
6333 assert(dateBC.diffMonths(Date(-1999, 5, 6)) == 2);
6334 assert(dateBC.diffMonths(Date(-1999, 6, 6)) == 1);
6336 assert(dateBC.diffMonths(Date(-1999, 8, 6)) == -1);
6337 assert(dateBC.diffMonths(Date(-1999, 9, 6)) == -2);
6338 assert(dateBC.diffMonths(Date(-1999, 10, 6)) == -3);
6339 assert(dateBC.diffMonths(Date(-1999, 11, 6)) == -4);
6340 assert(dateBC.diffMonths(Date(-1999, 12, 6)) == -5);
6341 assert(dateBC.diffMonths(Date(-1998, 1, 6)) == -6);
6342 assert(dateBC.diffMonths(Date(-1998, 2, 6)) == -7);
6343 assert(dateBC.diffMonths(Date(-1998, 3, 6)) == -8);
6344 assert(dateBC.diffMonths(Date(-1998, 4, 6)) == -9);
6345 assert(dateBC.diffMonths(Date(-1998, 5, 6)) == -10);
6346 assert(dateBC.diffMonths(Date(-1998, 6, 6)) == -11);
6347 assert(dateBC.diffMonths(Date(-1998, 7, 6)) == -12);
6348 assert(dateBC.diffMonths(Date(-1998, 8, 6)) == -13);
6350 assert(Date(-2000, 6, 5).diffMonths(dateBC) == -13);
6351 assert(Date(-2000, 7, 5).diffMonths(dateBC) == -12);
6352 assert(Date(-2000, 8, 5).diffMonths(dateBC) == -11);
6353 assert(Date(-2000, 9, 5).diffMonths(dateBC) == -10);
6354 assert(Date(-2000, 10, 5).diffMonths(dateBC) == -9);
6355 assert(Date(-2000, 11, 5).diffMonths(dateBC) == -8);
6356 assert(Date(-2000, 12, 5).diffMonths(dateBC) == -7);
6357 assert(Date(-1999, 1, 5).diffMonths(dateBC) == -6);
6358 assert(Date(-1999, 2, 6).diffMonths(dateBC) == -5);
6359 assert(Date(-1999, 3, 6).diffMonths(dateBC) == -4);
6360 assert(Date(-1999, 4, 6).diffMonths(dateBC) == -3);
6361 assert(Date(-1999, 5, 6).diffMonths(dateBC) == -2);
6362 assert(Date(-1999, 6, 6).diffMonths(dateBC) == -1);
6363 assert(Date(-1999, 8, 6).diffMonths(dateBC) == 1);
6364 assert(Date(-1999, 9, 6).diffMonths(dateBC) == 2);
6365 assert(Date(-1999, 10, 6).diffMonths(dateBC) == 3);
6366 assert(Date(-1999, 11, 6).diffMonths(dateBC) == 4);
6367 assert(Date(-1999, 12, 6).diffMonths(dateBC) == 5);
6368 assert(Date(-1998, 1, 6).diffMonths(dateBC) == 6);
6369 assert(Date(-1998, 2, 6).diffMonths(dateBC) == 7);
6370 assert(Date(-1998, 3, 6).diffMonths(dateBC) == 8);
6371 assert(Date(-1998, 4, 6).diffMonths(dateBC) == 9);
6372 assert(Date(-1998, 5, 6).diffMonths(dateBC) == 10);
6373 assert(Date(-1998, 6, 6).diffMonths(dateBC) == 11);
6374 assert(Date(-1998, 7, 6).diffMonths(dateBC) == 12);
6375 assert(Date(-1998, 8, 6).diffMonths(dateBC) == 13);
6377 assert(dateBC.diffMonths(Date(-1999, 6, 30)) == 1);
6378 assert(dateBC.diffMonths(Date(-1999, 7, 1)) == 0);
6379 assert(dateBC.diffMonths(Date(-1999, 7, 6)) == 0);
6380 assert(dateBC.diffMonths(Date(-1999, 7, 11)) == 0);
6381 assert(dateBC.diffMonths(Date(-1999, 7, 16)) == 0);
6382 assert(dateBC.diffMonths(Date(-1999, 7, 21)) == 0);
6383 assert(dateBC.diffMonths(Date(-1999, 7, 26)) == 0);
6384 assert(dateBC.diffMonths(Date(-1999, 7, 31)) == 0);
6385 assert(dateBC.diffMonths(Date(-1999, 8, 1)) == -1);
6387 assert(dateBC.diffMonths(Date(-2008, 6, 30)) == 109);
6388 assert(dateBC.diffMonths(Date(-2008, 7, 1)) == 108);
6389 assert(dateBC.diffMonths(Date(-2008, 7, 6)) == 108);
6390 assert(dateBC.diffMonths(Date(-2008, 7, 11)) == 108);
6391 assert(dateBC.diffMonths(Date(-2008, 7, 16)) == 108);
6392 assert(dateBC.diffMonths(Date(-2008, 7, 21)) == 108);
6393 assert(dateBC.diffMonths(Date(-2008, 7, 26)) == 108);
6394 assert(dateBC.diffMonths(Date(-2008, 7, 31)) == 108);
6395 assert(dateBC.diffMonths(Date(-2008, 8, 1)) == 107);
6397 assert(Date(-1999, 6, 30).diffMonths(dateBC) == -1);
6398 assert(Date(-1999, 7, 1).diffMonths(dateBC) == 0);
6399 assert(Date(-1999, 7, 6).diffMonths(dateBC) == 0);
6400 assert(Date(-1999, 7, 11).diffMonths(dateBC) == 0);
6401 assert(Date(-1999, 7, 16).diffMonths(dateBC) == 0);
6402 assert(Date(-1999, 7, 21).diffMonths(dateBC) == 0);
6403 assert(Date(-1999, 7, 26).diffMonths(dateBC) == 0);
6404 assert(Date(-1999, 7, 31).diffMonths(dateBC) == 0);
6405 assert(Date(-1999, 8, 1).diffMonths(dateBC) == 1);
6407 assert(Date(-2008, 6, 30).diffMonths(dateBC) == -109);
6408 assert(Date(-2008, 7, 1).diffMonths(dateBC) == -108);
6409 assert(Date(-2008, 7, 6).diffMonths(dateBC) == -108);
6410 assert(Date(-2008, 7, 11).diffMonths(dateBC) == -108);
6411 assert(Date(-2008, 7, 16).diffMonths(dateBC) == -108);
6412 assert(Date(-2008, 7, 21).diffMonths(dateBC) == -108);
6413 assert(Date(-2008, 7, 26).diffMonths(dateBC) == -108);
6414 assert(Date(-2008, 7, 31).diffMonths(dateBC) == -108);
6415 assert(Date(-2008, 8, 1).diffMonths(dateBC) == -107);
6418 assert(Date(3, 3, 3).diffMonths(Date(-5, 5, 5)) == 94);
6419 assert(Date(-5, 5, 5).diffMonths(Date(3, 3, 3)) == -94);
6421 const cdate = Date(1999, 7, 6);
6422 immutable idate = Date(1999, 7, 6);
6438 Whether this $(LREF Date) is in a leap year.
6447 auto date = Date(1999, 7, 6);
6448 const cdate = Date(1999, 7, 6);
6449 immutable idate = Date(1999, 7, 6);
6457 Day of the week this $(LREF Date) is on.
6466 const cdate = Date(1999, 7, 6);
6467 immutable idate = Date(1999, 7, 6);
6476 Day of the year this $(LREF Date) is on.
6493 assert(Date(1999, 1, 1).dayOfYear == 1);
6494 assert(Date(1999, 12, 31).dayOfYear == 365);
6495 assert(Date(2000, 12, 31).dayOfYear == 366);
6506 assert(Date(year, doy.md.month, doy.md.day).dayOfYear == doy.day);
6512 assert(Date(year, doy.md.month, doy.md.day).dayOfYear == doy.day);
6515 const cdate = Date(1999, 7, 6);
6516 immutable idate = Date(1999, 7, 6);
6526 $(LREF Date) is on.
6567 static void test(Date date, int day, MonthDay expected, size_t line = __LINE__)
6576 test(Date(1999, 1, 1), doy.day, doy.md);
6577 test(Date(-1, 1, 1), doy.day, doy.md);
6582 test(Date(2000, 1, 1), doy.day, doy.md);
6583 test(Date(-4, 1, 1), doy.day, doy.md);
6586 const cdate = Date(1999, 7, 6);
6587 immutable idate = Date(1999, 7, 6);
6594 The Xth day of the Gregorian Calendar that this $(LREF Date) is on.
6652 assert(Date(1, 1, 1).dayOfGregorianCal == 1);
6653 assert(Date(1, 12, 31).dayOfGregorianCal == 365);
6654 assert(Date(2, 1, 1).dayOfGregorianCal == 366);
6656 assert(Date(0, 12, 31).dayOfGregorianCal == 0);
6657 assert(Date(0, 1, 1).dayOfGregorianCal == -365);
6658 assert(Date(-1, 12, 31).dayOfGregorianCal == -366);
6660 assert(Date(2000, 1, 1).dayOfGregorianCal == 730_120);
6661 assert(Date(2010, 12, 31).dayOfGregorianCal == 734_137);
6671 auto date = Date(1999, 7, 6);
6672 const cdate = Date(1999, 7, 6);
6673 immutable idate = Date(1999, 7, 6);
6680 The Xth day of the Gregorian Calendar that this $(LREF Date) is on.
6683 day = The day of the Gregorian Calendar to set this $(LREF Date) to.
6687 this = Date(day);
6693 auto date = Date.init;
6695 assert(date == Date(1, 1, 1));
6698 assert(date == Date(1, 12, 31));
6701 assert(date == Date(2, 1, 1));
6704 assert(date == Date(0, 12, 31));
6707 assert(date == Date(-0, 1, 1));
6710 assert(date == Date(-1, 12, 31));
6713 assert(date == Date(2000, 1, 1));
6716 assert(date == Date(2010, 12, 31));
6721 auto date = Date(1999, 7, 6);
6722 const cdate = Date(1999, 7, 6);
6723 immutable idate = Date(1999, 7, 6);
6732 The ISO 8601 week of the year that this $(LREF Date) is in.
6735 $(HTTP en.wikipedia.org/wiki/ISO_week_date, ISO Week Date)
6747 switch (Date(_year + 1, 1, 1).dayOfWeek)
6765 return Date(_year - 1, 12, 31).isoWeek;
6768 assert(0, "Date's constructor threw.");
6774 assert(Date(2009, 12, 28).isoWeek == 53);
6775 assert(Date(2009, 12, 29).isoWeek == 53);
6776 assert(Date(2009, 12, 30).isoWeek == 53);
6777 assert(Date(2009, 12, 31).isoWeek == 53);
6778 assert(Date(2010, 1, 1).isoWeek == 53);
6779 assert(Date(2010, 1, 2).isoWeek == 53);
6780 assert(Date(2010, 1, 3).isoWeek == 53);
6781 assert(Date(2010, 1, 4).isoWeek == 1);
6782 assert(Date(2010, 1, 5).isoWeek == 1);
6783 assert(Date(2010, 1, 6).isoWeek == 1);
6784 assert(Date(2010, 1, 7).isoWeek == 1);
6785 assert(Date(2010, 1, 8).isoWeek == 1);
6786 assert(Date(2010, 1, 9).isoWeek == 1);
6787 assert(Date(2010, 1, 10).isoWeek == 1);
6788 assert(Date(2010, 1, 11).isoWeek == 2);
6789 assert(Date(2010, 12, 31).isoWeek == 52);
6791 assert(Date(2004, 12, 26).isoWeek == 52);
6792 assert(Date(2004, 12, 27).isoWeek == 53);
6793 assert(Date(2004, 12, 28).isoWeek == 53);
6794 assert(Date(2004, 12, 29).isoWeek == 53);
6795 assert(Date(2004, 12, 30).isoWeek == 53);
6796 assert(Date(2004, 12, 31).isoWeek == 53);
6797 assert(Date(2005, 1, 1).isoWeek == 53);
6798 assert(Date(2005, 1, 2).isoWeek == 53);
6800 assert(Date(2005, 12, 31).isoWeek == 52);
6801 assert(Date(2007, 1, 1).isoWeek == 1);
6803 assert(Date(2007, 12, 30).isoWeek == 52);
6804 assert(Date(2007, 12, 31).isoWeek == 1);
6805 assert(Date(2008, 1, 1).isoWeek == 1);
6807 assert(Date(2008, 12, 28).isoWeek == 52);
6808 assert(Date(2008, 12, 29).isoWeek == 1);
6809 assert(Date(2008, 12, 30).isoWeek == 1);
6810 assert(Date(2008, 12, 31).isoWeek == 1);
6811 assert(Date(2009, 1, 1).isoWeek == 1);
6812 assert(Date(2009, 1, 2).isoWeek == 1);
6813 assert(Date(2009, 1, 3).isoWeek == 1);
6814 assert(Date(2009, 1, 4).isoWeek == 1);
6820 assert(Date(0, 12, 31).isoWeek == 52);
6821 assert(Date(0, 1, 4).isoWeek == 1);
6822 assert(Date(0, 1, 1).isoWeek == 52);
6824 const cdate = Date(1999, 7, 6);
6825 immutable idate = Date(1999, 7, 6);
6834 $(LREF Date) for the last day in the month that this $(LREF Date) is in.
6836 @property Date endOfMonth() const @safe pure nothrow
6839 return Date(_year, _month, maxDay(_year, _month));
6841 assert(0, "Date's constructor threw.");
6847 assert(Date(1999, 1, 6).endOfMonth == Date(1999, 1, 31));
6848 assert(Date(1999, 2, 7).endOfMonth == Date(1999, 2, 28));
6849 assert(Date(2000, 2, 7).endOfMonth == Date(2000, 2, 29));
6850 assert(Date(2000, 6, 4).endOfMonth == Date(2000, 6, 30));
6856 assert(Date(1999, 1, 1).endOfMonth == Date(1999, 1, 31));
6857 assert(Date(1999, 2, 1).endOfMonth == Date(1999, 2, 28));
6858 assert(Date(2000, 2, 1).endOfMonth == Date(2000, 2, 29));
6859 assert(Date(1999, 3, 1).endOfMonth == Date(1999, 3, 31));
6860 assert(Date(1999, 4, 1).endOfMonth == Date(1999, 4, 30));
6861 assert(Date(1999, 5, 1).endOfMonth == Date(1999, 5, 31));
6862 assert(Date(1999, 6, 1).endOfMonth == Date(1999, 6, 30));
6863 assert(Date(1999, 7, 1).endOfMonth == Date(1999, 7, 31));
6864 assert(Date(1999, 8, 1).endOfMonth == Date(1999, 8, 31));
6865 assert(Date(1999, 9, 1).endOfMonth == Date(1999, 9, 30));
6866 assert(Date(1999, 10, 1).endOfMonth == Date(1999, 10, 31));
6867 assert(Date(1999, 11, 1).endOfMonth == Date(1999, 11, 30));
6868 assert(Date(1999, 12, 1).endOfMonth == Date(1999, 12, 31));
6871 assert(Date(-1999, 1, 1).endOfMonth == Date(-1999, 1, 31));
6872 assert(Date(-1999, 2, 1).endOfMonth == Date(-1999, 2, 28));
6873 assert(Date(-2000, 2, 1).endOfMonth == Date(-2000, 2, 29));
6874 assert(Date(-1999, 3, 1).endOfMonth == Date(-1999, 3, 31));
6875 assert(Date(-1999, 4, 1).endOfMonth == Date(-1999, 4, 30));
6876 assert(Date(-1999, 5, 1).endOfMonth == Date(-1999, 5, 31));
6877 assert(Date(-1999, 6, 1).endOfMonth == Date(-1999, 6, 30));
6878 assert(Date(-1999, 7, 1).endOfMonth == Date(-1999, 7, 31));
6879 assert(Date(-1999, 8, 1).endOfMonth == Date(-1999, 8, 31));
6880 assert(Date(-1999, 9, 1).endOfMonth == Date(-1999, 9, 30));
6881 assert(Date(-1999, 10, 1).endOfMonth == Date(-1999, 10, 31));
6882 assert(Date(-1999, 11, 1).endOfMonth == Date(-1999, 11, 30));
6883 assert(Date(-1999, 12, 1).endOfMonth == Date(-1999, 12, 31));
6885 const cdate = Date(1999, 7, 6);
6886 immutable idate = Date(1999, 7, 6);
6887 static assert(!__traits(compiles, cdate.endOfMonth = Date(1999, 7, 30)));
6888 static assert(!__traits(compiles, idate.endOfMonth = Date(1999, 7, 30)));
6893 The last day in the month that this $(LREF Date) is in.
6903 assert(Date(1999, 1, 6).daysInMonth == 31);
6904 assert(Date(1999, 2, 7).daysInMonth == 28);
6905 assert(Date(2000, 2, 7).daysInMonth == 29);
6906 assert(Date(2000, 6, 4).daysInMonth == 30);
6912 assert(Date(1999, 1, 1).daysInMonth == 31);
6913 assert(Date(1999, 2, 1).daysInMonth == 28);
6914 assert(Date(2000, 2, 1).daysInMonth == 29);
6915 assert(Date(1999, 3, 1).daysInMonth == 31);
6916 assert(Date(1999, 4, 1).daysInMonth == 30);
6917 assert(Date(1999, 5, 1).daysInMonth == 31);
6918 assert(Date(1999, 6, 1).daysInMonth == 30);
6919 assert(Date(1999, 7, 1).daysInMonth == 31);
6920 assert(Date(1999, 8, 1).daysInMonth == 31);
6921 assert(Date(1999, 9, 1).daysInMonth == 30);
6922 assert(Date(1999, 10, 1).daysInMonth == 31);
6923 assert(Date(1999, 11, 1).daysInMonth == 30);
6924 assert(Date(1999, 12, 1).daysInMonth == 31);
6927 assert(Date(-1999, 1, 1).daysInMonth == 31);
6928 assert(Date(-1999, 2, 1).daysInMonth == 28);
6929 assert(Date(-2000, 2, 1).daysInMonth == 29);
6930 assert(Date(-1999, 3, 1).daysInMonth == 31);
6931 assert(Date(-1999, 4, 1).daysInMonth == 30);
6932 assert(Date(-1999, 5, 1).daysInMonth == 31);
6933 assert(Date(-1999, 6, 1).daysInMonth == 30);
6934 assert(Date(-1999, 7, 1).daysInMonth == 31);
6935 assert(Date(-1999, 8, 1).daysInMonth == 31);
6936 assert(Date(-1999, 9, 1).daysInMonth == 30);
6937 assert(Date(-1999, 10, 1).daysInMonth == 31);
6938 assert(Date(-1999, 11, 1).daysInMonth == 30);
6939 assert(Date(-1999, 12, 1).daysInMonth == 31);
6941 const cdate = Date(1999, 7, 6);
6942 immutable idate = Date(1999, 7, 6);
6959 assert(Date(1, 1, 1).isAD);
6960 assert(Date(2010, 12, 31).isAD);
6961 assert(!Date(0, 12, 31).isAD);
6962 assert(!Date(-2010, 1, 1).isAD);
6967 assert(Date(2010, 7, 4).isAD);
6968 assert(Date(1, 1, 1).isAD);
6969 assert(!Date(0, 1, 1).isAD);
6970 assert(!Date(-1, 1, 1).isAD);
6971 assert(!Date(-2010, 7, 4).isAD);
6973 const cdate = Date(1999, 7, 6);
6974 immutable idate = Date(1999, 7, 6);
6982 $(LREF Date) at noon (since the Julian day changes at noon).
6991 assert(Date(-4713, 11, 24).julianDay == 0);
6992 assert(Date(0, 12, 31).julianDay == 1_721_425);
6993 assert(Date(1, 1, 1).julianDay == 1_721_426);
6994 assert(Date(1582, 10, 15).julianDay == 2_299_161);
6995 assert(Date(1858, 11, 17).julianDay == 2_400_001);
6996 assert(Date(1982, 1, 4).julianDay == 2_444_974);
6997 assert(Date(1996, 3, 31).julianDay == 2_450_174);
6998 assert(Date(2010, 8, 24).julianDay == 2_455_433);
7000 const cdate = Date(1999, 7, 6);
7001 immutable idate = Date(1999, 7, 6);
7019 assert(Date(1858, 11, 17).modJulianDay == 0);
7020 assert(Date(2010, 8, 24).modJulianDay == 55_432);
7022 const cdate = Date(1999, 7, 6);
7023 immutable idate = Date(1999, 7, 6);
7030 Converts this $(LREF Date) to a string with the format YYYYMMDD.
7056 assert(Date(2010, 7, 4).toISOString() == "20100704");
7057 assert(Date(1998, 12, 25).toISOString() == "19981225");
7058 assert(Date(0, 1, 5).toISOString() == "00000105");
7059 assert(Date(-4, 1, 5).toISOString() == "-00040105");
7065 assert(Date(9, 12, 4).toISOString() == "00091204");
7066 assert(Date(99, 12, 4).toISOString() == "00991204");
7067 assert(Date(999, 12, 4).toISOString() == "09991204");
7068 assert(Date(9999, 7, 4).toISOString() == "99990704");
7069 assert(Date(10000, 10, 20).toISOString() == "+100001020");
7072 assert(Date(0, 12, 4).toISOString() == "00001204");
7073 assert(Date(-9, 12, 4).toISOString() == "-00091204");
7074 assert(Date(-99, 12, 4).toISOString() == "-00991204");
7075 assert(Date(-999, 12, 4).toISOString() == "-09991204");
7076 assert(Date(-9999, 7, 4).toISOString() == "-99990704");
7077 assert(Date(-10000, 10, 20).toISOString() == "-100001020");
7079 const cdate = Date(1999, 7, 6);
7080 immutable idate = Date(1999, 7, 6);
7086 Converts this $(LREF Date) to a string with the format YYYY-MM-DD.
7112 assert(Date(2010, 7, 4).toISOExtString() == "2010-07-04");
7113 assert(Date(1998, 12, 25).toISOExtString() == "1998-12-25");
7114 assert(Date(0, 1, 5).toISOExtString() == "0000-01-05");
7115 assert(Date(-4, 1, 5).toISOExtString() == "-0004-01-05");
7121 assert(Date(9, 12, 4).toISOExtString() == "0009-12-04");
7122 assert(Date(99, 12, 4).toISOExtString() == "0099-12-04");
7123 assert(Date(999, 12, 4).toISOExtString() == "0999-12-04");
7124 assert(Date(9999, 7, 4).toISOExtString() == "9999-07-04");
7125 assert(Date(10000, 10, 20).toISOExtString() == "+10000-10-20");
7128 assert(Date(0, 12, 4).toISOExtString() == "0000-12-04");
7129 assert(Date(-9, 12, 4).toISOExtString() == "-0009-12-04");
7130 assert(Date(-99, 12, 4).toISOExtString() == "-0099-12-04");
7131 assert(Date(-999, 12, 4).toISOExtString() == "-0999-12-04");
7132 assert(Date(-9999, 7, 4).toISOExtString() == "-9999-07-04");
7133 assert(Date(-10000, 10, 20).toISOExtString() == "-10000-10-20");
7135 const cdate = Date(1999, 7, 6);
7136 immutable idate = Date(1999, 7, 6);
7142 Converts this $(LREF Date) to a string with the format YYYY-Mon-DD.
7168 assert(Date(2010, 7, 4).toSimpleString() == "2010-Jul-04");
7169 assert(Date(1998, 12, 25).toSimpleString() == "1998-Dec-25");
7170 assert(Date(0, 1, 5).toSimpleString() == "0000-Jan-05");
7171 assert(Date(-4, 1, 5).toSimpleString() == "-0004-Jan-05");
7177 assert(Date(9, 12, 4).toSimpleString() == "0009-Dec-04");
7178 assert(Date(99, 12, 4).toSimpleString() == "0099-Dec-04");
7179 assert(Date(999, 12, 4).toSimpleString() == "0999-Dec-04");
7180 assert(Date(9999, 7, 4).toSimpleString() == "9999-Jul-04");
7181 assert(Date(10000, 10, 20).toSimpleString() == "+10000-Oct-20");
7184 assert(Date(0, 12, 4).toSimpleString() == "0000-Dec-04");
7185 assert(Date(-9, 12, 4).toSimpleString() == "-0009-Dec-04");
7186 assert(Date(-99, 12, 4).toSimpleString() == "-0099-Dec-04");
7187 assert(Date(-999, 12, 4).toSimpleString() == "-0999-Dec-04");
7188 assert(Date(-9999, 7, 4).toSimpleString() == "-9999-Jul-04");
7189 assert(Date(-10000, 10, 20).toSimpleString() == "-10000-Oct-20");
7191 const cdate = Date(1999, 7, 6);
7192 immutable idate = Date(1999, 7, 6);
7199 Converts this $(LREF Date) to a string.
7201 This function exists to make it easy to convert a $(LREF Date) to a
7204 simply convert a $(LREF Date) to a string when using functions such as
7216 $(LREF Date) has no `fromString` function, whereas it does have
7228 auto date = Date(1999, 7, 6);
7229 const cdate = Date(1999, 7, 6);
7230 immutable idate = Date(1999, 7, 6);
7238 Creates a $(LREF Date) from a string with the format YYYYMMDD. Whitespace
7246 not in the ISO format or if the resulting $(LREF Date) would not be
7249 static Date fromISOString(S)(in S isoString) @safe pure
7287 return Date(year, month, day);
7293 assert(Date.fromISOString("20100704") == Date(2010, 7, 4));
7294 assert(Date.fromISOString("19981225") == Date(1998, 12, 25));
7295 assert(Date.fromISOString("00000105") == Date(0, 1, 5));
7296 assert(Date.fromISOString("-00040105") == Date(-4, 1, 5));
7297 assert(Date.fromISOString(" 20100704 ") == Date(2010, 7, 4));
7302 assertThrown!DateTimeException(Date.fromISOString(""));
7303 assertThrown!DateTimeException(Date.fromISOString("990704"));
7304 assertThrown!DateTimeException(Date.fromISOString("0100704"));
7305 assertThrown!DateTimeException(Date.fromISOString("2010070"));
7306 assertThrown!DateTimeException(Date.fromISOString("2010070 "));
7307 assertThrown!DateTimeException(Date.fromISOString("120100704"));
7308 assertThrown!DateTimeException(Date.fromISOString("-0100704"));
7309 assertThrown!DateTimeException(Date.fromISOString("+0100704"));
7310 assertThrown!DateTimeException(Date.fromISOString("2010070a"));
7311 assertThrown!DateTimeException(Date.fromISOString("20100a04"));
7312 assertThrown!DateTimeException(Date.fromISOString("2010a704"));
7314 assertThrown!DateTimeException(Date.fromISOString("99-07-04"));
7315 assertThrown!DateTimeException(Date.fromISOString("010-07-04"));
7316 assertThrown!DateTimeException(Date.fromISOString("2010-07-0"));
7317 assertThrown!DateTimeException(Date.fromISOString("2010-07-0 "));
7318 assertThrown!DateTimeException(Date.fromISOString("12010-07-04"));
7319 assertThrown!DateTimeException(Date.fromISOString("-010-07-04"));
7320 assertThrown!DateTimeException(Date.fromISOString("+010-07-04"));
7321 assertThrown!DateTimeException(Date.fromISOString("2010-07-0a"));
7322 assertThrown!DateTimeException(Date.fromISOString("2010-0a-04"));
7323 assertThrown!DateTimeException(Date.fromISOString("2010-a7-04"));
7324 assertThrown!DateTimeException(Date.fromISOString("2010/07/04"));
7325 assertThrown!DateTimeException(Date.fromISOString("2010/7/04"));
7326 assertThrown!DateTimeException(Date.fromISOString("2010/7/4"));
7327 assertThrown!DateTimeException(Date.fromISOString("2010/07/4"));
7328 assertThrown!DateTimeException(Date.fromISOString("2010-7-04"));
7329 assertThrown!DateTimeException(Date.fromISOString("2010-7-4"));
7330 assertThrown!DateTimeException(Date.fromISOString("2010-07-4"));
7332 assertThrown!DateTimeException(Date.fromISOString("99Jul04"));
7333 assertThrown!DateTimeException(Date.fromISOString("010Jul04"));
7334 assertThrown!DateTimeException(Date.fromISOString("2010Jul0"));
7335 assertThrown!DateTimeException(Date.fromISOString("2010Jul0 "));
7336 assertThrown!DateTimeException(Date.fromISOString("12010Jul04"));
7337 assertThrown!DateTimeException(Date.fromISOString("-010Jul04"));
7338 assertThrown!DateTimeException(Date.fromISOString("+010Jul04"));
7339 assertThrown!DateTimeException(Date.fromISOString("2010Jul0a"));
7340 assertThrown!DateTimeException(Date.fromISOString("2010Jua04"));
7341 assertThrown!DateTimeException(Date.fromISOString("2010aul04"));
7343 assertThrown!DateTimeException(Date.fromISOString("99-Jul-04"));
7344 assertThrown!DateTimeException(Date.fromISOString("010-Jul-04"));
7345 assertThrown!DateTimeException(Date.fromISOString("2010-Jul-0"));
7346 assertThrown!DateTimeException(Date.fromISOString("2010-Jul-0 "));
7347 assertThrown!DateTimeException(Date.fromISOString("12010-Jul-04"));
7348 assertThrown!DateTimeException(Date.fromISOString("-010-Jul-04"));
7349 assertThrown!DateTimeException(Date.fromISOString("+010-Jul-04"));
7350 assertThrown!DateTimeException(Date.fromISOString("2010-Jul-0a"));
7351 assertThrown!DateTimeException(Date.fromISOString("2010-Jua-04"));
7352 assertThrown!DateTimeException(Date.fromISOString("2010-Jal-04"));
7353 assertThrown!DateTimeException(Date.fromISOString("2010-aul-04"));
7355 assertThrown!DateTimeException(Date.fromISOString("2010-07-04"));
7356 assertThrown!DateTimeException(Date.fromISOString("2010-Jul-04"));
7358 assert(Date.fromISOString("19990706") == Date(1999, 7, 6));
7359 assert(Date.fromISOString("-19990706") == Date(-1999, 7, 6));
7360 assert(Date.fromISOString("+019990706") == Date(1999, 7, 6));
7361 assert(Date.fromISOString("19990706 ") == Date(1999, 7, 6));
7362 assert(Date.fromISOString(" 19990706") == Date(1999, 7, 6));
7363 assert(Date.fromISOString(" 19990706 ") == Date(1999, 7, 6));
7374 assert(Date.fromISOString(to!S("20121221")) == Date(2012, 12, 21));
7380 Creates a $(LREF Date) from a string with the format YYYY-MM-DD.
7389 not in the ISO Extended format or if the resulting $(LREF Date)
7392 static Date fromISOExtString(S)(in S isoExtString) @safe pure
7428 return Date(to!short(year), to!ubyte(month), to!ubyte(day));
7434 assert(Date.fromISOExtString("2010-07-04") == Date(2010, 7, 4));
7435 assert(Date.fromISOExtString("1998-12-25") == Date(1998, 12, 25));
7436 assert(Date.fromISOExtString("0000-01-05") == Date(0, 1, 5));
7437 assert(Date.fromISOExtString("-0004-01-05") == Date(-4, 1, 5));
7438 assert(Date.fromISOExtString(" 2010-07-04 ") == Date(2010, 7, 4));
7443 assertThrown!DateTimeException(Date.fromISOExtString(""));
7444 assertThrown!DateTimeException(Date.fromISOExtString("990704"));
7445 assertThrown!DateTimeException(Date.fromISOExtString("0100704"));
7446 assertThrown!DateTimeException(Date.fromISOExtString("2010070"));
7447 assertThrown!DateTimeException(Date.fromISOExtString("2010070 "));
7448 assertThrown!DateTimeException(Date.fromISOExtString("120100704"));
7449 assertThrown!DateTimeException(Date.fromISOExtString("-0100704"));
7450 assertThrown!DateTimeException(Date.fromISOExtString("+0100704"));
7451 assertThrown!DateTimeException(Date.fromISOExtString("2010070a"));
7452 assertThrown!DateTimeException(Date.fromISOExtString("20100a04"));
7453 assertThrown!DateTimeException(Date.fromISOExtString("2010a704"));
7455 assertThrown!DateTimeException(Date.fromISOExtString("99-07-04"));
7456 assertThrown!DateTimeException(Date.fromISOExtString("010-07-04"));
7457 assertThrown!DateTimeException(Date.fromISOExtString("2010-07-0"));
7458 assertThrown!DateTimeException(Date.fromISOExtString("2010-07-0 "));
7459 assertThrown!DateTimeException(Date.fromISOExtString("12010-07-04"));
7460 assertThrown!DateTimeException(Date.fromISOExtString("-010-07-04"));
7461 assertThrown!DateTimeException(Date.fromISOExtString("+010-07-04"));
7462 assertThrown!DateTimeException(Date.fromISOExtString("2010-07-0a"));
7463 assertThrown!DateTimeException(Date.fromISOExtString("2010-0a-04"));
7464 assertThrown!DateTimeException(Date.fromISOExtString("2010-a7-04"));
7465 assertThrown!DateTimeException(Date.fromISOExtString("2010/07/04"));
7466 assertThrown!DateTimeException(Date.fromISOExtString("2010/7/04"));
7467 assertThrown!DateTimeException(Date.fromISOExtString("2010/7/4"));
7468 assertThrown!DateTimeException(Date.fromISOExtString("2010/07/4"));
7469 assertThrown!DateTimeException(Date.fromISOExtString("2010-7-04"));
7470 assertThrown!DateTimeException(Date.fromISOExtString("2010-7-4"));
7471 assertThrown!DateTimeException(Date.fromISOExtString("2010-07-4"));
7473 assertThrown!DateTimeException(Date.fromISOExtString("99Jul04"));
7474 assertThrown!DateTimeException(Date.fromISOExtString("010Jul04"));
7475 assertThrown!DateTimeException(Date.fromISOExtString("2010Jul0"));
7476 assertThrown!DateTimeException(Date.fromISOExtString("2010-Jul-0 "));
7477 assertThrown!DateTimeException(Date.fromISOExtString("12010Jul04"));
7478 assertThrown!DateTimeException(Date.fromISOExtString("-010Jul04"));
7479 assertThrown!DateTimeException(Date.fromISOExtString("+010Jul04"));
7480 assertThrown!DateTimeException(Date.fromISOExtString("2010Jul0a"));
7481 assertThrown!DateTimeException(Date.fromISOExtString("2010Jua04"));
7482 assertThrown!DateTimeException(Date.fromISOExtString("2010aul04"));
7484 assertThrown!DateTimeException(Date.fromISOExtString("99-Jul-04"));
7485 assertThrown!DateTimeException(Date.fromISOExtString("010-Jul-04"));
7486 assertThrown!DateTimeException(Date.fromISOExtString("2010-Jul-0"));
7487 assertThrown!DateTimeException(Date.fromISOExtString("2010Jul0 "));
7488 assertThrown!DateTimeException(Date.fromISOExtString("12010-Jul-04"));
7489 assertThrown!DateTimeException(Date.fromISOExtString("-010-Jul-04"));
7490 assertThrown!DateTimeException(Date.fromISOExtString("+010-Jul-04"));
7491 assertThrown!DateTimeException(Date.fromISOExtString("2010-Jul-0a"));
7492 assertThrown!DateTimeException(Date.fromISOExtString("2010-Jua-04"));
7493 assertThrown!DateTimeException(Date.fromISOExtString("2010-Jal-04"));
7494 assertThrown!DateTimeException(Date.fromISOExtString("2010-aul-04"));
7496 assertThrown!DateTimeException(Date.fromISOExtString("20100704"));
7497 assertThrown!DateTimeException(Date.fromISOExtString("2010-Jul-04"));
7499 assert(Date.fromISOExtString("1999-07-06") == Date(1999, 7, 6));
7500 assert(Date.fromISOExtString("-1999-07-06") == Date(-1999, 7, 6));
7501 assert(Date.fromISOExtString("+01999-07-06") == Date(1999, 7, 6));
7502 assert(Date.fromISOExtString("1999-07-06 ") == Date(1999, 7, 6));
7503 assert(Date.fromISOExtString(" 1999-07-06") == Date(1999, 7, 6));
7504 assert(Date.fromISOExtString(" 1999-07-06 ") == Date(1999, 7, 6));
7515 assert(Date.fromISOExtString(to!S("2012-12-21")) == Date(2012, 12, 21));
7521 Creates a $(LREF Date) from a string with the format YYYY-Mon-DD.
7530 not in the correct format or if the resulting $(LREF Date) would not
7533 static Date fromSimpleString(S)(in S simpleString) @safe pure
7566 return Date(to!short(year), month, to!ubyte(day));
7572 assert(Date.fromSimpleString("2010-Jul-04") == Date(2010, 7, 4));
7573 assert(Date.fromSimpleString("1998-Dec-25") == Date(1998, 12, 25));
7574 assert(Date.fromSimpleString("0000-Jan-05") == Date(0, 1, 5));
7575 assert(Date.fromSimpleString("-0004-Jan-05") == Date(-4, 1, 5));
7576 assert(Date.fromSimpleString(" 2010-Jul-04 ") == Date(2010, 7, 4));
7581 assertThrown!DateTimeException(Date.fromSimpleString(""));
7582 assertThrown!DateTimeException(Date.fromSimpleString("990704"));
7583 assertThrown!DateTimeException(Date.fromSimpleString("0100704"));
7584 assertThrown!DateTimeException(Date.fromSimpleString("2010070"));
7585 assertThrown!DateTimeException(Date.fromSimpleString("2010070 "));
7586 assertThrown!DateTimeException(Date.fromSimpleString("120100704"));
7587 assertThrown!DateTimeException(Date.fromSimpleString("-0100704"));
7588 assertThrown!DateTimeException(Date.fromSimpleString("+0100704"));
7589 assertThrown!DateTimeException(Date.fromSimpleString("2010070a"));
7590 assertThrown!DateTimeException(Date.fromSimpleString("20100a04"));
7591 assertThrown!DateTimeException(Date.fromSimpleString("2010a704"));
7593 assertThrown!DateTimeException(Date.fromSimpleString("99-07-04"));
7594 assertThrown!DateTimeException(Date.fromSimpleString("010-07-04"));
7595 assertThrown!DateTimeException(Date.fromSimpleString("2010-07-0"));
7596 assertThrown!DateTimeException(Date.fromSimpleString("2010-07-0 "));
7597 assertThrown!DateTimeException(Date.fromSimpleString("12010-07-04"));
7598 assertThrown!DateTimeException(Date.fromSimpleString("-010-07-04"));
7599 assertThrown!DateTimeException(Date.fromSimpleString("+010-07-04"));
7600 assertThrown!DateTimeException(Date.fromSimpleString("2010-07-0a"));
7601 assertThrown!DateTimeException(Date.fromSimpleString("2010-0a-04"));
7602 assertThrown!DateTimeException(Date.fromSimpleString("2010-a7-04"));
7603 assertThrown!DateTimeException(Date.fromSimpleString("2010/07/04"));
7604 assertThrown!DateTimeException(Date.fromSimpleString("2010/7/04"));
7605 assertThrown!DateTimeException(Date.fromSimpleString("2010/7/4"));
7606 assertThrown!DateTimeException(Date.fromSimpleString("2010/07/4"));
7607 assertThrown!DateTimeException(Date.fromSimpleString("2010-7-04"));
7608 assertThrown!DateTimeException(Date.fromSimpleString("2010-7-4"));
7609 assertThrown!DateTimeException(Date.fromSimpleString("2010-07-4"));
7611 assertThrown!DateTimeException(Date.fromSimpleString("99Jul04"));
7612 assertThrown!DateTimeException(Date.fromSimpleString("010Jul04"));
7613 assertThrown!DateTimeException(Date.fromSimpleString("2010Jul0"));
7614 assertThrown!DateTimeException(Date.fromSimpleString("2010Jul0 "));
7615 assertThrown!DateTimeException(Date.fromSimpleString("12010Jul04"));
7616 assertThrown!DateTimeException(Date.fromSimpleString("-010Jul04"));
7617 assertThrown!DateTimeException(Date.fromSimpleString("+010Jul04"));
7618 assertThrown!DateTimeException(Date.fromSimpleString("2010Jul0a"));
7619 assertThrown!DateTimeException(Date.fromSimpleString("2010Jua04"));
7620 assertThrown!DateTimeException(Date.fromSimpleString("2010aul04"));
7622 assertThrown!DateTimeException(Date.fromSimpleString("99-Jul-04"));
7623 assertThrown!DateTimeException(Date.fromSimpleString("010-Jul-04"));
7624 assertThrown!DateTimeException(Date.fromSimpleString("2010-Jul-0"));
7625 assertThrown!DateTimeException(Date.fromSimpleString("2010-Jul-0 "));
7626 assertThrown!DateTimeException(Date.fromSimpleString("12010-Jul-04"));
7627 assertThrown!DateTimeException(Date.fromSimpleString("-010-Jul-04"));
7628 assertThrown!DateTimeException(Date.fromSimpleString("+010-Jul-04"));
7629 assertThrown!DateTimeException(Date.fromSimpleString("2010-Jul-0a"));
7630 assertThrown!DateTimeException(Date.fromSimpleString("2010-Jua-04"));
7631 assertThrown!DateTimeException(Date.fromSimpleString("2010-Jal-04"));
7632 assertThrown!DateTimeException(Date.fromSimpleString("2010-aul-04"));
7634 assertThrown!DateTimeException(Date.fromSimpleString("20100704"));
7635 assertThrown!DateTimeException(Date.fromSimpleString("2010-07-04"));
7637 assert(Date.fromSimpleString("1999-Jul-06") == Date(1999, 7, 6));
7638 assert(Date.fromSimpleString("-1999-Jul-06") == Date(-1999, 7, 6));
7639 assert(Date.fromSimpleString("+01999-Jul-06") == Date(1999, 7, 6));
7640 assert(Date.fromSimpleString("1999-Jul-06 ") == Date(1999, 7, 6));
7641 assert(Date.fromSimpleString(" 1999-Jul-06") == Date(1999, 7, 6));
7642 assert(Date.fromSimpleString(" 1999-Jul-06 ") == Date(1999, 7, 6));
7653 assert(Date.fromSimpleString(to!S("2012-Dec-21")) == Date(2012, 12, 21));
7659 Returns the $(LREF Date) farthest in the past which is representable by
7660 $(LREF Date).
7662 @property static Date min() @safe pure nothrow @nogc
7664 auto date = Date.init;
7674 assert(Date.min.year < 0);
7675 assert(Date.min < Date.max);
7680 Returns the $(LREF Date) farthest in the future which is representable
7681 by $(LREF Date).
7683 @property static Date max() @safe pure nothrow @nogc
7685 auto date = Date.init;
7695 assert(Date.max.year > 0);
7696 assert(Date.max > Date.min);
7721 Adds the given number of days to this $(LREF Date). A negative number
7734 days = The number of days to add to this Date.
7736 ref Date _addDays(long days) return @safe pure nothrow @nogc
7746 auto date = Date(1999, 2, 28);
7748 assert(date == Date(1999, 3, 1));
7750 assert(date == Date(1999, 2, 28));
7754 auto date = Date(2000, 2, 28);
7756 assert(date == Date(2000, 2, 29));
7758 assert(date == Date(2000, 3, 1));
7760 assert(date == Date(2000, 2, 29));
7764 auto date = Date(1999, 6, 30);
7766 assert(date == Date(1999, 7, 1));
7768 assert(date == Date(1999, 6, 30));
7772 auto date = Date(1999, 7, 31);
7774 assert(date == Date(1999, 8, 1));
7776 assert(date == Date(1999, 7, 31));
7780 auto date = Date(1999, 1, 1);
7782 assert(date == Date(1998, 12, 31));
7784 assert(date == Date(1999, 1, 1));
7788 auto date = Date(1999, 7, 6);
7790 assert(date == Date(1999, 7, 15));
7792 assert(date == Date(1999, 7, 4));
7794 assert(date == Date(1999, 8, 3));
7796 assert(date == Date(1999, 7, 31));
7800 auto date = Date(1999, 7, 6);
7802 assert(date == Date(2000, 7, 5));
7804 assert(date == Date(1999, 7, 6));
7806 assert(date == Date(2000, 7, 6));
7808 assert(date == Date(2002, 7, 6));
7810 assert(date == Date(1999, 7, 6));
7815 auto date = Date(-1999, 2, 28);
7817 assert(date == Date(-1999, 3, 1));
7819 assert(date == Date(-1999, 2, 28));
7823 auto date = Date(-2000, 2, 28);
7825 assert(date == Date(-2000, 2, 29));
7827 assert(date == Date(-2000, 3, 1));
7829 assert(date == Date(-2000, 2, 29));
7833 auto date = Date(-1999, 6, 30);
7835 assert(date == Date(-1999, 7, 1));
7837 assert(date == Date(-1999, 6, 30));
7841 auto date = Date(-1999, 7, 31);
7843 assert(date == Date(-1999, 8, 1));
7845 assert(date == Date(-1999, 7, 31));
7849 auto date = Date(-1999, 1, 1);
7851 assert(date == Date(-2000, 12, 31));
7853 assert(date == Date(-1999, 1, 1));
7857 auto date = Date(-1999, 7, 6);
7859 assert(date == Date(-1999, 7, 15));
7861 assert(date == Date(-1999, 7, 4));
7863 assert(date == Date(-1999, 8, 3));
7868 auto date = Date(-1999, 7, 6);
7870 assert(date == Date(-1998, 7, 6));
7872 assert(date == Date(-1999, 7, 6));
7874 assert(date == Date(-1998, 7, 7));
7876 assert(date == Date(-1996, 7, 6));
7878 assert(date == Date(-1999, 7, 6));
7883 auto date = Date(1, 7, 6);
7885 assert(date == Date(0, 7, 6));
7887 assert(date == Date(1, 7, 6));
7889 assert(date == Date(-1, 7, 6));
7891 assert(date == Date(1, 7, 5));
7894 const cdate = Date(1999, 7, 6);
7895 immutable idate = Date(1999, 7, 6);
9584 static assert(isTimePoint!Date);
9601 foreach (TP; AliasSeq!(Date, DateTime, SysTime, TimeOfDay))
9607 foreach (T; AliasSeq!(float, string, Duration, Interval!Date, PosInfInterval!Date, NegInfInterval!Date))
9932 assert(getDayOfWeek(SysTime(Date(1, 1, 1)).dayOfGregorianCal) == DayOfWeek.mon);
9933 assert(getDayOfWeek(SysTime(Date(1, 1, 2)).dayOfGregorianCal) == DayOfWeek.tue);
9934 assert(getDayOfWeek(SysTime(Date(1, 1, 3)).dayOfGregorianCal) == DayOfWeek.wed);
9935 assert(getDayOfWeek(SysTime(Date(1, 1, 4)).dayOfGregorianCal) == DayOfWeek.thu);
9936 assert(getDayOfWeek(SysTime(Date(1, 1, 5)).dayOfGregorianCal) == DayOfWeek.fri);
9937 assert(getDayOfWeek(SysTime(Date(1, 1, 6)).dayOfGregorianCal) == DayOfWeek.sat);
9938 assert(getDayOfWeek(SysTime(Date(1, 1, 7)).dayOfGregorianCal) == DayOfWeek.sun);
9939 assert(getDayOfWeek(SysTime(Date(1, 1, 8)).dayOfGregorianCal) == DayOfWeek.mon);
9940 assert(getDayOfWeek(SysTime(Date(1, 1, 9)).dayOfGregorianCal) == DayOfWeek.tue);
9941 assert(getDayOfWeek(SysTime(Date(2, 1, 1)).dayOfGregorianCal) == DayOfWeek.tue);
9942 assert(getDayOfWeek(SysTime(Date(3, 1, 1)).dayOfGregorianCal) == DayOfWeek.wed);
9943 assert(getDayOfWeek(SysTime(Date(4, 1, 1)).dayOfGregorianCal) == DayOfWeek.thu);
9944 assert(getDayOfWeek(SysTime(Date(5, 1, 1)).dayOfGregorianCal) == DayOfWeek.sat);
9945 assert(getDayOfWeek(SysTime(Date(2000, 1, 1)).dayOfGregorianCal) == DayOfWeek.sat);
9946 assert(getDayOfWeek(SysTime(Date(2010, 8, 22)).dayOfGregorianCal) == DayOfWeek.sun);
9947 assert(getDayOfWeek(SysTime(Date(2010, 8, 23)).dayOfGregorianCal) == DayOfWeek.mon);
9948 assert(getDayOfWeek(SysTime(Date(2010, 8, 24)).dayOfGregorianCal) == DayOfWeek.tue);
9949 assert(getDayOfWeek(SysTime(Date(2010, 8, 25)).dayOfGregorianCal) == DayOfWeek.wed);
9950 assert(getDayOfWeek(SysTime(Date(2010, 8, 26)).dayOfGregorianCal) == DayOfWeek.thu);
9951 assert(getDayOfWeek(SysTime(Date(2010, 8, 27)).dayOfGregorianCal) == DayOfWeek.fri);
9952 assert(getDayOfWeek(SysTime(Date(2010, 8, 28)).dayOfGregorianCal) == DayOfWeek.sat);
9953 assert(getDayOfWeek(SysTime(Date(2010, 8, 29)).dayOfGregorianCal) == DayOfWeek.sun);
9956 assert(getDayOfWeek(SysTime(Date(0, 12, 31)).dayOfGregorianCal) == DayOfWeek.sun);
9957 assert(getDayOfWeek(SysTime(Date(0, 12, 30)).dayOfGregorianCal) == DayOfWeek.sat);
9958 assert(getDayOfWeek(SysTime(Date(0, 12, 29)).dayOfGregorianCal) == DayOfWeek.fri);
9959 assert(getDayOfWeek(SysTime(Date(0, 12, 28)).dayOfGregorianCal) == DayOfWeek.thu);
9960 assert(getDayOfWeek(SysTime(Date(0, 12, 27)).dayOfGregorianCal) == DayOfWeek.wed);
9961 assert(getDayOfWeek(SysTime(Date(0, 12, 26)).dayOfGregorianCal) == DayOfWeek.tue);
9962 assert(getDayOfWeek(SysTime(Date(0, 12, 25)).dayOfGregorianCal) == DayOfWeek.mon);
9963 assert(getDayOfWeek(SysTime(Date(0, 12, 24)).dayOfGregorianCal) == DayOfWeek.sun);
9964 assert(getDayOfWeek(SysTime(Date(0, 12, 23)).dayOfGregorianCal) == DayOfWeek.sat);
10122 Date[] testDatesBC;
10123 Date[] testDatesAD;
10129 struct GregDay { int day; Date date; }
10130 auto testGregDaysBC = [GregDay(-1_373_427, Date(-3760, 9, 7)), // Start of the Hebrew Calendar
10131 GregDay(-735_233, Date(-2012, 1, 1)),
10132 GregDay(-735_202, Date(-2012, 2, 1)),
10133 GregDay(-735_175, Date(-2012, 2, 28)),
10134 GregDay(-735_174, Date(-2012, 2, 29)),
10135 GregDay(-735_173, Date(-2012, 3, 1)),
10136 GregDay(-734_502, Date(-2010, 1, 1)),
10137 GregDay(-734_472, Date(-2010, 1, 31)),
10138 GregDay(-734_471, Date(-2010, 2, 1)),
10139 GregDay(-734_444, Date(-2010, 2, 28)),
10140 GregDay(-734_443, Date(-2010, 3, 1)),
10141 GregDay(-734_413, Date(-2010, 3, 31)),
10142 GregDay(-734_412, Date(-2010, 4, 1)),
10143 GregDay(-734_383, Date(-2010, 4, 30)),
10144 GregDay(-734_382, Date(-2010, 5, 1)),
10145 GregDay(-734_352, Date(-2010, 5, 31)),
10146 GregDay(-734_351, Date(-2010, 6, 1)),
10147 GregDay(-734_322, Date(-2010, 6, 30)),
10148 GregDay(-734_321, Date(-2010, 7, 1)),
10149 GregDay(-734_291, Date(-2010, 7, 31)),
10150 GregDay(-734_290, Date(-2010, 8, 1)),
10151 GregDay(-734_260, Date(-2010, 8, 31)),
10152 GregDay(-734_259, Date(-2010, 9, 1)),
10153 GregDay(-734_230, Date(-2010, 9, 30)),
10154 GregDay(-734_229, Date(-2010, 10, 1)),
10155 GregDay(-734_199, Date(-2010, 10, 31)),
10156 GregDay(-734_198, Date(-2010, 11, 1)),
10157 GregDay(-734_169, Date(-2010, 11, 30)),
10158 GregDay(-734_168, Date(-2010, 12, 1)),
10159 GregDay(-734_139, Date(-2010, 12, 30)),
10160 GregDay(-734_138, Date(-2010, 12, 31)),
10161 GregDay(-731_215, Date(-2001, 1, 1)),
10162 GregDay(-730_850, Date(-2000, 1, 1)),
10163 GregDay(-730_849, Date(-2000, 1, 2)),
10164 GregDay(-730_486, Date(-2000, 12, 30)),
10165 GregDay(-730_485, Date(-2000, 12, 31)),
10166 GregDay(-730_484, Date(-1999, 1, 1)),
10167 GregDay(-694_690, Date(-1901, 1, 1)),
10168 GregDay(-694_325, Date(-1900, 1, 1)),
10169 GregDay(-585_118, Date(-1601, 1, 1)),
10170 GregDay(-584_753, Date(-1600, 1, 1)),
10171 GregDay(-584_388, Date(-1600, 12, 31)),
10172 GregDay(-584_387, Date(-1599, 1, 1)),
10173 GregDay(-365_972, Date(-1001, 1, 1)),
10174 GregDay(-365_607, Date(-1000, 1, 1)),
10175 GregDay(-183_351, Date(-501, 1, 1)),
10176 GregDay(-182_986, Date(-500, 1, 1)),
10177 GregDay(-182_621, Date(-499, 1, 1)),
10178 GregDay(-146_827, Date(-401, 1, 1)),
10179 GregDay(-146_462, Date(-400, 1, 1)),
10180 GregDay(-146_097, Date(-400, 12, 31)),
10181 GregDay(-110_302, Date(-301, 1, 1)),
10182 GregDay(-109_937, Date(-300, 1, 1)),
10183 GregDay(-73_778, Date(-201, 1, 1)),
10184 GregDay(-73_413, Date(-200, 1, 1)),
10185 GregDay(-38_715, Date(-105, 1, 1)),
10186 GregDay(-37_254, Date(-101, 1, 1)),
10187 GregDay(-36_889, Date(-100, 1, 1)),
10188 GregDay(-36_524, Date(-99, 1, 1)),
10189 GregDay(-36_160, Date(-99, 12, 31)),
10190 GregDay(-35_794, Date(-97, 1, 1)),
10191 GregDay(-18_627, Date(-50, 1, 1)),
10192 GregDay(-18_262, Date(-49, 1, 1)),
10193 GregDay(-3652, Date(-9, 1, 1)),
10194 GregDay(-2191, Date(-5, 1, 1)),
10195 GregDay(-1827, Date(-5, 12, 31)),
10196 GregDay(-1826, Date(-4, 1, 1)),
10197 GregDay(-1825, Date(-4, 1, 2)),
10198 GregDay(-1462, Date(-4, 12, 30)),
10199 GregDay(-1461, Date(-4, 12, 31)),
10200 GregDay(-1460, Date(-3, 1, 1)),
10201 GregDay(-1096, Date(-3, 12, 31)),
10202 GregDay(-1095, Date(-2, 1, 1)),
10203 GregDay(-731, Date(-2, 12, 31)),
10204 GregDay(-730, Date(-1, 1, 1)),
10205 GregDay(-367, Date(-1, 12, 30)),
10206 GregDay(-366, Date(-1, 12, 31)),
10207 GregDay(-365, Date(0, 1, 1)),
10208 GregDay(-31, Date(0, 11, 30)),
10209 GregDay(-30, Date(0, 12, 1)),
10210 GregDay(-1, Date(0, 12, 30)),
10211 GregDay(0, Date(0, 12, 31))];
10213 auto testGregDaysAD = [GregDay(1, Date(1, 1, 1)),
10214 GregDay(2, Date(1, 1, 2)),
10215 GregDay(32, Date(1, 2, 1)),
10216 GregDay(365, Date(1, 12, 31)),
10217 GregDay(366, Date(2, 1, 1)),
10218 GregDay(731, Date(3, 1, 1)),
10219 GregDay(1096, Date(4, 1, 1)),
10220 GregDay(1097, Date(4, 1, 2)),
10221 GregDay(1460, Date(4, 12, 30)),
10222 GregDay(1461, Date(4, 12, 31)),
10223 GregDay(1462, Date(5, 1, 1)),
10224 GregDay(17_898, Date(50, 1, 1)),
10225 GregDay(35_065, Date(97, 1, 1)),
10226 GregDay(36_160, Date(100, 1, 1)),
10227 GregDay(36_525, Date(101, 1, 1)),
10228 GregDay(37_986, Date(105, 1, 1)),
10229 GregDay(72_684, Date(200, 1, 1)),
10230 GregDay(73_049, Date(201, 1, 1)),
10231 GregDay(109_208, Date(300, 1, 1)),
10232 GregDay(109_573, Date(301, 1, 1)),
10233 GregDay(145_732, Date(400, 1, 1)),
10234 GregDay(146_098, Date(401, 1, 1)),
10235 GregDay(182_257, Date(500, 1, 1)),
10236 GregDay(182_622, Date(501, 1, 1)),
10237 GregDay(364_878, Date(1000, 1, 1)),
10238 GregDay(365_243, Date(1001, 1, 1)),
10239 GregDay(584_023, Date(1600, 1, 1)),
10240 GregDay(584_389, Date(1601, 1, 1)),
10241 GregDay(693_596, Date(1900, 1, 1)),
10242 GregDay(693_961, Date(1901, 1, 1)),
10243 GregDay(729_755, Date(1999, 1, 1)),
10244 GregDay(730_120, Date(2000, 1, 1)),
10245 GregDay(730_121, Date(2000, 1, 2)),
10246 GregDay(730_484, Date(2000, 12, 30)),
10247 GregDay(730_485, Date(2000, 12, 31)),
10248 GregDay(730_486, Date(2001, 1, 1)),
10249 GregDay(733_773, Date(2010, 1, 1)),
10250 GregDay(733_774, Date(2010, 1, 2)),
10251 GregDay(733_803, Date(2010, 1, 31)),
10252 GregDay(733_804, Date(2010, 2, 1)),
10253 GregDay(733_831, Date(2010, 2, 28)),
10254 GregDay(733_832, Date(2010, 3, 1)),
10255 GregDay(733_862, Date(2010, 3, 31)),
10256 GregDay(733_863, Date(2010, 4, 1)),
10257 GregDay(733_892, Date(2010, 4, 30)),
10258 GregDay(733_893, Date(2010, 5, 1)),
10259 GregDay(733_923, Date(2010, 5, 31)),
10260 GregDay(733_924, Date(2010, 6, 1)),
10261 GregDay(733_953, Date(2010, 6, 30)),
10262 GregDay(733_954, Date(2010, 7, 1)),
10263 GregDay(733_984, Date(2010, 7, 31)),
10264 GregDay(733_985, Date(2010, 8, 1)),
10265 GregDay(734_015, Date(2010, 8, 31)),
10266 GregDay(734_016, Date(2010, 9, 1)),
10267 GregDay(734_045, Date(2010, 9, 30)),
10268 GregDay(734_046, Date(2010, 10, 1)),
10269 GregDay(734_076, Date(2010, 10, 31)),
10270 GregDay(734_077, Date(2010, 11, 1)),
10271 GregDay(734_106, Date(2010, 11, 30)),
10272 GregDay(734_107, Date(2010, 12, 1)),
10273 GregDay(734_136, Date(2010, 12, 30)),
10274 GregDay(734_137, Date(2010, 12, 31)),
10275 GregDay(734_503, Date(2012, 1, 1)),
10276 GregDay(734_534, Date(2012, 2, 1)),
10277 GregDay(734_561, Date(2012, 2, 28)),
10278 GregDay(734_562, Date(2012, 2, 29)),
10279 GregDay(734_563, Date(2012, 3, 1)),
10280 GregDay(734_858, Date(2012, 12, 21))];
10348 testDatesBC ~= Date(year, md.month, md.day);
10354 testDatesAD ~= Date(year, md.month, md.day);