diff --git a/uppsrc/Core/TimeDate.h b/uppsrc/Core/TimeDate.h index 2cc5ef8c8..48916996c 100644 --- a/uppsrc/Core/TimeDate.h +++ b/uppsrc/Core/TimeDate.h @@ -18,6 +18,9 @@ struct Date : RelOps< Date, Moveable > { int Compare(Date b) const; + Date& operator++() { if(day < 28) day++; else Set(Get() + 1); return *this; } + Date& operator--() { if(day > 0) day--; else Set(Get() - 1); return *this; } + Date() { year = -32768; day = month = 0; } Date(const Nuller&) { year = -32768; day = month = 0; } Date(int y, int m, int d) { day = d; month = m; year = y; } diff --git a/uppsrc/Core/src.tpp/DateTime$en-us.tpp b/uppsrc/Core/src.tpp/DateTime$en-us.tpp index e4f2f3cb8..76e484478 100644 --- a/uppsrc/Core/src.tpp/DateTime$en-us.tpp +++ b/uppsrc/Core/src.tpp/DateTime$en-us.tpp @@ -70,6 +70,14 @@ onst]&] 1 if > b.&] [s3;%% &] [s4; &] +[s5;:Date`:`:operator`+`+`(`): [_^Date^ Date][@(0.0.255) `&]_[* operator`+`+]()&] +[s2;%% Moves to the next day.&] +[s3; &] +[s4; &] +[s5;:Date`:`:operator`-`-`(`): [_^Date^ Date][@(0.0.255) `&]_[* operator`-`-]()&] +[s2;%% Moves to the previous day.&] +[s3; &] +[s4; &] [s5;:Date`:`:Low`(`): [@(0.0.255) static] [_^Date^ Date]_[* Low]()&] [s2;%% Returns the lowest possible date (year 4000).&] [s3; &]