auto dt = DateTime(Date.init, TimeOfDay(12, 0, 0)); dt.dayOfGregorianCal = 1; assert(dt == DateTime(Date(1, 1, 1), TimeOfDay(12, 0, 0))); dt.dayOfGregorianCal = 365; assert(dt == DateTime(Date(1, 12, 31), TimeOfDay(12, 0, 0))); dt.dayOfGregorianCal = 366; assert(dt == DateTime(Date(2, 1, 1), TimeOfDay(12, 0, 0))); dt.dayOfGregorianCal = 0; assert(dt == DateTime(Date(0, 12, 31), TimeOfDay(12, 0, 0))); dt.dayOfGregorianCal = -365; assert(dt == DateTime(Date(-0, 1, 1), TimeOfDay(12, 0, 0))); dt.dayOfGregorianCal = -366; assert(dt == DateTime(Date(-1, 12, 31), TimeOfDay(12, 0, 0))); dt.dayOfGregorianCal = 730_120; assert(dt == DateTime(Date(2000, 1, 1), TimeOfDay(12, 0, 0))); dt.dayOfGregorianCal = 734_137; assert(dt == DateTime(Date(2010, 12, 31), TimeOfDay(12, 0, 0)));
The Xth day of the Gregorian Calendar that this DateTime is on. Setting this property does not affect the time portion of DateTime.