Creates a get/set accessor method for an object attribute that stores a
DateTime object.
When called with a single argument, the argument is passed
through Rose::DateTime::Util's parse_date() function in order to
create the DateTime object that is stored. The current value of the
attribute is returned. Passing a value that is not understood by
Rose::DateTime::Util's parse_date() function causes a fatal
error.
When called with two arguments and the first argument is the
string 'format', then the second argument is taken as a format specifier
which is passed to Rose::DateTime::Util's format_date() function.
The formatted string is returned. In other words, this:
$obj->birthday(format => '%m/%d/%Y');
Is just a shortcut for this:
Rose::DateTime::Util::format_date($obj->birthday,
'%m/%d/%Y');
When called with two arguments and the first argument is the
string 'truncate', then the second argument is taken as a truncation
specifier which is passed to DateTime's truncate() method called
on a clone of the existing DateTime object. The cloned, truncated
DateTime object is returned. In other words, this:
$obj->birthday(truncate => 'month');
Is just a shortcut for this:
$obj->birthday->clone->truncate(to => 'month');
Passing more than two arguments or passing two arguments where
the first argument is not 'format' or 'truncate' will cause a fatal
error.