NAME

Getopt::Pad::Type::Temporal - Base class of the date and duration option types

DESCRIPTION

The common base class of Getopt::Pad::Type::Date and Getopt::Pad::Type::Duration. It is abstract: specs cannot use it directly.

Both types parse natural language with DateTime::Format::Natural, which is not installed together with Getopt::Pad. A spec that uses one of them without the module fails with the spec error type 'NAME' requires the DateTime::Format::Natural module.

It provides the spec key timezone: the name of the time zone in which values are parsed and returned, as DateTime::TimeZone knows it. It defaults to local, the system's time zone; when the system's time zone cannot be determined, local falls back to floating. An unknown name is the spec error timezone 'NAME' is not a known time zone. The key is described for users in "Type-specific keys" in Getopt::Pad.

A type constructed directly, outside a spec, loads DateTime::Format::Natural when it is constructed and dies with Perl's own message if the module is missing.

Values are coerced to objects. The help output and --create-default-config show a default as the spec wrote it, as for every type. Every temporal type takes a value (glSuffix '=s').

METHODS

timezone

The time zone name from the spec.

zone

The DateTime::TimeZone it resolved to.

newParser(%options)

A new DateTime::Format::Natural parser in zone, with %options passed on.

SEE ALSO

Getopt::Pad::Type, Getopt::Pad::Type::Date, 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.