NAME

Getopt::Pad::Type::Date - The date option type

SYNOPSIS

options => {
    since => { type => 'date', default => 'yesterday', timezone => 'UTC' },
},

DESCRIPTION

The type of options and args declared with type => 'date'. It parses a date and time in natural language, such as tomorrow 3pm, last monday, 3 days ago or 2026-10-06 14:00, with DateTime::Format::Natural. That module is not installed together with Getopt::Pad (see Getopt::Pad::Type::Temporal). A value it cannot parse is rejected with 'VALUE' is not a date.

The reader returns a DateTime object in the time zone of the timezone key. Relative values are resolved against the current time when the value is checked; for a default, that is when GetOptions builds the spec. The help output labels the option [Date].

The behavior for users is described in "date" in Getopt::Pad.

SEE ALSO

"TYPES" in Getopt::Pad, Getopt::Pad::Type::Temporal, Getopt::Pad::Type::Duration

AUTHOR

davenonymous <perl@davenonymous.com>

COPYRIGHT AND LICENSE

Copyright 2026 davenonymous

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.