The OpenD Programming Language

YearMonth.addQuarters

struct YearMonth
nothrow @safe pure nothrow @nogc
addQuarters
()

Examples

auto ym0 = YearMonth(2020, Month.jan);

auto ym1 = ym0.addQuarters(5);
assert(ym1.year == 2021);
assert(ym1.month == Month.apr);

auto ym2 = ym1.addQuarters(-2);
assert(ym2.year == 2020);
assert(ym2.month == Month.oct);

auto ym3 = YearMonth(2020, Month.dec).addQuarters(1);
assert(ym3.year == 2021);
assert(ym3.month == Month.mar);

// ym0 is left unchagned
assert(ym0.year == 2020);
assert(ym0.month == Month.jan);

Meta