The OpenD Programming Language

YearQuarter.addQuarters

struct YearQuarter
@safe pure nothrow @nogc
addQuarters
()

Examples

auto yq0 = YearQuarter(2020, Quarter.q1);

auto yq1 = yq0.addQuarters(5);
assert(yq1.year == 2021);
assert(yq1.quarter == Quarter.q2);

auto yq2 = yq1.addQuarters(-2);
assert(yq2.year == 2020);
assert(yq2.quarter == Quarter.q4);

auto yq3 = YearQuarter(2020, Quarter.q4).addQuarters(1);
assert(yq3.year == 2021);
assert(yq3.quarter == Quarter.q1);

// yq0 is left unchagned
assert(yq0.year == 2020);
assert(yq0.quarter == Quarter.q1);

Meta