The OpenD Programming Language

Date.roll

Adds the given number of units to this Date, mutating it. A negative number will subtract.

The difference between rolling and adding is that rolling does not affect larger units. For instance, rolling a Date one year's worth of days gets the exact same Date.

The only accepted units are "days".

  1. Date roll(long value, AllowDayOverflow allowOverflow)
  2. Date roll(long days)
    struct Date
    ref @safe pure nothrow @nogc
    roll
    (
    string units
    )
    (
    long days
    )
    if (
    units == "days"
    )

Parameters

units

The units to add. Must be "days".

days long

The number of days to add to this Date.

Return Value

Type: Date

A reference to the Date (this).

Examples

auto d = Date(2010, 1, 1);
d.roll!"days"(1);
assert(d == Date(2010, 1, 2));
d.roll!"days"(365);
assert(d == Date(2010, 1, 26));
d.roll!"days"(-32);
assert(d == Date(2010, 1, 25));

Meta