NAME

PFT::Date - Representation of date

SYNOPSIS

PFT::Date->new(2016, 12, 10)

PFT::Date->from_spec(
    d => 12,
    m => 'june', # human friendly
    # missing ones (e.g. year) filled with today's year.
)

PFT::Date->from_string('1955-11-05');

DESCRIPTION

PFT::Date is defined as a blessed array reference. The first element is the year, the second is the month, the third is the day.

Properties

y

Year getter

m

Month getter

d

Day getter

to_hash

Returns a dictionary in the form

{ y => ..., m => ..., d => ... }
repr

Returns a string representing the date. Optional parameter is a separator string, by default '-'

PFT::Date->new(1,2,3)->repr      eq '0001-02-03'
PFT::Date->new(1,2,3)->repr('/') eq '0001/02/03'
derive

Returns a copy of the PFT::Date object with the provided components replaced.

PFT::Date->new(1, 2, 3)->derive(m => undef)

is like

PFT::Date->new(1, undef, 3)
complete

Check if the date is complete of year, month and day.