IO_METHOD(IoDate, setDay) { /*doc Date setDay(aNumber) Sets the day of the receiver. Returns self. */ int v = IoMessage_locals_intArgAt_(m, locals, 0); int month = Date_month(DATA(self)) + 1; IOASSERT(v >= 1 && v <= 31, "day must be within range 1-31"); if (month == 2) { if (Date_isLeapYear(DATA(self))) { IOASSERT(v >= 1 && v <= 29, "day must be within range 1-29"); } else { IOASSERT(v >= 1 && v <= 28, "day must be within range 1-28"); } } else if (month == 11) { IOASSERT(v >= 1 && v <= 30, "day must be within range 1-30"); } else if (month == 12) { IOASSERT(v >= 1 && v <= 31, "day must be within range 1-31"); } Date_setDay_(DATA(self), v); IoObject_isDirty_(self, 1); return self; }
IO_METHOD(IoDate, month) { /*doc Date month Returns a number containing the month(1-12) of the year of the receiver. */ return IONUMBER(Date_month(DATA(self)) + 1); }
inline int_month Date::month() const { return Date_month(this); }