DateTime-Format-ISO8601-0.17/0000775000175000017500000000000014756442575015217 5ustar autarchautarchDateTime-Format-ISO8601-0.17/Todo0000644000175000017500000000054314756442575016047 0ustar autarchautarchTODO list for Perl module DateTime::Format::ISO8601 - more docs - full time only and date only parsers - group tags - better expanded format support - complete 5.4.2 support Roadmap: 0.05 - more tests - complete 5.4.2 support (recursive DT::F::Builder) 0.06 - start ISO8601 section 5.5 0.07 - finish section 5.5 when DT::Duration::Set is finished DateTime-Format-ISO8601-0.17/Makefile.PL0000644000175000017500000000365414756442575017177 0ustar autarchautarch# This Makefile.PL for DateTime-Format-ISO8601 was generated by # Dist::Zilla::Plugin::DROLSKY::MakeMaker 1.22 # and Dist::Zilla::Plugin::MakeMaker::Awesome 0.49. # Don't edit it but the dist.ini and plugins used to construct it. use strict; use warnings; use ExtUtils::MakeMaker; my %WriteMakefileArgs = ( "ABSTRACT" => "Parses ISO8601 formats", "AUTHOR" => "Joshua Hoblitt , Dave Rolsky ", "CONFIGURE_REQUIRES" => { "ExtUtils::MakeMaker" => 0 }, "DISTNAME" => "DateTime-Format-ISO8601", "LICENSE" => "perl", "NAME" => "DateTime::Format::ISO8601", "PREREQ_PM" => { "Carp" => 0, "DateTime" => "1.45", "DateTime::Format::Builder" => "0.77", "Params::ValidationCompiler" => "0.26", "Specio" => "0.18", "Specio::Declare" => 0, "Specio::Exporter" => 0, "Specio::Library::Builtins" => 0, "namespace::autoclean" => 0, "parent" => 0, "strict" => 0, "warnings" => 0 }, "TEST_REQUIRES" => { "ExtUtils::MakeMaker" => 0, "File::Spec" => 0, "Test2::V0" => 0, "Test::More" => "1.302015" }, "VERSION" => "0.17", "test" => { "TESTS" => "t/*.t" } ); my %FallbackPrereqs = ( "Carp" => 0, "DateTime" => "1.45", "DateTime::Format::Builder" => "0.77", "ExtUtils::MakeMaker" => 0, "File::Spec" => 0, "Params::ValidationCompiler" => "0.26", "Specio" => "0.18", "Specio::Declare" => 0, "Specio::Exporter" => 0, "Specio::Library::Builtins" => 0, "Test2::V0" => 0, "Test::More" => "1.302015", "namespace::autoclean" => 0, "parent" => 0, "strict" => 0, "warnings" => 0 ); unless ( eval { ExtUtils::MakeMaker->VERSION('6.63_03') } ) { delete $WriteMakefileArgs{TEST_REQUIRES}; delete $WriteMakefileArgs{BUILD_REQUIRES}; $WriteMakefileArgs{PREREQ_PM} = \%FallbackPrereqs; } delete $WriteMakefileArgs{CONFIGURE_REQUIRES} unless eval { ExtUtils::MakeMaker->VERSION(6.52) }; WriteMakefile(%WriteMakefileArgs); DateTime-Format-ISO8601-0.17/META.yml0000644000175000017500000006032614756442575016475 0ustar autarchautarch--- abstract: 'Parses ISO8601 formats' author: - 'Joshua Hoblitt ' - 'Dave Rolsky ' build_requires: ExtUtils::MakeMaker: '0' File::Spec: '0' Test2::V0: '0' Test::More: '1.302015' configure_requires: ExtUtils::MakeMaker: '0' dynamic_config: 0 generated_by: 'Dist::Zilla version 6.032, CPAN::Meta::Converter version 2.150010' license: perl meta-spec: url: http://module-build.sourceforge.net/META-spec-v1.4.html version: '1.4' name: DateTime-Format-ISO8601 provides: DateTime::Format::ISO8601: file: lib/DateTime/Format/ISO8601.pm version: '0.17' DateTime::Format::ISO8601::Types: file: lib/DateTime/Format/ISO8601/Types.pm version: '0.17' requires: Carp: '0' DateTime: '1.45' DateTime::Format::Builder: '0.77' Params::ValidationCompiler: '0.26' Specio: '0.18' Specio::Declare: '0' Specio::Exporter: '0' Specio::Library::Builtins: '0' namespace::autoclean: '0' parent: '0' strict: '0' warnings: '0' resources: bugtracker: https://github.com/houseabsolute/DateTime-Format-ISO8601/issues homepage: https://metacpan.org/release/DateTime-HiRes repository: git://github.com/houseabsolute/DateTime-Format-ISO8601.git version: '0.17' x_Dist_Zilla: perl: version: '5.038002' plugins: - class: Dist::Zilla::Plugin::DROLSKY::BundleAuthordep name: '@DROLSKY/DROLSKY::BundleAuthordep' version: '1.22' - class: Dist::Zilla::Plugin::Git::GatherDir config: Dist::Zilla::Plugin::GatherDir: exclude_filename: - CODE_OF_CONDUCT.md - CONTRIBUTING.md - LICENSE - Makefile.PL - README.md - cpanfile exclude_match: [] include_dotfiles: 0 prefix: '' prune_directory: [] root: . Dist::Zilla::Plugin::Git::GatherDir: include_untracked: 0 name: '@DROLSKY/Git::GatherDir' version: '2.051' - class: Dist::Zilla::Plugin::ManifestSkip name: '@DROLSKY/ManifestSkip' version: '6.032' - class: Dist::Zilla::Plugin::License name: '@DROLSKY/License' version: '6.032' - class: Dist::Zilla::Plugin::ExecDir name: '@DROLSKY/ExecDir' version: '6.032' - class: Dist::Zilla::Plugin::ShareDir name: '@DROLSKY/ShareDir' version: '6.032' - class: Dist::Zilla::Plugin::Manifest name: '@DROLSKY/Manifest' version: '6.032' - class: Dist::Zilla::Plugin::CheckVersionIncrement name: '@DROLSKY/CheckVersionIncrement' version: '0.121750' - class: Dist::Zilla::Plugin::TestRelease name: '@DROLSKY/TestRelease' version: '6.032' - class: Dist::Zilla::Plugin::ConfirmRelease name: '@DROLSKY/ConfirmRelease' version: '6.032' - class: Dist::Zilla::Plugin::UploadToCPAN name: '@DROLSKY/UploadToCPAN' version: '6.032' - class: Dist::Zilla::Plugin::VersionFromMainModule config: Dist::Zilla::Role::ModuleMetadata: Module::Metadata: '1.000037' version: '0.006' name: '@DROLSKY/VersionFromMainModule' version: '0.04' - class: Dist::Zilla::Plugin::Authority name: '@DROLSKY/Authority' version: '1.009' - class: Dist::Zilla::Plugin::AutoPrereqs name: '@DROLSKY/AutoPrereqs' version: '6.032' - class: Dist::Zilla::Plugin::CopyFilesFromBuild name: '@DROLSKY/CopyFilesFromBuild' version: '0.170880' - class: Dist::Zilla::Plugin::GitHub::Meta name: '@DROLSKY/GitHub::Meta' version: '0.49' - class: Dist::Zilla::Plugin::GitHub::Update config: Dist::Zilla::Plugin::GitHub::Update: metacpan: 1 name: '@DROLSKY/GitHub::Update' version: '0.49' - class: Dist::Zilla::Plugin::MetaResources name: '@DROLSKY/MetaResources' version: '6.032' - class: Dist::Zilla::Plugin::MetaProvides::Package config: Dist::Zilla::Plugin::MetaProvides::Package: finder_objects: - class: Dist::Zilla::Plugin::FinderCode name: '@DROLSKY/MetaProvides::Package/AUTOVIV/:InstallModulesPM' version: '6.032' include_underscores: 0 Dist::Zilla::Role::MetaProvider::Provider: $Dist::Zilla::Role::MetaProvider::Provider::VERSION: '2.002004' inherit_missing: 1 inherit_version: 1 meta_noindex: 1 Dist::Zilla::Role::ModuleMetadata: Module::Metadata: '1.000037' version: '0.006' name: '@DROLSKY/MetaProvides::Package' version: '2.004003' - class: Dist::Zilla::Plugin::Meta::Contributors name: '@DROLSKY/Meta::Contributors' version: '0.003' - class: Dist::Zilla::Plugin::MetaConfig name: '@DROLSKY/MetaConfig' version: '6.032' - class: Dist::Zilla::Plugin::MetaJSON name: '@DROLSKY/MetaJSON' version: '6.032' - class: Dist::Zilla::Plugin::MetaYAML name: '@DROLSKY/MetaYAML' version: '6.032' - class: Dist::Zilla::Plugin::NextRelease name: '@DROLSKY/NextRelease' version: '6.032' - class: Dist::Zilla::Plugin::Prereqs config: Dist::Zilla::Plugin::Prereqs: phase: test type: requires name: '@DROLSKY/Test::More with Test2' version: '6.032' - class: Dist::Zilla::Plugin::Prereqs config: Dist::Zilla::Plugin::Prereqs: phase: develop type: requires name: '@DROLSKY/Tools for use with precious' version: '6.032' - class: Dist::Zilla::Plugin::Prereqs config: Dist::Zilla::Plugin::Prereqs: phase: develop type: requires name: '@DROLSKY/Test::Version which fixes https://github.com/plicease/Test-Version/issues/7' version: '6.032' - class: Dist::Zilla::Plugin::PromptIfStale config: Dist::Zilla::Plugin::PromptIfStale: check_all_plugins: 0 check_all_prereqs: 0 modules: - Dist::Zilla::PluginBundle::DROLSKY phase: build run_under_travis: 0 skip: [] name: '@DROLSKY/Dist::Zilla::PluginBundle::DROLSKY' version: '0.060' - class: Dist::Zilla::Plugin::PromptIfStale config: Dist::Zilla::Plugin::PromptIfStale: check_all_plugins: 1 check_all_prereqs: 1 modules: [] phase: release run_under_travis: 0 skip: - Dist::Zilla::Plugin::DROLSKY::BundleAuthordep - Dist::Zilla::Plugin::DROLSKY::Contributors - Dist::Zilla::Plugin::DROLSKY::Git::CheckFor::CorrectBranch - Dist::Zilla::Plugin::DROLSKY::License - Dist::Zilla::Plugin::DROLSKY::MakeMaker - Dist::Zilla::Plugin::DROLSKY::PerlLinterConfigFiles - Dist::Zilla::Plugin::DROLSKY::Precious - Dist::Zilla::Plugin::DROLSKY::Test::Precious - Dist::Zilla::Plugin::DROLSKY::WeaverConfig - Pod::Weaver::PluginBundle::DROLSKY name: '@DROLSKY/PromptIfStale' version: '0.060' - class: Dist::Zilla::Plugin::Test::Pod::Coverage::Configurable name: '@DROLSKY/Test::Pod::Coverage::Configurable' version: '0.07' - class: Dist::Zilla::Plugin::Test::PodSpelling config: Dist::Zilla::Plugin::Test::PodSpelling: directories: - bin - lib spell_cmd: '' stopwords: - AALLAN - Alasdair - DDD - DROLSKY - "DROLSKY's" - Iain - JOHNL - Katana - Leffler - MMDD - McCauley - PDX - PayPal - Rolsky - "Rolsky's" - Truskett - Www - WwwD - YWww - YWwwD - YY - YYDDD - YYMM - YYMMDD - YYWww - YYWwwD - YYYY - YYYYDDD - YYYYDDDThhmm - YYYYDDDThhmmZ - YYYYMMDD - YYYYMMDDThhmm - YYYYMMDDThhmmZ - YYYYMMDDThhmmss - YYYYMMDDThhmmssZ - YYYYWww - YYYYWwwD - drolsky - hh - hhZ - hhmm - hhmmZ - hhmmss - hhmmssZ - mmss - ss - ssZ wordlist: Pod::Wordlist name: '@DROLSKY/Test::PodSpelling' version: '2.007006' - class: Dist::Zilla::Plugin::PodSyntaxTests name: '@DROLSKY/PodSyntaxTests' version: '6.032' - class: Dist::Zilla::Plugin::MojibakeTests name: '@DROLSKY/MojibakeTests' version: '0.8' - class: Dist::Zilla::Plugin::RunExtraTests config: Dist::Zilla::Role::TestRunner: default_jobs: '12' name: '@DROLSKY/RunExtraTests' version: '0.029' - class: Dist::Zilla::Plugin::Test::CPAN::Changes config: Dist::Zilla::Plugin::Test::CPAN::Changes: changelog: Changes filename: xt/release/cpan-changes.t name: '@DROLSKY/Test::CPAN::Changes' version: '0.013' - class: Dist::Zilla::Plugin::Test::CPAN::Meta::JSON name: '@DROLSKY/Test::CPAN::Meta::JSON' version: '0.004' - class: Dist::Zilla::Plugin::Test::EOL config: Dist::Zilla::Plugin::Test::EOL: filename: xt/author/eol.t finder: - ':ExecFiles' - ':InstallModules' - ':TestFiles' trailing_whitespace: 1 name: '@DROLSKY/Test::EOL' version: '0.19' - class: Dist::Zilla::Plugin::Test::NoTabs config: Dist::Zilla::Plugin::Test::NoTabs: filename: xt/author/no-tabs.t finder: - ':InstallModules' - ':ExecFiles' - ':TestFiles' name: '@DROLSKY/Test::NoTabs' version: '0.15' - class: Dist::Zilla::Plugin::Test::Portability config: Dist::Zilla::Plugin::Test::Portability: options: '' name: '@DROLSKY/Test::Portability' version: '2.001003' - class: Dist::Zilla::Plugin::Test::Synopsis name: '@DROLSKY/Test::Synopsis' version: '2.000007' - class: Dist::Zilla::Plugin::Test::Compile config: Dist::Zilla::Plugin::Test::Compile: bail_out_on_fail: 0 fail_on_warning: author fake_home: 0 filename: xt/author/00-compile.t module_finder: - ':InstallModules' needs_display: 0 phase: develop script_finder: - ':PerlExecFiles' skips: [] switch: [] name: '@DROLSKY/Test::Compile' version: '2.058' - class: Dist::Zilla::Plugin::Test::ReportPrereqs name: '@DROLSKY/Test::ReportPrereqs' version: '0.029' - class: Dist::Zilla::Plugin::Test::Version name: '@DROLSKY/Test::Version' version: '1.09' - class: Dist::Zilla::Plugin::DROLSKY::Test::Precious name: '@DROLSKY/DROLSKY::Test::Precious' version: '1.22' - class: Dist::Zilla::Plugin::DROLSKY::Contributors name: '@DROLSKY/DROLSKY::Contributors' version: '1.22' - class: Dist::Zilla::Plugin::Git::Contributors config: Dist::Zilla::Plugin::Git::Contributors: git_version: 2.48.1 include_authors: 0 include_releaser: 1 order_by: name paths: [] name: '@DROLSKY/Git::Contributors' version: '0.037' - class: Dist::Zilla::Plugin::SurgicalPodWeaver config: Dist::Zilla::Plugin::PodWeaver: config_plugins: - '@DROLSKY' finder: - ':InstallModules' - ':PerlExecFiles' plugins: - class: Pod::Weaver::Plugin::EnsurePod5 name: '@CorePrep/EnsurePod5' version: '4.019' - class: Pod::Weaver::Plugin::H1Nester name: '@CorePrep/H1Nester' version: '4.019' - class: Pod::Weaver::Plugin::SingleEncoding name: '@DROLSKY/SingleEncoding' version: '4.019' - class: Pod::Weaver::Plugin::Transformer name: '@DROLSKY/List' version: '4.019' - class: Pod::Weaver::Plugin::Transformer name: '@DROLSKY/Verbatim' version: '4.019' - class: Pod::Weaver::Section::Region name: '@DROLSKY/header' version: '4.019' - class: Pod::Weaver::Section::Name name: '@DROLSKY/Name' version: '4.019' - class: Pod::Weaver::Section::Version name: '@DROLSKY/Version' version: '4.019' - class: Pod::Weaver::Section::Region name: '@DROLSKY/prelude' version: '4.019' - class: Pod::Weaver::Section::Generic name: SYNOPSIS version: '4.019' - class: Pod::Weaver::Section::Generic name: DESCRIPTION version: '4.019' - class: Pod::Weaver::Section::Generic name: OVERVIEW version: '4.019' - class: Pod::Weaver::Section::Collect name: ATTRIBUTES version: '4.019' - class: Pod::Weaver::Section::Collect name: METHODS version: '4.019' - class: Pod::Weaver::Section::Collect name: FUNCTIONS version: '4.019' - class: Pod::Weaver::Section::Collect name: TYPES version: '4.019' - class: Pod::Weaver::Section::Leftovers name: '@DROLSKY/Leftovers' version: '4.019' - class: Pod::Weaver::Section::Region name: '@DROLSKY/postlude' version: '4.019' - class: Pod::Weaver::Section::GenerateSection name: '@DROLSKY/generate SUPPORT' version: '4.019' - class: Pod::Weaver::Section::AllowOverride name: '@DROLSKY/allow override SUPPORT' version: '0.05' - class: Pod::Weaver::Section::GenerateSection name: '@DROLSKY/generate SOURCE' version: '4.019' - class: Pod::Weaver::Section::Authors name: '@DROLSKY/Authors' version: '4.019' - class: Pod::Weaver::Section::Contributors name: '@DROLSKY/Contributors' version: '0.009' - class: Pod::Weaver::Section::Legal name: '@DROLSKY/Legal' version: '4.019' - class: Pod::Weaver::Section::AllowOverride name: '@DROLSKY/allow override Legal' version: '0.05' - class: Pod::Weaver::Section::Region name: '@DROLSKY/footer' version: '4.019' name: '@DROLSKY/SurgicalPodWeaver' version: '0.0023' - class: Dist::Zilla::Plugin::DROLSKY::WeaverConfig name: '@DROLSKY/DROLSKY::WeaverConfig' version: '1.22' - class: Dist::Zilla::Plugin::ReadmeAnyFromPod config: Dist::Zilla::Role::FileWatcher: version: '0.006' name: '@DROLSKY/README.md in build' version: '0.163250' - class: Dist::Zilla::Plugin::GenerateFile::FromShareDir config: Dist::Zilla::Plugin::GenerateFile::FromShareDir: destination_filename: CONTRIBUTING.md dist: Dist-Zilla-PluginBundle-DROLSKY encoding: UTF-8 has_xs: 0 location: build source_filename: CONTRIBUTING.md Dist::Zilla::Role::RepoFileInjector: allow_overwrite: 1 repo_root: . version: '0.009' name: '@DROLSKY/Generate CONTRIBUTING.md' version: '0.015' - class: Dist::Zilla::Plugin::GenerateFile::FromShareDir config: Dist::Zilla::Plugin::GenerateFile::FromShareDir: destination_filename: CODE_OF_CONDUCT.md dist: Dist-Zilla-PluginBundle-DROLSKY encoding: UTF-8 has_xs: 0 location: build source_filename: CODE_OF_CONDUCT.md Dist::Zilla::Role::RepoFileInjector: allow_overwrite: 1 repo_root: . version: '0.009' name: '@DROLSKY/Generate CODE_OF_CONDUCT.md' version: '0.015' - class: Dist::Zilla::Plugin::InstallGuide config: Dist::Zilla::Role::ModuleMetadata: Module::Metadata: '1.000037' version: '0.006' name: '@DROLSKY/InstallGuide' version: '1.200014' - class: Dist::Zilla::Plugin::CPANFile name: '@DROLSKY/CPANFile' version: '6.032' - class: Dist::Zilla::Plugin::DROLSKY::License name: '@DROLSKY/DROLSKY::License' version: '1.22' - class: Dist::Zilla::Plugin::CheckStrictVersion name: '@DROLSKY/CheckStrictVersion' version: '0.001' - class: Dist::Zilla::Plugin::CheckSelfDependency config: Dist::Zilla::Plugin::CheckSelfDependency: finder: - ':InstallModules' Dist::Zilla::Role::ModuleMetadata: Module::Metadata: '1.000037' version: '0.006' name: '@DROLSKY/CheckSelfDependency' version: '0.011' - class: Dist::Zilla::Plugin::CheckPrereqsIndexed name: '@DROLSKY/CheckPrereqsIndexed' version: '0.022' - class: Dist::Zilla::Plugin::DROLSKY::Git::CheckFor::CorrectBranch config: Dist::Zilla::Role::Git::Repo: git_version: 2.48.1 repo_root: . name: '@DROLSKY/DROLSKY::Git::CheckFor::CorrectBranch' version: '1.22' - class: Dist::Zilla::Plugin::EnsureChangesHasContent name: '@DROLSKY/EnsureChangesHasContent' version: '0.02' - class: Dist::Zilla::Plugin::Git::CheckFor::MergeConflicts config: Dist::Zilla::Role::Git::Repo: git_version: 2.48.1 repo_root: . name: '@DROLSKY/Git::CheckFor::MergeConflicts' version: '0.014' - class: Dist::Zilla::Plugin::DROLSKY::PerlLinterConfigFiles name: '@DROLSKY/DROLSKY::PerlLinterConfigFiles' version: '1.22' - class: Dist::Zilla::Plugin::DROLSKY::DevTools name: '@DROLSKY/DROLSKY::DevTools' version: '1.22' - class: Dist::Zilla::Plugin::DROLSKY::Precious name: '@DROLSKY/DROLSKY::Precious' version: '1.22' - class: Dist::Zilla::Plugin::Git::Check config: Dist::Zilla::Plugin::Git::Check: untracked_files: die Dist::Zilla::Role::Git::DirtyFiles: allow_dirty: - CODE_OF_CONDUCT.md - CONTRIBUTING.md - Changes - LICENSE - Makefile.PL - README.md - cpanfile - precious.toml allow_dirty_match: [] changelog: Changes Dist::Zilla::Role::Git::Repo: git_version: 2.48.1 repo_root: . name: '@DROLSKY/Git::Check' version: '2.051' - class: Dist::Zilla::Plugin::Git::Commit config: Dist::Zilla::Plugin::Git::Commit: add_files_in: [] commit_msg: v%V%n%n%c signoff: 0 Dist::Zilla::Role::Git::DirtyFiles: allow_dirty: - CODE_OF_CONDUCT.md - CONTRIBUTING.md - Changes - LICENSE - Makefile.PL - README.md - cpanfile - precious.toml allow_dirty_match: [] changelog: Changes Dist::Zilla::Role::Git::Repo: git_version: 2.48.1 repo_root: . Dist::Zilla::Role::Git::StringFormatter: time_zone: local name: '@DROLSKY/Commit generated files' version: '2.051' - class: Dist::Zilla::Plugin::Git::Tag config: Dist::Zilla::Plugin::Git::Tag: branch: ~ changelog: Changes signed: 0 tag: v0.17 tag_format: v%V tag_message: v%V Dist::Zilla::Role::Git::Repo: git_version: 2.48.1 repo_root: . Dist::Zilla::Role::Git::StringFormatter: time_zone: local name: '@DROLSKY/Git::Tag' version: '2.051' - class: Dist::Zilla::Plugin::Git::Push config: Dist::Zilla::Plugin::Git::Push: push_to: - origin remotes_must_exist: 1 Dist::Zilla::Role::Git::Repo: git_version: 2.48.1 repo_root: . name: '@DROLSKY/Git::Push' version: '2.051' - class: Dist::Zilla::Plugin::BumpVersionAfterRelease config: Dist::Zilla::Plugin::BumpVersionAfterRelease: finders: - ':ExecFiles' - ':InstallModules' global: 0 munge_makefile_pl: 1 name: '@DROLSKY/BumpVersionAfterRelease' version: '0.018' - class: Dist::Zilla::Plugin::Git::Commit config: Dist::Zilla::Plugin::Git::Commit: add_files_in: [] commit_msg: 'Bump version after release' signoff: 0 Dist::Zilla::Role::Git::DirtyFiles: allow_dirty: - Changes - dist.ini allow_dirty_match: - (?^:.+) changelog: Changes Dist::Zilla::Role::Git::Repo: git_version: 2.48.1 repo_root: . Dist::Zilla::Role::Git::StringFormatter: time_zone: local name: '@DROLSKY/Commit version bump' version: '2.051' - class: Dist::Zilla::Plugin::Git::Push config: Dist::Zilla::Plugin::Git::Push: push_to: - origin remotes_must_exist: 1 Dist::Zilla::Role::Git::Repo: git_version: 2.48.1 repo_root: . name: '@DROLSKY/Push version bump' version: '2.051' - class: Dist::Zilla::Plugin::DROLSKY::MakeMaker config: Dist::Zilla::Plugin::MakeMaker: make_path: make version: '6.032' Dist::Zilla::Plugin::MakeMaker::Awesome: version: '0.49' Dist::Zilla::Role::TestRunner: default_jobs: '12' version: '6.032' name: '@DROLSKY/DROLSKY::MakeMaker' version: '1.22' - class: Dist::Zilla::Plugin::FinderCode name: ':InstallModules' version: '6.032' - class: Dist::Zilla::Plugin::FinderCode name: ':IncModules' version: '6.032' - class: Dist::Zilla::Plugin::FinderCode name: ':TestFiles' version: '6.032' - class: Dist::Zilla::Plugin::FinderCode name: ':ExtraTestFiles' version: '6.032' - class: Dist::Zilla::Plugin::FinderCode name: ':ExecFiles' version: '6.032' - class: Dist::Zilla::Plugin::FinderCode name: ':PerlExecFiles' version: '6.032' - class: Dist::Zilla::Plugin::FinderCode name: ':ShareFiles' version: '6.032' - class: Dist::Zilla::Plugin::FinderCode name: ':MainModule' version: '6.032' - class: Dist::Zilla::Plugin::FinderCode name: ':AllFiles' version: '6.032' - class: Dist::Zilla::Plugin::FinderCode name: ':NoFiles' version: '6.032' - class: Dist::Zilla::Plugin::FinderCode name: '@DROLSKY/MetaProvides::Package/AUTOVIV/:InstallModulesPM' version: '6.032' zilla: class: Dist::Zilla::Dist::Builder config: is_trial: 0 version: '6.032' x_authority: cpan:DROLSKY x_contributors: - 'Doug Bell ' - 'joe ' - 'Liam Widdowson ' - 'Thomas Klausner ' - 'William Ricker ' x_generated_by_perl: v5.38.2 x_serialization_backend: 'YAML::Tiny version 1.74' x_spdx_expression: 'Artistic-1.0-Perl OR GPL-1.0-or-later' DateTime-Format-ISO8601-0.17/Changes0000644000175000017500000001070614756442575016514 0ustar autarchautarch0.17 2025-02-22 - Fixed an issue with converting floating point second values to nanoseconds. These could be converted to numbers which Perl stringified as an integer, but which really had a non-integer component. Fixed by @n1vux (Bill Ricker). Fixes GH #14 via PR #15. 0.16 2021-02-14 - Add support for YYYYMMDDThhmm[+-]hhmm and YYYY-MM-DDThh:mm+hh:mm formats. Based on GH #13 from lbjw. 0.15 2020-10-24 - Fixed the SYNOPSIS, which showed calling parse_time with a string that would cause an error. Reported by Yuki Yoshida. GH #12. 0.14 2020-08-16 - Require DateTime 1.45, which added a year_length() method that this package is now using. Reported by Slaven Rezić. GH #11. 0.13 2020-08-15 - Added support for a few more incomplete formats, YYYYMMDDThhmmZ, YYYY-MM-DDThh:mmZ, YYYYDDDThhmm, YYYY-DDDThh:mm. Includes a patch from Stuart Browne. Fixed GH #3. 0.12 2020-08-15 - Fixed handling of ISO week parsing in some years. Reported by Kent Fredric. GH #6. - This release includes changes from 0.09-0.11 trial releases to switch from Params::Validate and Params::ValidationCompiler. Relevant release notes from those trial releases are repeated here for clarity. - Replace Params::Validate with Params::ValidationCompiler. - Fixed a bug introduced in 0.09 where calling parse_datetime() as a class method with some formats would throw an exception. - Add a format_datetime() method, which makes this class play nicer with DateTime.pm. Implemented by Doug Bell. https://github.com/jhoblitt/DateTime-Format-ISO8601/pull/2 - Add support for the `YYYY-MM-DDThh:mm:ss.ss[+-]hh` and `YYYYMMDDThhmmss.ss[+-]hh` formats. Implemented by Thomas Klausner. https://github.com/jhoblitt/DateTime-Format-ISO8601/pull/3 0.11 2020-07-26 (TRIAL RELEASE) - Replace Params::Validate with Params::ValidationCompiler. 0.10 2020-07-25 (TRIAL RELEASE) - Fixed a bug introduced in 0.09 where calling parse_datetime() as a class method with some formats would throw an exception. 0.09 2020-07-25 (TRIAL RELEASE) - Add a format_datetime() method, which makes this class play nicer with DateTime.pm. Implemented by Doug Bell. https://github.com/jhoblitt/DateTime-Format-ISO8601/pull/2 - Add support for the `YYYY-MM-DDThh:mm:ss.ss[+-]hh` and `YYYYMMDDThhmmss.ss[+-]hh` formats. Implemented by Thomas Klausner. https://github.com/jhoblitt/DateTime-Format-ISO8601/pull/3 0.08 2012-02-11 - rt.cpan.org #52645 : UTC offsets must be in the same format (basic|extended) as the time as to which it is attached. 0.07 2010-01-17 - fix test failures caused by tests using DateTime->now(), all tests should now pass regardless of the "wallclock" when they are being run 0.06 2007-04-10 - add Test::Distribution tests - merge rel_0_04_FIXES branch -- fixing the major regressions introduced in 0.05 0.05 2007-03-27 - disable a test that may fail depending on the localtime date 0.0403 2005-08-07 - update doc format - tidy Build.PL - auto-generate Makefile.PL - change set_base_datetime() to use DT's overloaded <=> instead of ->compare() - tidy test sources and reduce runtime 0.0402 2004-10-28 - add 8 missing formats, patch by Kelly McCauley 0.0401 2004-02-08 - fix test for -DDD format as reported by Jonathan Leffler 0.04 2003-11-15 - require DT 0.18 and DT::F::B 0.77 - recommend Test::Pod 0.95 and File::Find::Rule 0.24 - doc update - test update - fix bug in -YY spec - default handling of 2-digit years is now 0-49 as 20xx and 50-99 as 19xx - add DefaultCutOffYear() - add DefaultLegacyYear() - add base_datetime() - add clone() - add cut_off_year() - add legacy_year() - add new() - add set_base_datetime() - add set_cut_off_year() - add set_legacy_year() 0.03 2003-07-03 - require DT::F::B 0.75 - 'constructor' in specrefs instead of _normalize_day() - removed _normalize_day() - speed enhancement from internals cleanup - fixed _normalize_week to properly handle week specified without a day of week - fixed ISO week day tests (count from zero instead of 1 error) - ISO8601 sections 5.3.1.1 - 5.3.1.3 and 5.3.3 - 5.3.4.2 maybe prefixed with 'T' - doc update 0.02 2003-06-26 - require DT 0.13 and DT::F::B 0.74 - dropped Date::ISO dep - length based string matching where possible - support '.' as a fractional time separator - slightly better docs - bug fix for _add_minute() 0.01 2003-06-21 - support ISO8601 date/time formats DateTime-Format-ISO8601-0.17/CONTRIBUTING.md0000644000175000017500000001044414756442575017451 0ustar autarchautarch# CONTRIBUTING Thank you for considering contributing to this distribution. This file contains instructions that will help you work with the source code. Please note that if you have any questions or difficulties, you can reach the maintainer(s) through the bug queue described later in this document (preferred), or by emailing the releaser directly. You are not required to follow any of the steps in this document to submit a patch or bug report; these are just recommendations, intended to help you (and help us help you faster). The distribution is managed with [Dist::Zilla](https://metacpan.org/release/Dist-Zilla). However, you can still compile and test the code with the `Makefile.PL` in the repository: perl Makefile.PL make make test You may need to satisfy some dependencies. The easiest way to satisfy dependencies is to install the last release. This is available at https://metacpan.org/release/DateTime-Format-ISO8601 You can use [`cpanminus`](https://metacpan.org/pod/App::cpanminus) to do this without downloading the tarball first: $> cpanm --reinstall --installdeps --with-recommends DateTime::Format::ISO8601 [`Dist::Zilla`](https://metacpan.org/pod/Dist::Zilla) is a very powerful authoring tool, but requires a number of author-specific plugins. If you would like to use it for contributing, install it from CPAN, then the following command to install the needed distros: $> dzil authordeps --missing | cpanm There may also be additional requirements not needed by the dzil build which are needed for tests or other development: $> dzil listdeps --author --missing | cpanm Or, you can use the 'dzil stale' command to install all requirements at once: $> cpanm Dist::Zilla::App::Command::stale $> dzil stale --all | cpanm You can also do this via cpanm directly: $> cpanm --reinstall --installdeps --with-develop --with-recommends DateTime::Format::ISO8601 Once installed, here are some dzil commands you might try: $> dzil build $> dzil test $> dzil test --release $> dzil xtest $> dzil listdeps --json $> dzil build --notgz You can learn more about Dist::Zilla at http://dzil.org/. The code for this distribution is [hosted on GitHub](https://github.com/houseabsolute/DateTime-Format-ISO8601). You can submit code changes by forking the repository, pushing your code changes to your clone, and then submitting a pull request. Please update the Changes file with a user-facing description of your changes as part of your work. See the GitHub documentation for [detailed instructions on pull requests](https://help.github.com/articles/creating-a-pull-request) If you have found a bug, but do not have an accompanying patch to fix it, you can submit an issue report [via the web](https://github.com/houseabsolute/DateTime-Format-ISO8601/issues). ## Continuous Integration All pull requests for this distribution will be automatically tested using [Azure Pipelines](https://dev.azure.com/houseabsolute/houseabsolute/_build). All CI results will be visible in the pull request on GitHub. Follow the appropriate links for details when tests fail. PRs cannot be merged until tests pass. ## Precious This distribution uses [precious](https://github.com/houseabsolute/precious) to enforce a uniform coding style. This is tested as part of the author testing suite. You can install this and any other necessary non-Perl tools by running `./dev-bin/install-xt-tools.sh`. Then you can use `precious` to tidy and lint your code: $> precious tidy -a $> precious lint -a Please run `precious tidy -a` and `precious lint -a` before committing your changes and address any issues that it reports. You can also set up a git pre-commit hook that checks all changed files for linting issues by running `./git/setup.pl`. ## Contributor Names If you send a patch or pull request, your name and email address will be included in the documentation as a contributor (using the attribution on the commit or patch), unless you specifically request for it not to be. If you wish to be listed under a different name or address, you should submit a pull request to the `.mailmap` file to contain the correct mapping. ## Generated By This file was generated via Dist::Zilla::Plugin::GenerateFile::FromShareDir 0.015 from a template file originating in Dist-Zilla-PluginBundle-DROLSKY-1.22. DateTime-Format-ISO8601-0.17/LICENSE0000644000175000017500000004643514756442575016236 0ustar autarchautarchThis software is copyright (c) 2025 by Joshua Hoblitt. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. Terms of the Perl programming language system itself a) the GNU General Public License as published by the Free Software Foundation; either version 1, or (at your option) any later version, or b) the "Artistic License" --- The GNU General Public License, Version 1, February 1989 --- This software is Copyright (c) 2025 by Joshua Hoblitt. This is free software, licensed under: The GNU General Public License, Version 1, February 1989 GNU GENERAL PUBLIC LICENSE Version 1, February 1989 Copyright (C) 1989 Free Software Foundation, Inc. 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The license agreements of most software companies try to keep users at the mercy of those companies. By contrast, our General Public License is intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. The General Public License applies to the Free Software Foundation's software and to any other program whose authors commit to using it. You can use it for your programs, too. When we speak of free software, we are referring to freedom, not price. Specifically, the General Public License is designed to make sure that you have the freedom to give away or sell copies of free software, that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things. To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it. For example, if you distribute copies of a such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must tell them their rights. We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software. Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations. The precise terms and conditions for copying, distribution and modification follow. GNU GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License Agreement applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The "Program", below, refers to any such program or work, and a "work based on the Program" means either the Program or any work containing the Program or a portion of it, either verbatim or with modifications. Each licensee is addressed as "you". 1. You may copy and distribute verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this General Public License and to the absence of any warranty; and give any other recipients of the Program a copy of this General Public License along with the Program. You may charge a fee for the physical act of transferring a copy. 2. You may modify your copy or copies of the Program or any portion of it, and copy and distribute such modifications under the terms of Paragraph 1 above, provided that you also do the following: a) cause the modified files to carry prominent notices stating that you changed the files and the date of any change; and b) cause the whole of any work that you distribute or publish, that in whole or in part contains the Program or any part thereof, either with or without modifications, to be licensed at no charge to all third parties under the terms of this General Public License (except that you may choose to grant warranty protection to some or all third parties, at your option). c) If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the simplest and most usual way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this General Public License. d) You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. Mere aggregation of another independent work with the Program (or its derivative) on a volume of a storage or distribution medium does not bring the other work under the scope of these terms. 3. You may copy and distribute the Program (or a portion or derivative of it, under Paragraph 2) in object code or executable form under the terms of Paragraphs 1 and 2 above provided that you also do one of the following: a) accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Paragraphs 1 and 2 above; or, b) accompany it with a written offer, valid for at least three years, to give any third party free (except for a nominal charge for the cost of distribution) a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Paragraphs 1 and 2 above; or, c) accompany it with the information you received as to where the corresponding source code may be obtained. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form alone.) Source code for a work means the preferred form of the work for making modifications to it. For an executable file, complete source code means all the source code for all modules it contains; but, as a special exception, it need not include source code for modules which are standard libraries that accompany the operating system on which the executable file runs, or for standard header files or definitions files that accompany that operating system. 4. You may not copy, modify, sublicense, distribute or transfer the Program except as expressly provided under this General Public License. Any attempt otherwise to copy, modify, sublicense, distribute or transfer the Program is void, and will automatically terminate your rights to use the Program under this License. However, parties who have received copies, or rights to use copies, from you under this General Public License will not have their licenses terminated so long as such parties remain in full compliance. 5. By copying, distributing or modifying the Program (or any work based on the Program) you indicate your acceptance of this license to do so, and all its terms and conditions. 6. Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. 7. The Free Software Foundation may publish revised and/or new versions of the General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies a version number of the license which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of the license, you may choose any version ever published by the Free Software Foundation. 8. If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 9. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 10. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS Appendix: How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to humanity, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) 19yy This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 1, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA Also add information on how to contact you by electronic and paper mail. If the program is interactive, make it output a short notice like this when it starts in an interactive mode: Gnomovision version 69, Copyright (C) 19xx name of author Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, the commands you use may be called something other than `show w' and `show c'; they could even be mouse-clicks or menu items--whatever suits your program. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the program, if necessary. Here a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the program `Gnomovision' (a program to direct compilers to make passes at assemblers) written by James Hacker. , 1 April 1989 Ty Coon, President of Vice That's all there is to it! --- The Perl Artistic License 1.0 --- This software is Copyright (c) 2025 by Joshua Hoblitt. This is free software, licensed under: The Perl Artistic License 1.0 The "Artistic License" Preamble The intent of this document is to state the conditions under which a Package may be copied, such that the Copyright Holder maintains some semblance of artistic control over the development of the package, while giving the users of the package the right to use and distribute the Package in a more-or-less customary fashion, plus the right to make reasonable modifications. Definitions: "Package" refers to the collection of files distributed by the Copyright Holder, and derivatives of that collection of files created through textual modification. "Standard Version" refers to such a Package if it has not been modified, or has been modified in accordance with the wishes of the Copyright Holder as specified below. "Copyright Holder" is whoever is named in the copyright or copyrights for the package. "You" is you, if you're thinking about copying or distributing this Package. "Reasonable copying fee" is whatever you can justify on the basis of media cost, duplication charges, time of people involved, and so on. (You will not be required to justify it to the Copyright Holder, but only to the computing community at large as a market that must bear the fee.) "Freely Available" means that no fee is charged for the item itself, though there may be fees involved in handling the item. It also means that recipients of the item may redistribute it under the same conditions they received it. 1. You may make and give away verbatim copies of the source form of the Standard Version of this Package without restriction, provided that you duplicate all of the original copyright notices and associated disclaimers. 2. You may apply bug fixes, portability fixes and other modifications derived from the Public Domain or from the Copyright Holder. A Package modified in such a way shall still be considered the Standard Version. 3. You may otherwise modify your copy of this Package in any way, provided that you insert a prominent notice in each changed file stating how and when you changed that file, and provided that you do at least ONE of the following: a) place your modifications in the Public Domain or otherwise make them Freely Available, such as by posting said modifications to Usenet or an equivalent medium, or placing the modifications on a major archive site such as uunet.uu.net, or by allowing the Copyright Holder to include your modifications in the Standard Version of the Package. b) use the modified Package only within your corporation or organization. c) rename any non-standard executables so the names do not conflict with standard executables, which must also be provided, and provide a separate manual page for each non-standard executable that clearly documents how it differs from the Standard Version. d) make other distribution arrangements with the Copyright Holder. 4. You may distribute the programs of this Package in object code or executable form, provided that you do at least ONE of the following: a) distribute a Standard Version of the executables and library files, together with instructions (in the manual page or equivalent) on where to get the Standard Version. b) accompany the distribution with the machine-readable source of the Package with your modifications. c) give non-standard executables non-standard names, and clearly document the differences in manual pages (or equivalent), together with instructions on where to get the Standard Version. d) make other distribution arrangements with the Copyright Holder. 5. You may charge a reasonable copying fee for any distribution of this Package. You may charge any fee you choose for support of this Package. You may not charge a fee for this Package itself. However, you may distribute this Package in aggregate with other (possibly commercial) programs as part of a larger (possibly commercial) software distribution provided that you do not advertise this Package as a product of your own. You may embed this Package's interpreter within an executable of yours (by linking); this shall be construed as a mere form of aggregation, provided that the complete Standard Version of the interpreter is so embedded. 6. The scripts and library files supplied as input to or produced as output from the programs of this Package do not automatically fall under the copyright of this Package, but belong to whoever generated them, and may be sold commercially, and may be aggregated with this Package. If such scripts or library files are aggregated with this Package via the so-called "undump" or "unexec" methods of producing a binary executable image, then distribution of such an image shall neither be construed as a distribution of this Package nor shall it fall under the restrictions of Paragraphs 3 and 4, provided that you do not represent such an executable image as a Standard Version of this Package. 7. C subroutines (or comparably compiled subroutines in other languages) supplied by you and linked into this Package in order to emulate subroutines and variables of the language defined by this Package shall not be considered part of this Package, but are the equivalent of input as in Paragraph 6, provided these subroutines do not change the language in any way that would cause it to fail the regression tests for the language. 8. Aggregation of this Package with a commercial distribution is always permitted provided that the use of this Package is embedded; that is, when no overt attempt is made to make this Package's interfaces visible to the end user of the commercial distribution. Such use shall not be construed as a distribution of this Package. 9. The name of the Copyright Holder may not be used to endorse or promote products derived from this software without specific prior written permission. 10. THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. The End DateTime-Format-ISO8601-0.17/git/0000775000175000017500000000000014756442575016002 5ustar autarchautarchDateTime-Format-ISO8601-0.17/git/hooks/0000775000175000017500000000000014756442575017125 5ustar autarchautarchDateTime-Format-ISO8601-0.17/git/hooks/pre-commit.sh0000755000175000017500000000027014756442575021535 0ustar autarchautarch#!/bin/bash status=0 PRECIOUS=$(which precious) if [[ -z $PRECIOUS ]]; then PRECIOUS=./bin/precious fi "$PRECIOUS" lint -s if (( $? != 0 )); then status+=1 fi exit $status DateTime-Format-ISO8601-0.17/git/setup.pl0000755000175000017500000000076414756442575017507 0ustar autarchautarch#!/usr/bin/env perl use strict; use warnings; use Cwd qw( abs_path ); symlink_hook('pre-commit'); sub symlink_hook { my $hook = shift; my $dot = ".git/hooks/$hook"; my $file = "git/hooks/$hook.sh"; my $link = "../../$file"; if ( -e $dot ) { if ( -l $dot ) { return if readlink $dot eq $link; } warn "You already have a hook at $dot!\n"; return; } symlink $link, $dot or die "Could not link $dot => $link: $!"; } DateTime-Format-ISO8601-0.17/README.md0000644000175000017500000002270714756442575016504 0ustar autarchautarch# NAME DateTime::Format::ISO8601 - Parses ISO8601 formats # VERSION version 0.17 # SYNOPSIS use DateTime::Format::ISO8601; my $datetime_str = '2020-07-25T11:32:31'; my $dt = DateTime::Format::ISO8601->parse_datetime($datetime_str); say $dt; # This format is ambiguous and could be either a date or time, so use the # parse_time method. my $time_str = '113231'; $dt = DateTime::Format::ISO8601->parse_time($time_str); say $dt; # or my $iso8601 = DateTime::Format::ISO8601->new; $dt = $iso8601->parse_datetime($datetime_str); say $dt; $dt = $iso8601->parse_time($time_str); say $dt; say DateTime::Format::ISO8601->format_datetime($dt); # DESCRIPTION Parses almost all ISO8601 date and time formats. ISO8601 time-intervals will be supported in a later release. # METHODS This class provides the following methods: ## Constructors ### DateTime::Format::ISO8601->new( ... ) Accepts an optional hash. my $iso8601 = DateTime::Format::ISO8601->new( base_datetime => $dt, cut_off_year => 42, legacy_year => 1, ); - base\_datetime A `DateTime` object that will be used to fill in missing information from incomplete date/time formats. This key is optional. - cut\_off\_year A integer representing the cut-off point between interpreting 2-digits years as 19xx or 20xx. 2-digit years < cut_off_year will be interpreted as 20xx 2-digit years >= cut_off_year will be untreated as 19xx This key defaults to the value of `DefaultCutOffYear`. - legacy\_year A boolean value controlling if a 2-digit year is interpreted as being in the current century (unless a `base_datetime` is set) or if `cut_off_year` should be used to place the year in either 20xx or 19xx. If this is true, then the `cut_off_year` is used. If this is false, then the year is always interpreted as being in the current century. This key defaults to the value of `DefaultLegacyYear`. ### $iso8601->clone Returns a replica of the given object. ## Object Methods ### $iso8601->base\_datetime Returns a `DateTime` object if a `base_datetime` has been set. ### $iso8601->set\_base\_datetime( object => $object ) Accepts a `DateTime` object that will be used to fill in missing information from incomplete date/time formats. ### $iso8601->cut\_off\_year Returns a integer representing the cut-off point between interpreting 2-digits years as 19xx or 20xx. ### $iso8601->set\_cut\_off\_year($int) Accepts a integer representing the cut-off point between interpreting 2-digits years as 19xx or 20xx. 2-digit years < legacy_year will be interpreted as 20xx 2-digit years >= legacy_year will be interpreted as 19xx ### $iso8601->legacy\_year Returns a boolean value indicating the 2-digit year handling behavior. ### $iso8601->set\_legacy\_year($bool) Accepts a boolean value controlling if a 2-digit year is interpreted as being in the current century (unless a `base_datetime` is set) or if `cut_off_year` should be used to place the year in either 20xx or 19xx. ## Class Methods ### DateTime::Format::ISO8601->DefaultCutOffYear($int) Accepts a integer representing the cut-off point for 2-digit years when calling `parse_*` as class methods and the default value for `cut_off_year` when creating objects. If called with no parameters this method will return the default value for `cut_off_year`. ### DateTime::Format::ISO8601->DefaultLegacyYear($bool) Accepts a boolean value controlling the legacy year behavior when calling `parse_*` as class methods and the default value for `legacy_year` when creating objects. If called with no parameters this method will return the default value for `legacy_year`. ## Parser(s) These methods may be called as either class or object methods. ### parse\_datetime ### parse\_time Please see the ["FORMATS"](#formats) section. ## Formatter This may be called as either class or object method. ### format\_datetime($dt) Formats the datetime in an ISO8601-compatible format. This differs from ["iso8601" in DateTime](https://metacpan.org/pod/DateTime#iso8601) by including nanoseconds/milliseconds and the correct timezone offset. # FORMATS There are 6 strings that can match against date only or time only formats. The `parse_datetime` method will attempt to match these ambiguous strings against date only formats. If you want to match against the time only formats use the `parse_time` method. ## Conventions - Expanded ISO8601 These formats are supported with exactly 6 digits for the year. Support for a variable number of digits will be in a later release. - Precision If a format doesn't include a year all larger time unit up to and including the year are filled in using the current date/time or \[if set\] the `base_datetime` object. - Fractional time There is no limit on the expressed precision. ## Supported via parse\_datetime The supported formats are listed by the section of ISO 8601:2000(E) in which they appear. ### 5.2 Dates - 5.2.1.1 - YYYYMMDD - YYYY-MM-DD - 5.2.1.2 - YYYY-MM - YYYY - YY - 5.2.1.3 - YYMMDD - YY-MM-DD - -YYMM - -YY-MM - -YY - --MMDD - --MM-DD - --MM - ---DD - 5.2.1.4 - +\[YY\]YYYYMMDD - +\[YY\]YYYY-MM-DD - +\[YY\]YYYY-MM - +\[YY\]YYYY - +\[YY\]YY - 5.2.2.1 - YYYYDDD - YYYY-DDD - 5.2.2.2 - YYDDD - YY-DDD - -DDD - 5.2.2.3 - +\[YY\]YYYYDDD - +\[YY\]YYYY-DDD - 5.2.3.1 - YYYYWwwD - YYYY-Www-D - 5.2.3.2 - YYYYWww - YYYY-Www - YYWwwD - YY-Www-D - YYWww - YY-Www - -YWwwD - -Y-Www-D - -YWww - -Y-Www - -WwwD - -Www-D - -Www - -W-D - 5.2.3.4 - +\[YY\]YYYYWwwD - +\[YY\]YYYY-Www-D - +\[YY\]YYYYWww - +\[YY\]YYYY-Www ### 5.3 Time of Day - 5.3.1.1 - 5.3.1.3 Values can optionally be prefixed with 'T'. - 5.3.1.1 - hh:mm:ss - 5.3.1.2 - hh:mm - 5.3.1.3 - 5.3.1.4 fractional (decimal) separator maybe either ',' or '.' - 5.3.1.3 - hhmmss,ss - hh:mm:ss,ss - hhmm,mm - hh:mm,mm - hh,hh - 5.3.1.4 - -mm:ss - -mmss,s - -mm:ss,s - -mm,m - --ss,s - 5.3.3 - 5.3.4.2 Values can optionally be prefixed with 'T'. - 5.3.3 - hhmmssZ - hh:mm:ssZ - hhmmZ - hh:mmZ - hhZ - hhmmss.ssZ - hh:mm:ss.ssZ - 5.3.4.2 - hhmmss\[+-\]hhmm - hh:mm:ss\[+-\]hh:mm - hhmmss\[+-\]hh - hh:mm:ss\[+-\]hh - hhmmss.ss\[+-\]hhmm - hh:mm:ss.ss\[+-\]hh:mm ### 5.4 Combinations of date and time of day - 5.4.1 - YYYYMMDDThhmmss - YYYY-MM-DDThh:mm:ss - YYYYMMDDThhmmssZ - YYYY-MM-DDThh:mm:ssZ - YYYYMMDDThhmmss\[+-\]hhmm - YYYY-MM-DDThh:mm:ss\[+-\]hh:mm - YYYYMMDDThhmmss\[+-\]hh - YYYY-MM-DDThh:mm:ss\[+-\]hh - 5.4.2 - YYYYMMDDThhmmss.ss - YYYY-MM-DDThh:mm:ss.ss - YYYYMMDDThhmmss.ss\[+-\]hh - YYYY-MM-DDThh:mm:ss.ss\[+-\]hh - YYYYMMDDThhmmss.ss\[+-\]hhmm - YYYY-MM-DDThh:mm:ss.ss\[+-\]hh:mm - 5.4.3 Support for this section is not complete. - YYYYMMDDThhmm - YYYY-MM-DDThh:mm - YYYYMMDDThhmmZ - YYYY-MM-DDThh:mmZ - YYYYDDDThhmm - YYYY-DDDThh:mm - YYYYDDDThhmmZ - YYYY-DDDThh:mmZ - YYYYWwwDThhmm\[+-\]hhmm - YYYY-Www-DThh:mm\[+-\]hh ### 5.5 Time-Intervals These are not currently supported ## Supported via parse\_time ### 5.3.1.1 - 5.3.1.3 Values can optionally be prefixed with 'T'. - 5.3.1.1 - hhmmss - 5.3.1.2 - hhmm - hh - 5.3.1.4 - -mmss - -mm - --ss # STANDARDS DOCUMENT ## Title ISO8601:2000(E) Data elements and interchange formats - information exchange - Representation of dates and times Second edition 2000-12-15 ## Reference Number ISO/TC 154 N 362 # CREDITS Iain 'Spoon' Truskett (SPOON) who wrote [DateTime::Format::Builder](https://metacpan.org/pod/DateTime%3A%3AFormat%3A%3ABuilder). That has grown into _The Vacuum Energy Powered `Swiss Army` Katana_ of date and time parsing. This module was inspired by and conceived in honor of Iain's work. Tom Phoenix (PHOENIX) and PDX.pm for helping me solve the ISO week conversion bug. Not by fixing the code but motivation me to fix it so I could participate in a game of `Zendo`. Jonathan Leffler (JOHNL) for reporting a test bug. Kelly McCauley for a patch to add 8 missing formats. Alasdair Allan (AALLAN) for complaining about excessive test execution time. Everyone at the DateTime `Asylum`. # SEE ALSO - [DateTime](https://metacpan.org/pod/DateTime) - [DateTime::Format::Builder](https://metacpan.org/pod/DateTime%3A%3AFormat%3A%3ABuilder) # SUPPORT Bugs may be submitted at [https://github.com/houseabsolute/DateTime-Format-ISO8601/issues](https://github.com/houseabsolute/DateTime-Format-ISO8601/issues). # SOURCE The source code repository for DateTime-Format-ISO8601 can be found at [https://github.com/houseabsolute/DateTime-Format-ISO8601](https://github.com/houseabsolute/DateTime-Format-ISO8601). # AUTHORS - Joshua Hoblitt - Dave Rolsky # CONTRIBUTORS - Doug Bell - joe - Liam Widdowson - Thomas Klausner - William Ricker # COPYRIGHT AND LICENSE This software is copyright (c) 2025 by Joshua Hoblitt. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. The full text of the license can be found in the `LICENSE` file included with this distribution. DateTime-Format-ISO8601-0.17/perltidyrc0000644000175000017500000000045514756442575017325 0ustar autarchautarch-l=78 -i=4 -ci=4 -se -b -bar -boc -vt=0 -vtc=0 -cti=0 -pt=1 -bt=1 -sbt=1 -bbt=1 -nolq -npro -nsfs --blank-lines-before-packages=0 --opening-hash-brace-right --no-outdent-long-comments --iterations=2 -wbb="% + - * / x != == >= <= =~ !~ < > | & >= < = **= += *= &= <<= &&= -= /= |= >>= ||= .= %= ^= x=" DateTime-Format-ISO8601-0.17/META.json0000644000175000017500000011330314756442575016637 0ustar autarchautarch{ "abstract" : "Parses ISO8601 formats", "author" : [ "Joshua Hoblitt ", "Dave Rolsky " ], "dynamic_config" : 0, "generated_by" : "Dist::Zilla version 6.032, CPAN::Meta::Converter version 2.150010", "license" : [ "perl_5" ], "meta-spec" : { "url" : "http://search.cpan.org/perldoc?CPAN::Meta::Spec", "version" : 2 }, "name" : "DateTime-Format-ISO8601", "prereqs" : { "configure" : { "requires" : { "ExtUtils::MakeMaker" : "0" } }, "develop" : { "requires" : { "Capture::Tiny" : "0", "Cwd" : "0", "Encode" : "0", "File::Spec" : "0", "FindBin" : "0", "IO::Handle" : "0", "IPC::Open3" : "0", "Perl::Critic" : "1.138", "Perl::Critic::Moose" : "1.05", "Perl::Tidy" : "20210111", "Pod::Checker" : "1.74", "Pod::Coverage::TrustPod" : "0", "Pod::Tidy" : "0.10", "Pod::Wordlist" : "0", "Test::CPAN::Changes" : "0.19", "Test::CPAN::Meta::JSON" : "0.16", "Test::DependentModules" : "0", "Test::EOL" : "0", "Test::Mojibake" : "0", "Test::More" : "0.96", "Test::NoTabs" : "0", "Test::Pod" : "1.41", "Test::Pod::Coverage" : "1.08", "Test::Portability::Files" : "0", "Test::Spelling" : "0.17", "Test::Synopsis" : "0", "Test::Version" : "2.05", "perl" : "5.006" } }, "runtime" : { "requires" : { "Carp" : "0", "DateTime" : "1.45", "DateTime::Format::Builder" : "0.77", "Params::ValidationCompiler" : "0.26", "Specio" : "0.18", "Specio::Declare" : "0", "Specio::Exporter" : "0", "Specio::Library::Builtins" : "0", "namespace::autoclean" : "0", "parent" : "0", "strict" : "0", "warnings" : "0" } }, "test" : { "recommends" : { "CPAN::Meta" : "2.120900" }, "requires" : { "ExtUtils::MakeMaker" : "0", "File::Spec" : "0", "Test2::V0" : "0", "Test::More" : "1.302015" } } }, "provides" : { "DateTime::Format::ISO8601" : { "file" : "lib/DateTime/Format/ISO8601.pm", "version" : "0.17" }, "DateTime::Format::ISO8601::Types" : { "file" : "lib/DateTime/Format/ISO8601/Types.pm", "version" : "0.17" } }, "release_status" : "stable", "resources" : { "bugtracker" : { "web" : "https://github.com/houseabsolute/DateTime-Format-ISO8601/issues" }, "homepage" : "https://metacpan.org/release/DateTime-HiRes", "repository" : { "type" : "git", "url" : "git://github.com/houseabsolute/DateTime-Format-ISO8601.git", "web" : "https://github.com/houseabsolute/DateTime-Format-ISO8601" } }, "version" : "0.17", "x_Dist_Zilla" : { "perl" : { "version" : "5.038002" }, "plugins" : [ { "class" : "Dist::Zilla::Plugin::DROLSKY::BundleAuthordep", "name" : "@DROLSKY/DROLSKY::BundleAuthordep", "version" : "1.22" }, { "class" : "Dist::Zilla::Plugin::Git::GatherDir", "config" : { "Dist::Zilla::Plugin::GatherDir" : { "exclude_filename" : [ "CODE_OF_CONDUCT.md", "CONTRIBUTING.md", "LICENSE", "Makefile.PL", "README.md", "cpanfile" ], "exclude_match" : [], "include_dotfiles" : 0, "prefix" : "", "prune_directory" : [], "root" : "." }, "Dist::Zilla::Plugin::Git::GatherDir" : { "include_untracked" : 0 } }, "name" : "@DROLSKY/Git::GatherDir", "version" : "2.051" }, { "class" : "Dist::Zilla::Plugin::ManifestSkip", "name" : "@DROLSKY/ManifestSkip", "version" : "6.032" }, { "class" : "Dist::Zilla::Plugin::License", "name" : "@DROLSKY/License", "version" : "6.032" }, { "class" : "Dist::Zilla::Plugin::ExecDir", "name" : "@DROLSKY/ExecDir", "version" : "6.032" }, { "class" : "Dist::Zilla::Plugin::ShareDir", "name" : "@DROLSKY/ShareDir", "version" : "6.032" }, { "class" : "Dist::Zilla::Plugin::Manifest", "name" : "@DROLSKY/Manifest", "version" : "6.032" }, { "class" : "Dist::Zilla::Plugin::CheckVersionIncrement", "name" : "@DROLSKY/CheckVersionIncrement", "version" : "0.121750" }, { "class" : "Dist::Zilla::Plugin::TestRelease", "name" : "@DROLSKY/TestRelease", "version" : "6.032" }, { "class" : "Dist::Zilla::Plugin::ConfirmRelease", "name" : "@DROLSKY/ConfirmRelease", "version" : "6.032" }, { "class" : "Dist::Zilla::Plugin::UploadToCPAN", "name" : "@DROLSKY/UploadToCPAN", "version" : "6.032" }, { "class" : "Dist::Zilla::Plugin::VersionFromMainModule", "config" : { "Dist::Zilla::Role::ModuleMetadata" : { "Module::Metadata" : "1.000037", "version" : "0.006" } }, "name" : "@DROLSKY/VersionFromMainModule", "version" : "0.04" }, { "class" : "Dist::Zilla::Plugin::Authority", "name" : "@DROLSKY/Authority", "version" : "1.009" }, { "class" : "Dist::Zilla::Plugin::AutoPrereqs", "name" : "@DROLSKY/AutoPrereqs", "version" : "6.032" }, { "class" : "Dist::Zilla::Plugin::CopyFilesFromBuild", "name" : "@DROLSKY/CopyFilesFromBuild", "version" : "0.170880" }, { "class" : "Dist::Zilla::Plugin::GitHub::Meta", "name" : "@DROLSKY/GitHub::Meta", "version" : "0.49" }, { "class" : "Dist::Zilla::Plugin::GitHub::Update", "config" : { "Dist::Zilla::Plugin::GitHub::Update" : { "metacpan" : 1 } }, "name" : "@DROLSKY/GitHub::Update", "version" : "0.49" }, { "class" : "Dist::Zilla::Plugin::MetaResources", "name" : "@DROLSKY/MetaResources", "version" : "6.032" }, { "class" : "Dist::Zilla::Plugin::MetaProvides::Package", "config" : { "Dist::Zilla::Plugin::MetaProvides::Package" : { "finder_objects" : [ { "class" : "Dist::Zilla::Plugin::FinderCode", "name" : "@DROLSKY/MetaProvides::Package/AUTOVIV/:InstallModulesPM", "version" : "6.032" } ], "include_underscores" : 0 }, "Dist::Zilla::Role::MetaProvider::Provider" : { "$Dist::Zilla::Role::MetaProvider::Provider::VERSION" : "2.002004", "inherit_missing" : 1, "inherit_version" : 1, "meta_noindex" : 1 }, "Dist::Zilla::Role::ModuleMetadata" : { "Module::Metadata" : "1.000037", "version" : "0.006" } }, "name" : "@DROLSKY/MetaProvides::Package", "version" : "2.004003" }, { "class" : "Dist::Zilla::Plugin::Meta::Contributors", "name" : "@DROLSKY/Meta::Contributors", "version" : "0.003" }, { "class" : "Dist::Zilla::Plugin::MetaConfig", "name" : "@DROLSKY/MetaConfig", "version" : "6.032" }, { "class" : "Dist::Zilla::Plugin::MetaJSON", "name" : "@DROLSKY/MetaJSON", "version" : "6.032" }, { "class" : "Dist::Zilla::Plugin::MetaYAML", "name" : "@DROLSKY/MetaYAML", "version" : "6.032" }, { "class" : "Dist::Zilla::Plugin::NextRelease", "name" : "@DROLSKY/NextRelease", "version" : "6.032" }, { "class" : "Dist::Zilla::Plugin::Prereqs", "config" : { "Dist::Zilla::Plugin::Prereqs" : { "phase" : "test", "type" : "requires" } }, "name" : "@DROLSKY/Test::More with Test2", "version" : "6.032" }, { "class" : "Dist::Zilla::Plugin::Prereqs", "config" : { "Dist::Zilla::Plugin::Prereqs" : { "phase" : "develop", "type" : "requires" } }, "name" : "@DROLSKY/Tools for use with precious", "version" : "6.032" }, { "class" : "Dist::Zilla::Plugin::Prereqs", "config" : { "Dist::Zilla::Plugin::Prereqs" : { "phase" : "develop", "type" : "requires" } }, "name" : "@DROLSKY/Test::Version which fixes https://github.com/plicease/Test-Version/issues/7", "version" : "6.032" }, { "class" : "Dist::Zilla::Plugin::PromptIfStale", "config" : { "Dist::Zilla::Plugin::PromptIfStale" : { "check_all_plugins" : 0, "check_all_prereqs" : 0, "modules" : [ "Dist::Zilla::PluginBundle::DROLSKY" ], "phase" : "build", "run_under_travis" : 0, "skip" : [] } }, "name" : "@DROLSKY/Dist::Zilla::PluginBundle::DROLSKY", "version" : "0.060" }, { "class" : "Dist::Zilla::Plugin::PromptIfStale", "config" : { "Dist::Zilla::Plugin::PromptIfStale" : { "check_all_plugins" : 1, "check_all_prereqs" : 1, "modules" : [], "phase" : "release", "run_under_travis" : 0, "skip" : [ "Dist::Zilla::Plugin::DROLSKY::BundleAuthordep", "Dist::Zilla::Plugin::DROLSKY::Contributors", "Dist::Zilla::Plugin::DROLSKY::Git::CheckFor::CorrectBranch", "Dist::Zilla::Plugin::DROLSKY::License", "Dist::Zilla::Plugin::DROLSKY::MakeMaker", "Dist::Zilla::Plugin::DROLSKY::PerlLinterConfigFiles", "Dist::Zilla::Plugin::DROLSKY::Precious", "Dist::Zilla::Plugin::DROLSKY::Test::Precious", "Dist::Zilla::Plugin::DROLSKY::WeaverConfig", "Pod::Weaver::PluginBundle::DROLSKY" ] } }, "name" : "@DROLSKY/PromptIfStale", "version" : "0.060" }, { "class" : "Dist::Zilla::Plugin::Test::Pod::Coverage::Configurable", "name" : "@DROLSKY/Test::Pod::Coverage::Configurable", "version" : "0.07" }, { "class" : "Dist::Zilla::Plugin::Test::PodSpelling", "config" : { "Dist::Zilla::Plugin::Test::PodSpelling" : { "directories" : [ "bin", "lib" ], "spell_cmd" : "", "stopwords" : [ "AALLAN", "Alasdair", "DDD", "DROLSKY", "DROLSKY's", "Iain", "JOHNL", "Katana", "Leffler", "MMDD", "McCauley", "PDX", "PayPal", "Rolsky", "Rolsky's", "Truskett", "Www", "WwwD", "YWww", "YWwwD", "YY", "YYDDD", "YYMM", "YYMMDD", "YYWww", "YYWwwD", "YYYY", "YYYYDDD", "YYYYDDDThhmm", "YYYYDDDThhmmZ", "YYYYMMDD", "YYYYMMDDThhmm", "YYYYMMDDThhmmZ", "YYYYMMDDThhmmss", "YYYYMMDDThhmmssZ", "YYYYWww", "YYYYWwwD", "drolsky", "hh", "hhZ", "hhmm", "hhmmZ", "hhmmss", "hhmmssZ", "mmss", "ss", "ssZ" ], "wordlist" : "Pod::Wordlist" } }, "name" : "@DROLSKY/Test::PodSpelling", "version" : "2.007006" }, { "class" : "Dist::Zilla::Plugin::PodSyntaxTests", "name" : "@DROLSKY/PodSyntaxTests", "version" : "6.032" }, { "class" : "Dist::Zilla::Plugin::MojibakeTests", "name" : "@DROLSKY/MojibakeTests", "version" : "0.8" }, { "class" : "Dist::Zilla::Plugin::RunExtraTests", "config" : { "Dist::Zilla::Role::TestRunner" : { "default_jobs" : "12" } }, "name" : "@DROLSKY/RunExtraTests", "version" : "0.029" }, { "class" : "Dist::Zilla::Plugin::Test::CPAN::Changes", "config" : { "Dist::Zilla::Plugin::Test::CPAN::Changes" : { "changelog" : "Changes", "filename" : "xt/release/cpan-changes.t" } }, "name" : "@DROLSKY/Test::CPAN::Changes", "version" : "0.013" }, { "class" : "Dist::Zilla::Plugin::Test::CPAN::Meta::JSON", "name" : "@DROLSKY/Test::CPAN::Meta::JSON", "version" : "0.004" }, { "class" : "Dist::Zilla::Plugin::Test::EOL", "config" : { "Dist::Zilla::Plugin::Test::EOL" : { "filename" : "xt/author/eol.t", "finder" : [ ":ExecFiles", ":InstallModules", ":TestFiles" ], "trailing_whitespace" : 1 } }, "name" : "@DROLSKY/Test::EOL", "version" : "0.19" }, { "class" : "Dist::Zilla::Plugin::Test::NoTabs", "config" : { "Dist::Zilla::Plugin::Test::NoTabs" : { "filename" : "xt/author/no-tabs.t", "finder" : [ ":InstallModules", ":ExecFiles", ":TestFiles" ] } }, "name" : "@DROLSKY/Test::NoTabs", "version" : "0.15" }, { "class" : "Dist::Zilla::Plugin::Test::Portability", "config" : { "Dist::Zilla::Plugin::Test::Portability" : { "options" : "" } }, "name" : "@DROLSKY/Test::Portability", "version" : "2.001003" }, { "class" : "Dist::Zilla::Plugin::Test::Synopsis", "name" : "@DROLSKY/Test::Synopsis", "version" : "2.000007" }, { "class" : "Dist::Zilla::Plugin::Test::Compile", "config" : { "Dist::Zilla::Plugin::Test::Compile" : { "bail_out_on_fail" : 0, "fail_on_warning" : "author", "fake_home" : 0, "filename" : "xt/author/00-compile.t", "module_finder" : [ ":InstallModules" ], "needs_display" : 0, "phase" : "develop", "script_finder" : [ ":PerlExecFiles" ], "skips" : [], "switch" : [] } }, "name" : "@DROLSKY/Test::Compile", "version" : "2.058" }, { "class" : "Dist::Zilla::Plugin::Test::ReportPrereqs", "name" : "@DROLSKY/Test::ReportPrereqs", "version" : "0.029" }, { "class" : "Dist::Zilla::Plugin::Test::Version", "name" : "@DROLSKY/Test::Version", "version" : "1.09" }, { "class" : "Dist::Zilla::Plugin::DROLSKY::Test::Precious", "name" : "@DROLSKY/DROLSKY::Test::Precious", "version" : "1.22" }, { "class" : "Dist::Zilla::Plugin::DROLSKY::Contributors", "name" : "@DROLSKY/DROLSKY::Contributors", "version" : "1.22" }, { "class" : "Dist::Zilla::Plugin::Git::Contributors", "config" : { "Dist::Zilla::Plugin::Git::Contributors" : { "git_version" : "2.48.1", "include_authors" : 0, "include_releaser" : 1, "order_by" : "name", "paths" : [] } }, "name" : "@DROLSKY/Git::Contributors", "version" : "0.037" }, { "class" : "Dist::Zilla::Plugin::SurgicalPodWeaver", "config" : { "Dist::Zilla::Plugin::PodWeaver" : { "config_plugins" : [ "@DROLSKY" ], "finder" : [ ":InstallModules", ":PerlExecFiles" ], "plugins" : [ { "class" : "Pod::Weaver::Plugin::EnsurePod5", "name" : "@CorePrep/EnsurePod5", "version" : "4.019" }, { "class" : "Pod::Weaver::Plugin::H1Nester", "name" : "@CorePrep/H1Nester", "version" : "4.019" }, { "class" : "Pod::Weaver::Plugin::SingleEncoding", "name" : "@DROLSKY/SingleEncoding", "version" : "4.019" }, { "class" : "Pod::Weaver::Plugin::Transformer", "name" : "@DROLSKY/List", "version" : "4.019" }, { "class" : "Pod::Weaver::Plugin::Transformer", "name" : "@DROLSKY/Verbatim", "version" : "4.019" }, { "class" : "Pod::Weaver::Section::Region", "name" : "@DROLSKY/header", "version" : "4.019" }, { "class" : "Pod::Weaver::Section::Name", "name" : "@DROLSKY/Name", "version" : "4.019" }, { "class" : "Pod::Weaver::Section::Version", "name" : "@DROLSKY/Version", "version" : "4.019" }, { "class" : "Pod::Weaver::Section::Region", "name" : "@DROLSKY/prelude", "version" : "4.019" }, { "class" : "Pod::Weaver::Section::Generic", "name" : "SYNOPSIS", "version" : "4.019" }, { "class" : "Pod::Weaver::Section::Generic", "name" : "DESCRIPTION", "version" : "4.019" }, { "class" : "Pod::Weaver::Section::Generic", "name" : "OVERVIEW", "version" : "4.019" }, { "class" : "Pod::Weaver::Section::Collect", "name" : "ATTRIBUTES", "version" : "4.019" }, { "class" : "Pod::Weaver::Section::Collect", "name" : "METHODS", "version" : "4.019" }, { "class" : "Pod::Weaver::Section::Collect", "name" : "FUNCTIONS", "version" : "4.019" }, { "class" : "Pod::Weaver::Section::Collect", "name" : "TYPES", "version" : "4.019" }, { "class" : "Pod::Weaver::Section::Leftovers", "name" : "@DROLSKY/Leftovers", "version" : "4.019" }, { "class" : "Pod::Weaver::Section::Region", "name" : "@DROLSKY/postlude", "version" : "4.019" }, { "class" : "Pod::Weaver::Section::GenerateSection", "name" : "@DROLSKY/generate SUPPORT", "version" : "4.019" }, { "class" : "Pod::Weaver::Section::AllowOverride", "name" : "@DROLSKY/allow override SUPPORT", "version" : "0.05" }, { "class" : "Pod::Weaver::Section::GenerateSection", "name" : "@DROLSKY/generate SOURCE", "version" : "4.019" }, { "class" : "Pod::Weaver::Section::Authors", "name" : "@DROLSKY/Authors", "version" : "4.019" }, { "class" : "Pod::Weaver::Section::Contributors", "name" : "@DROLSKY/Contributors", "version" : "0.009" }, { "class" : "Pod::Weaver::Section::Legal", "name" : "@DROLSKY/Legal", "version" : "4.019" }, { "class" : "Pod::Weaver::Section::AllowOverride", "name" : "@DROLSKY/allow override Legal", "version" : "0.05" }, { "class" : "Pod::Weaver::Section::Region", "name" : "@DROLSKY/footer", "version" : "4.019" } ] } }, "name" : "@DROLSKY/SurgicalPodWeaver", "version" : "0.0023" }, { "class" : "Dist::Zilla::Plugin::DROLSKY::WeaverConfig", "name" : "@DROLSKY/DROLSKY::WeaverConfig", "version" : "1.22" }, { "class" : "Dist::Zilla::Plugin::ReadmeAnyFromPod", "config" : { "Dist::Zilla::Role::FileWatcher" : { "version" : "0.006" } }, "name" : "@DROLSKY/README.md in build", "version" : "0.163250" }, { "class" : "Dist::Zilla::Plugin::GenerateFile::FromShareDir", "config" : { "Dist::Zilla::Plugin::GenerateFile::FromShareDir" : { "destination_filename" : "CONTRIBUTING.md", "dist" : "Dist-Zilla-PluginBundle-DROLSKY", "encoding" : "UTF-8", "has_xs" : 0, "location" : "build", "source_filename" : "CONTRIBUTING.md" }, "Dist::Zilla::Role::RepoFileInjector" : { "allow_overwrite" : 1, "repo_root" : ".", "version" : "0.009" } }, "name" : "@DROLSKY/Generate CONTRIBUTING.md", "version" : "0.015" }, { "class" : "Dist::Zilla::Plugin::GenerateFile::FromShareDir", "config" : { "Dist::Zilla::Plugin::GenerateFile::FromShareDir" : { "destination_filename" : "CODE_OF_CONDUCT.md", "dist" : "Dist-Zilla-PluginBundle-DROLSKY", "encoding" : "UTF-8", "has_xs" : 0, "location" : "build", "source_filename" : "CODE_OF_CONDUCT.md" }, "Dist::Zilla::Role::RepoFileInjector" : { "allow_overwrite" : 1, "repo_root" : ".", "version" : "0.009" } }, "name" : "@DROLSKY/Generate CODE_OF_CONDUCT.md", "version" : "0.015" }, { "class" : "Dist::Zilla::Plugin::InstallGuide", "config" : { "Dist::Zilla::Role::ModuleMetadata" : { "Module::Metadata" : "1.000037", "version" : "0.006" } }, "name" : "@DROLSKY/InstallGuide", "version" : "1.200014" }, { "class" : "Dist::Zilla::Plugin::CPANFile", "name" : "@DROLSKY/CPANFile", "version" : "6.032" }, { "class" : "Dist::Zilla::Plugin::DROLSKY::License", "name" : "@DROLSKY/DROLSKY::License", "version" : "1.22" }, { "class" : "Dist::Zilla::Plugin::CheckStrictVersion", "name" : "@DROLSKY/CheckStrictVersion", "version" : "0.001" }, { "class" : "Dist::Zilla::Plugin::CheckSelfDependency", "config" : { "Dist::Zilla::Plugin::CheckSelfDependency" : { "finder" : [ ":InstallModules" ] }, "Dist::Zilla::Role::ModuleMetadata" : { "Module::Metadata" : "1.000037", "version" : "0.006" } }, "name" : "@DROLSKY/CheckSelfDependency", "version" : "0.011" }, { "class" : "Dist::Zilla::Plugin::CheckPrereqsIndexed", "name" : "@DROLSKY/CheckPrereqsIndexed", "version" : "0.022" }, { "class" : "Dist::Zilla::Plugin::DROLSKY::Git::CheckFor::CorrectBranch", "config" : { "Dist::Zilla::Role::Git::Repo" : { "git_version" : "2.48.1", "repo_root" : "." } }, "name" : "@DROLSKY/DROLSKY::Git::CheckFor::CorrectBranch", "version" : "1.22" }, { "class" : "Dist::Zilla::Plugin::EnsureChangesHasContent", "name" : "@DROLSKY/EnsureChangesHasContent", "version" : "0.02" }, { "class" : "Dist::Zilla::Plugin::Git::CheckFor::MergeConflicts", "config" : { "Dist::Zilla::Role::Git::Repo" : { "git_version" : "2.48.1", "repo_root" : "." } }, "name" : "@DROLSKY/Git::CheckFor::MergeConflicts", "version" : "0.014" }, { "class" : "Dist::Zilla::Plugin::DROLSKY::PerlLinterConfigFiles", "name" : "@DROLSKY/DROLSKY::PerlLinterConfigFiles", "version" : "1.22" }, { "class" : "Dist::Zilla::Plugin::DROLSKY::DevTools", "name" : "@DROLSKY/DROLSKY::DevTools", "version" : "1.22" }, { "class" : "Dist::Zilla::Plugin::DROLSKY::Precious", "name" : "@DROLSKY/DROLSKY::Precious", "version" : "1.22" }, { "class" : "Dist::Zilla::Plugin::Git::Check", "config" : { "Dist::Zilla::Plugin::Git::Check" : { "untracked_files" : "die" }, "Dist::Zilla::Role::Git::DirtyFiles" : { "allow_dirty" : [ "CODE_OF_CONDUCT.md", "CONTRIBUTING.md", "Changes", "LICENSE", "Makefile.PL", "README.md", "cpanfile", "precious.toml" ], "allow_dirty_match" : [], "changelog" : "Changes" }, "Dist::Zilla::Role::Git::Repo" : { "git_version" : "2.48.1", "repo_root" : "." } }, "name" : "@DROLSKY/Git::Check", "version" : "2.051" }, { "class" : "Dist::Zilla::Plugin::Git::Commit", "config" : { "Dist::Zilla::Plugin::Git::Commit" : { "add_files_in" : [], "commit_msg" : "v%V%n%n%c", "signoff" : 0 }, "Dist::Zilla::Role::Git::DirtyFiles" : { "allow_dirty" : [ "CODE_OF_CONDUCT.md", "CONTRIBUTING.md", "Changes", "LICENSE", "Makefile.PL", "README.md", "cpanfile", "precious.toml" ], "allow_dirty_match" : [], "changelog" : "Changes" }, "Dist::Zilla::Role::Git::Repo" : { "git_version" : "2.48.1", "repo_root" : "." }, "Dist::Zilla::Role::Git::StringFormatter" : { "time_zone" : "local" } }, "name" : "@DROLSKY/Commit generated files", "version" : "2.051" }, { "class" : "Dist::Zilla::Plugin::Git::Tag", "config" : { "Dist::Zilla::Plugin::Git::Tag" : { "branch" : null, "changelog" : "Changes", "signed" : 0, "tag" : "v0.17", "tag_format" : "v%V", "tag_message" : "v%V" }, "Dist::Zilla::Role::Git::Repo" : { "git_version" : "2.48.1", "repo_root" : "." }, "Dist::Zilla::Role::Git::StringFormatter" : { "time_zone" : "local" } }, "name" : "@DROLSKY/Git::Tag", "version" : "2.051" }, { "class" : "Dist::Zilla::Plugin::Git::Push", "config" : { "Dist::Zilla::Plugin::Git::Push" : { "push_to" : [ "origin" ], "remotes_must_exist" : 1 }, "Dist::Zilla::Role::Git::Repo" : { "git_version" : "2.48.1", "repo_root" : "." } }, "name" : "@DROLSKY/Git::Push", "version" : "2.051" }, { "class" : "Dist::Zilla::Plugin::BumpVersionAfterRelease", "config" : { "Dist::Zilla::Plugin::BumpVersionAfterRelease" : { "finders" : [ ":ExecFiles", ":InstallModules" ], "global" : 0, "munge_makefile_pl" : 1 } }, "name" : "@DROLSKY/BumpVersionAfterRelease", "version" : "0.018" }, { "class" : "Dist::Zilla::Plugin::Git::Commit", "config" : { "Dist::Zilla::Plugin::Git::Commit" : { "add_files_in" : [], "commit_msg" : "Bump version after release", "signoff" : 0 }, "Dist::Zilla::Role::Git::DirtyFiles" : { "allow_dirty" : [ "Changes", "dist.ini" ], "allow_dirty_match" : [ "(?^:.+)" ], "changelog" : "Changes" }, "Dist::Zilla::Role::Git::Repo" : { "git_version" : "2.48.1", "repo_root" : "." }, "Dist::Zilla::Role::Git::StringFormatter" : { "time_zone" : "local" } }, "name" : "@DROLSKY/Commit version bump", "version" : "2.051" }, { "class" : "Dist::Zilla::Plugin::Git::Push", "config" : { "Dist::Zilla::Plugin::Git::Push" : { "push_to" : [ "origin" ], "remotes_must_exist" : 1 }, "Dist::Zilla::Role::Git::Repo" : { "git_version" : "2.48.1", "repo_root" : "." } }, "name" : "@DROLSKY/Push version bump", "version" : "2.051" }, { "class" : "Dist::Zilla::Plugin::DROLSKY::MakeMaker", "config" : { "Dist::Zilla::Plugin::MakeMaker" : { "make_path" : "make", "version" : "6.032" }, "Dist::Zilla::Plugin::MakeMaker::Awesome" : { "version" : "0.49" }, "Dist::Zilla::Role::TestRunner" : { "default_jobs" : "12", "version" : "6.032" } }, "name" : "@DROLSKY/DROLSKY::MakeMaker", "version" : "1.22" }, { "class" : "Dist::Zilla::Plugin::FinderCode", "name" : ":InstallModules", "version" : "6.032" }, { "class" : "Dist::Zilla::Plugin::FinderCode", "name" : ":IncModules", "version" : "6.032" }, { "class" : "Dist::Zilla::Plugin::FinderCode", "name" : ":TestFiles", "version" : "6.032" }, { "class" : "Dist::Zilla::Plugin::FinderCode", "name" : ":ExtraTestFiles", "version" : "6.032" }, { "class" : "Dist::Zilla::Plugin::FinderCode", "name" : ":ExecFiles", "version" : "6.032" }, { "class" : "Dist::Zilla::Plugin::FinderCode", "name" : ":PerlExecFiles", "version" : "6.032" }, { "class" : "Dist::Zilla::Plugin::FinderCode", "name" : ":ShareFiles", "version" : "6.032" }, { "class" : "Dist::Zilla::Plugin::FinderCode", "name" : ":MainModule", "version" : "6.032" }, { "class" : "Dist::Zilla::Plugin::FinderCode", "name" : ":AllFiles", "version" : "6.032" }, { "class" : "Dist::Zilla::Plugin::FinderCode", "name" : ":NoFiles", "version" : "6.032" }, { "class" : "Dist::Zilla::Plugin::FinderCode", "name" : "@DROLSKY/MetaProvides::Package/AUTOVIV/:InstallModulesPM", "version" : "6.032" } ], "zilla" : { "class" : "Dist::Zilla::Dist::Builder", "config" : { "is_trial" : 0 }, "version" : "6.032" } }, "x_authority" : "cpan:DROLSKY", "x_contributors" : [ "Doug Bell ", "joe ", "Liam Widdowson ", "Thomas Klausner ", "William Ricker " ], "x_generated_by_perl" : "v5.38.2", "x_serialization_backend" : "Cpanel::JSON::XS version 4.38", "x_spdx_expression" : "Artistic-1.0-Perl OR GPL-1.0-or-later" } DateTime-Format-ISO8601-0.17/CODE_OF_CONDUCT.md0000644000175000017500000000625314756442575020022 0ustar autarchautarch# Contributor Covenant Code of Conduct ## Our Pledge In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, gender identity and expression, level of experience, education, socio-economic status, nationality, personal appearance, race, religion, or sexual identity and orientation. ## Our Standards Examples of behavior that contributes to creating a positive environment include: * Using welcoming and inclusive language * Being respectful of differing viewpoints and experiences * Gracefully accepting constructive criticism * Focusing on what is best for the community * Showing empathy towards other community members Examples of unacceptable behavior by participants include: * The use of sexualized language or imagery and unwelcome sexual attention or advances * Trolling, insulting/derogatory comments, and personal or political attacks * Public or private harassment * Publishing others' private information, such as a physical or electronic address, without explicit permission * Other conduct which could reasonably be considered inappropriate in a professional setting ## Our Responsibilities Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior. Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful. ## Scope This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. Examples of representing a project or community include using an official project e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. Representation of a project may be further defined and clarified by project maintainers. ## Enforcement Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at autarch@urth.org. All complaints will be reviewed and investigated and will result in a response that is deemed necessary and appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately. Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership. ## Attribution This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html [homepage]: https://www.contributor-covenant.org DateTime-Format-ISO8601-0.17/lib/0000775000175000017500000000000014756442575015765 5ustar autarchautarchDateTime-Format-ISO8601-0.17/lib/DateTime/0000775000175000017500000000000014756442575017461 5ustar autarchautarchDateTime-Format-ISO8601-0.17/lib/DateTime/Format/0000775000175000017500000000000014756442575020711 5ustar autarchautarchDateTime-Format-ISO8601-0.17/lib/DateTime/Format/ISO8601.pm0000644000175000017500000013231314756442575022221 0ustar autarchautarch# Copyright (C) 2003-2012 Joshua Hoblitt package DateTime::Format::ISO8601; use strict; use warnings; use namespace::autoclean; our $VERSION = '0.17'; use Carp qw( croak ); use DateTime 1.45; use DateTime::Format::Builder 0.77; use DateTime::Format::ISO8601::Types; use Params::ValidationCompiler 0.26 qw( validation_for ); { my $validator = validation_for( name => 'DefaultLegacyYear', name_is_optional => 1, params => [ { type => t('Bool') } ], ); my $default_legacy_year; sub DefaultLegacyYear { shift; ($default_legacy_year) = $validator->(@_) if @_; return $default_legacy_year; } } __PACKAGE__->DefaultLegacyYear(1); { my $validator = validation_for( name => 'DefaultCutOffYear', name_is_optional => 1, params => [ { type => t('CutOffYear') } ], ); my $default_cut_off_year; sub DefaultCutOffYear { shift; ($default_cut_off_year) = $validator->(@_) if @_; return $default_cut_off_year; } } # the same default value as DT::F::Mail __PACKAGE__->DefaultCutOffYear(49); { my $validator = validation_for( name => '_check_new_params', name_is_optional => 1, params => { base_datetime => { type => t('DateTimeIsh'), optional => 1, }, legacy_year => { type => t('Bool'), optional => 1, }, cut_off_year => { type => t('CutOffYear'), optional => 1, }, }, ); sub new { my ($class) = shift; my %args = $validator->(@_); $args{legacy_year} = $class->DefaultLegacyYear unless exists $args{legacy_year}; $args{cut_off_year} = $class->DefaultCutOffYear unless exists $args{cut_off_year}; $class = ref($class) || $class; my $self = bless( \%args, $class ); if ( $args{base_datetime} ) { $self->set_base_datetime( object => $args{base_datetime} ); } return ($self); } } # lifted from DateTime sub clone { bless { %{ $_[0] } }, ref $_[0] } sub base_datetime { $_[0]->{base_datetime} } { my $validator = validation_for( name => 'set_base_datetime', name_is_optional => 1, params => { object => { type => t('DateTimeIsh') }, }, ); sub set_base_datetime { my $self = shift; my %args = $validator->(@_); # ISO8601 only allows years 0 to 9999 # this implementation ignores the needs of expanded formats my $dt = DateTime->from_object( object => $args{object} ); my $lower_bound = DateTime->new( year => 0 ); my $upper_bound = DateTime->new( year => 10000 ); if ( $dt < $lower_bound ) { croak 'base_datetime must be greater then or equal to ', $lower_bound->iso8601; } if ( $dt >= $upper_bound ) { croak 'base_datetime must be less then ', $upper_bound->iso8601; } $self->{base_datetime} = $dt; return $self; } } sub legacy_year { $_[0]->{legacy_year} } { my $validator = validation_for( name => 'set_legacy_year', name_is_optional => 1, params => [ { type => t('Bool') } ], ); sub set_legacy_year { my $self = shift; ( $self->{legacy_year} ) = $validator->(@_); return $self; } } sub cut_off_year { $_[0]->{cut_off_year} } { my $validator = validation_for( name => 'set_cut_off_year', name_is_optional => 1, params => [ { type => t('CutOffYear') } ], ); sub set_cut_off_year { my $self = shift; ( $self->{cut_off_year} ) = $validator->(@_); return $self; } } { my $validator = validation_for( name => 'format_datetime', name_is_optional => 1, params => [ { type => t('DateTime') } ], ); sub format_datetime { my $self = shift; my ($dt) = $validator->(@_); my $cldr = $dt->nanosecond % 1000000 ? 'yyyy-MM-ddTHH:mm:ss.SSSSSSSSS' : $dt->nanosecond ? 'yyyy-MM-ddTHH:mm:ss.SSS' : 'yyyy-MM-ddTHH:mm:ss'; my $tz; if ( $dt->time_zone->is_utc ) { $tz = 'Z'; } else { $tz = q{}; $cldr .= 'ZZZZZ'; } return $dt->format_cldr($cldr) . $tz; } } DateTime::Format::Builder->create_class( parsers => { parse_datetime => [ { #YYYYMMDD 19850412 length => 8, regex => qr/^ (\d{4}) (\d\d) (\d\d) $/x, params => [qw( year month day )], }, { # uncombined with above because #regex => qr/^ (\d{4}) -?? (\d\d) -?? (\d\d) $/x, # was matching 152746-05 #YYYY-MM-DD 1985-04-12 length => 10, regex => qr/^ (\d{4}) - (\d\d) - (\d\d) $/x, params => [qw( year month day )], }, { #YYYY-MM 1985-04 length => 7, regex => qr/^ (\d{4}) - (\d\d) $/x, params => [qw( year month )], }, { #YYYY 1985 length => 4, regex => qr/^ (\d{4}) $/x, params => [qw( year )], }, { #YY 19 (century) length => 2, regex => qr/^ (\d\d) $/x, params => [qw( year )], postprocess => \&_normalize_century, }, { #YYMMDD 850412 #YY-MM-DD 85-04-12 length => [qw( 6 8 )], regex => qr/^ (\d\d) -?? (\d\d) -?? (\d\d) $/x, params => [qw( year month day )], postprocess => \&_fix_2_digit_year, }, { #-YYMM -8504 #-YY-MM -85-04 length => [qw( 5 6 )], regex => qr/^ - (\d\d) -?? (\d\d) $/x, params => [qw( year month )], postprocess => \&_fix_2_digit_year, }, { #-YY -85 length => 3, regex => qr/^ - (\d\d) $/x, params => [qw( year )], postprocess => \&_fix_2_digit_year, }, { #--MMDD --0412 #--MM-DD --04-12 length => [qw( 6 7 )], regex => qr/^ -- (\d\d) -?? (\d\d) $/x, params => [qw( month day )], postprocess => \&_add_year, }, { #--MM --04 length => 4, regex => qr/^ -- (\d\d) $/x, params => [qw( month )], postprocess => \&_add_year, }, { #---DD ---12 length => 5, regex => qr/^ --- (\d\d) $/x, params => [qw( day )], postprocess => [ \&_add_year, \&_add_month ], }, { #+[YY]YYYYMMDD +0019850412 #+[YY]YYYY-MM-DD +001985-04-12 length => [qw( 11 13 )], regex => qr/^ \+ (\d{6}) -?? (\d\d) -?? (\d\d) $/x, params => [qw( year month day )], }, { #+[YY]YYYY-MM +001985-04 length => 10, regex => qr/^ \+ (\d{6}) - (\d\d) $/x, params => [qw( year month )], }, { #+[YY]YYYY +001985 length => 7, regex => qr/^ \+ (\d{6}) $/x, params => [qw( year )], }, { #+[YY]YY +0019 (century) length => 5, regex => qr/^ \+ (\d{4}) $/x, params => [qw( year )], postprocess => \&_normalize_century, }, { #YYYYDDD 1985102 #YYYY-DDD 1985-102 length => [qw( 7 8 )], regex => qr/^ (\d{4}) -?? (\d{3}) $/x, params => [qw( year day_of_year )], constructor => [ 'DateTime', 'from_day_of_year' ], }, { #YYDDD 85102 #YY-DDD 85-102 length => [qw( 5 6 )], regex => qr/^ (\d\d) -?? (\d{3}) $/x, params => [qw( year day_of_year )], postprocess => [ \&_fix_2_digit_year ], constructor => [ 'DateTime', 'from_day_of_year' ], }, { #-DDD -102 length => 4, regex => qr/^ - (\d{3}) $/x, params => [qw( day_of_year )], postprocess => [ \&_add_year ], constructor => [ 'DateTime', 'from_day_of_year' ], }, { #+[YY]YYYYDDD +001985102 #+[YY]YYYY-DDD +001985-102 length => [qw( 10 11 )], regex => qr/^ \+ (\d{6}) -?? (\d{3}) $/x, params => [qw( year day_of_year )], constructor => [ 'DateTime', 'from_day_of_year' ], }, { #YYYYWwwD 1985W155 #YYYY-Www-D 1985-W15-5 length => [qw( 8 10 )], regex => qr/^ (\d{4}) -?? W (\d\d) -?? (\d) $/x, params => [qw( year week day_of_week )], postprocess => [ \&_normalize_week ], constructor => [ 'DateTime', 'from_day_of_year' ], }, { #YYYYWww 1985W15 #YYYY-Www 1985-W15 length => [qw( 7 8 )], regex => qr/^ (\d{4}) -?? W (\d\d) $/x, params => [qw( year week )], postprocess => [ \&_normalize_week ], constructor => [ 'DateTime', 'from_day_of_year' ], }, { #YYWwwD 85W155 #YY-Www-D 85-W15-5 length => [qw( 6 8 )], regex => qr/^ (\d\d) -?? W (\d\d) -?? (\d) $/x, params => [qw( year week day_of_week )], postprocess => [ \&_fix_2_digit_year, \&_normalize_week ], constructor => [ 'DateTime', 'from_day_of_year' ], }, { #YYWww 85W15 #YY-Www 85-W15 length => [qw( 5 6 )], regex => qr/^ (\d\d) -?? W (\d\d) $/x, params => [qw( year week )], postprocess => [ \&_fix_2_digit_year, \&_normalize_week ], constructor => [ 'DateTime', 'from_day_of_year' ], }, { #-YWwwD -5W155 #-Y-Www-D -5-W15-5 length => [qw( 6 8 )], regex => qr/^ - (\d) -?? W (\d\d) -?? (\d) $/x, params => [qw( year week day_of_week )], postprocess => [ \&_fix_1_digit_year, \&_normalize_week ], constructor => [ 'DateTime', 'from_day_of_year' ], }, { #-YWww -5W15 #-Y-Www -5-W15 length => [qw( 5 6 )], regex => qr/^ - (\d) -?? W (\d\d) $/x, params => [qw( year week )], postprocess => [ \&_fix_1_digit_year, \&_normalize_week ], constructor => [ 'DateTime', 'from_day_of_year' ], }, { #-WwwD -W155 #-Www-D -W15-5 length => [qw( 5 6 )], regex => qr/^ - W (\d\d) -?? (\d) $/x, params => [qw( week day_of_week )], postprocess => [ \&_add_year, \&_normalize_week ], constructor => [ 'DateTime', 'from_day_of_year' ], }, { #-Www -W15 length => 4, regex => qr/^ - W (\d\d) $/x, params => [qw( week )], postprocess => [ \&_add_year, \&_normalize_week ], constructor => [ 'DateTime', 'from_day_of_year' ], }, { #-W-D -W-5 length => 4, regex => qr/^ - W - (\d) $/x, params => [qw( day_of_week )], postprocess => [ \&_add_year, \&_add_week, \&_normalize_week, ], constructor => [ 'DateTime', 'from_day_of_year' ], }, { #+[YY]YYYYWwwD +001985W155 #+[YY]YYYY-Www-D +001985-W15-5 length => [qw( 11 13 )], regex => qr/^ \+ (\d{6}) -?? W (\d\d) -?? (\d) $/x, params => [qw( year week day_of_week )], postprocess => [ \&_normalize_week ], constructor => [ 'DateTime', 'from_day_of_year' ], }, { #+[YY]YYYYWww +001985W15 #+[YY]YYYY-Www +001985-W15 length => [qw( 10 11 )], regex => qr/^ \+ (\d{6}) -?? W (\d\d) $/x, params => [qw( year week )], postprocess => [ \&_normalize_week ], constructor => [ 'DateTime', 'from_day_of_year' ], }, { #hhmmss 232050 - skipped #hh:mm:ss 23:20:50 length => [qw( 8 9 )], regex => qr/^ T?? (\d\d) : (\d\d) : (\d\d) $/x, params => [qw( hour minute second)], postprocess => [ \&_add_year, \&_add_month, \&_add_day ], }, #hhmm 2320 - skipped #hh 23 -skipped { #hh:mm 23:20 length => [qw( 4 5 6 )], regex => qr/^ T?? (\d\d) :?? (\d\d) $/x, params => [qw( hour minute )], postprocess => [ \&_add_year, \&_add_month, \&_add_day ], }, { #hhmmss,ss 232050,5 #hh:mm:ss,ss 23:20:50,5 regex => qr/^ T?? (\d\d) :?? (\d\d) :?? (\d\d) [\.,] (\d+) $/x, params => [qw( hour minute second nanosecond)], postprocess => [ \&_add_year, \&_add_month, \&_add_day, \&_fractional_second ], }, { #hhmm,mm 2320,8 #hh:mm,mm 23:20,8 regex => qr/^ T?? (\d\d) :?? (\d\d) [\.,] (\d+) $/x, params => [qw( hour minute second )], postprocess => [ \&_add_year, \&_add_month, \&_add_day, \&_fractional_minute ], }, { #hh,hh 23,3 regex => qr/^ T?? (\d\d) [\.,] (\d+) $/x, params => [qw( hour minute )], postprocess => [ \&_add_year, \&_add_month, \&_add_day, \&_fractional_hour ], }, { #-mmss -2050 - skipped #-mm:ss -20:50 length => 6, regex => qr/^ - (\d\d) : (\d\d) $/x, params => [qw( minute second )], postprocess => [ \&_add_year, \&_add_month, \&_add_day, \&_add_hour ], }, #-mm -20 - skipped #--ss --50 - skipped { #-mmss,s -2050,5 #-mm:ss,s -20:50,5 regex => qr/^ - (\d\d) :?? (\d\d) [\.,] (\d+) $/x, params => [qw( minute second nanosecond )], postprocess => [ \&_add_year, \&_add_month, \&_add_day, \&_add_hour, \&_fractional_second ], }, { #-mm,m -20,8 regex => qr/^ - (\d\d) [\.,] (\d+) $/x, params => [qw( minute second )], postprocess => [ \&_add_year, \&_add_month, \&_add_day, \&_add_hour, \&_fractional_minute ], }, { #--ss,s --50,5 regex => qr/^ -- (\d\d) [\.,] (\d+) $/x, params => [qw( second nanosecond)], postprocess => [ \&_add_year, \&_add_month, \&_add_day, \&_add_hour, \&_add_minute, \&_fractional_second, ], }, { #hhmmssZ 232030Z #hh:mm:ssZ 23:20:30Z length => [qw( 7 8 9 10 )], regex => qr/^ T?? (\d\d) :?? (\d\d) :?? (\d\d) Z $/x, params => [qw( hour minute second )], extra => { time_zone => 'UTC' }, postprocess => [ \&_add_year, \&_add_month, \&_add_day, ], }, { #hhmmss.ssZ 232030.5Z #hh:mm:ss.ssZ 23:20:30.5Z regex => qr/^ T?? (\d\d) :?? (\d\d) :?? (\d\d) [\.,] (\d+) Z $/x, params => [qw( hour minute second nanosecond)], extra => { time_zone => 'UTC' }, postprocess => [ \&_add_year, \&_add_month, \&_add_day, \&_fractional_second ], }, { #hhmmZ 2320Z #hh:mmZ 23:20Z length => [qw( 5 6 7 )], regex => qr/^ T?? (\d\d) :?? (\d\d) Z $/x, params => [qw( hour minute )], extra => { time_zone => 'UTC' }, postprocess => [ \&_add_year, \&_add_month, \&_add_day, ], }, { #hhZ 23Z length => [qw( 3 4 )], regex => qr/^ T?? (\d\d) Z $/x, params => [qw( hour )], extra => { time_zone => 'UTC' }, postprocess => [ \&_add_year, \&_add_month, \&_add_day, ], }, { #hhmmss[+-]hhmm 152746+0100 152746-0500 #hh:mm:ss[+-]hh:mm 15:27:46+01:00 15:27:46-05:00 length => [qw( 11 12 14 15 )], regex => qr/^ T?? (\d\d) :?? (\d\d) :?? (\d\d) ([+-] \d\d :?? \d\d) $/x, params => [qw( hour minute second time_zone )], postprocess => [ \&_add_year, \&_add_month, \&_add_day, \&_normalize_offset, ], }, { #hhmmss.ss[+-]hhmm 152746.5+0100 152746.5-0500 #hh:mm:ss.ss[+-]hh:mm 15:27:46.5+01:00 15:27:46.5-05:00 regex => qr/^ T?? (\d\d) :?? (\d\d) :?? (\d\d) [\.,] (\d+) ([+-] \d\d :?? \d\d) $/x, params => [qw( hour minute second nanosecond time_zone )], postprocess => [ \&_add_year, \&_add_month, \&_add_day, \&_fractional_second, \&_normalize_offset, ], }, { #hhmmss[+-]hh 152746+01 152746-05 #hh:mm:ss[+-]hh 15:27:46+01 15:27:46-05 length => [qw( 9 10 11 12 )], regex => qr/^ T?? (\d\d) :?? (\d\d) :?? (\d\d) ([+-] \d\d) $/x, params => [qw( hour minute second time_zone )], postprocess => [ \&_add_year, \&_add_month, \&_add_day, \&_normalize_offset, ], }, { #YYYYMMDDThhmmss 19850412T101530 #YYYY-MM-DDThh:mm:ss 1985-04-12T10:15:30 length => [qw( 15 19 )], regex => qr/^ (\d{4}) -?? (\d\d) -?? (\d\d) T (\d\d) :?? (\d\d) :?? (\d\d) $/x, params => [qw( year month day hour minute second )], extra => { time_zone => 'floating' }, }, { #YYYYMMDDThhmmss.ss 19850412T101530.123 #YYYY-MM-DDThh:mm:ss.ss 1985-04-12T10:15:30.123 regex => qr/^ (\d{4}) -?? (\d\d) -?? (\d\d) T (\d\d) :?? (\d\d) :?? (\d\d) [\.,] (\d+) $/x, params => [qw( year month day hour minute second nanosecond )], extra => { time_zone => 'floating' }, postprocess => [ \&_fractional_second, ], }, { #YYYYMMDDThhmmssZ 19850412T101530Z #YYYY-MM-DDThh:mm:ssZ 1985-04-12T10:15:30Z length => [qw( 16 20 )], regex => qr/^ (\d{4}) -?? (\d\d) -?? (\d\d) T (\d\d) :?? (\d\d) :?? (\d\d) Z $/x, params => [qw( year month day hour minute second )], extra => { time_zone => 'UTC' }, }, { #YYYYMMDDThhmmss.ssZ 19850412T101530.5Z 20041020T101530.5Z #YYYY-MM-DDThh:mm:ss.ssZ 1985-04-12T10:15:30.5Z 1985-04-12T10:15:30.5Z regex => qr/^ (\d{4}) -?? (\d\d) -?? (\d\d) T?? (\d\d) :?? (\d\d) :?? (\d\d) [\.,] (\d+) Z$/x, params => [qw( year month day hour minute second nanosecond )], extra => { time_zone => 'UTC' }, postprocess => [ \&_fractional_second, ], }, { #YYYYMMDDThhmm[+-]hhmm 19850412T1015+0400 #YYYY-MM-DDThh:mm[+-]hh:mm 1985-04-12T10:15+04:00 length => [qw( 18 22 )], regex => qr/^ (\d{4}) -?? (\d\d) -?? (\d\d) T (\d\d) :?? (\d\d) ([+-] \d\d :?? \d\d) $/x, params => [qw( year month day hour minute time_zone )], postprocess => \&_normalize_offset, }, { #YYYYMMDDThhmmss[+-]hhmm 19850412T101530+0400 #YYYY-MM-DDThh:mm:ss[+-]hh:mm 1985-04-12T10:15:30+04:00 length => [qw( 20 24 25 )], regex => qr/^ (\d{4}) -?? (\d\d) -?? (\d\d) T (\d\d) :?? (\d\d) :?? (\d\d) ([+-] \d\d :?? \d\d) $/x, params => [qw( year month day hour minute second time_zone )], postprocess => \&_normalize_offset, }, { #YYYYMMDDThhmmss.ss[+-]hhmm 19850412T101530.5+0100 20041020T101530.5-0500 regex => qr/^ (\d{4}) (\d\d) (\d\d) T?? (\d\d) (\d\d) (\d\d) [\.,] (\d+) ([+-] \d\d \d\d) $/x, params => [ qw( year month day hour minute second nanosecond time_zone ) ], postprocess => [ \&_fractional_second, \&_normalize_offset, ], }, { #YYYY-MM-DDThh:mm:ss.ss[+-]hh 1985-04-12T10:15:30.5+01 1985-04-12T10:15:30.5-05 regex => qr/^ (\d{4}) - (\d\d) - (\d\d) T?? (\d\d) : (\d\d) : (\d\d) [\.,] (\d+) ([+-] \d\d ) $/x, params => [ qw( year month day hour minute second nanosecond time_zone ) ], postprocess => [ \&_fractional_second, \&_normalize_offset, ], }, { #YYYYMMDDThhmmss.ss[+-]hh 19850412T101530.5+01 20041020T101530.5-05 regex => qr/^ (\d{4}) (\d\d) (\d\d) T?? (\d\d) (\d\d) (\d\d) [\.,] (\d+) ([+-] \d\d ) $/x, params => [ qw( year month day hour minute second nanosecond time_zone ) ], postprocess => [ \&_fractional_second, \&_normalize_offset, ], }, { #YYYY-MM-DDThh:mm:ss.ss[+-]hh:mm 1985-04-12T10:15:30.5+01:00 1985-04-12T10:15:30.5-05:00 regex => qr/^ (\d{4}) - (\d\d) - (\d\d) T?? (\d\d) : (\d\d) : (\d\d) [\.,] (\d+) ([+-] \d\d : \d\d) $/x, params => [ qw( year month day hour minute second nanosecond time_zone ) ], postprocess => [ \&_fractional_second, \&_normalize_offset, ], }, { #YYYYMMDDThhmmss[+-]hh 19850412T101530+04 #YYYY-MM-DDThh:mm:ss[+-]hh 1985-04-12T10:15:30+04 length => [qw( 18 22 )], regex => qr/^ (\d{4}) -?? (\d\d) -?? (\d\d) T (\d\d) :?? (\d\d) :?? (\d\d) ([+-] \d\d) $/x, params => [qw( year month day hour minute second time_zone )], postprocess => \&_normalize_offset, }, { #YYYYMMDDThhmm 19850412T1015 #YYYY-MM-DDThh:mm 1985-04-12T10:15 length => [qw( 13 16 )], regex => qr/^ (\d{4}) -?? (\d\d) -?? (\d\d) T (\d\d) :?? (\d\d) $/x, params => [qw( year month day hour minute )], extra => { time_zone => 'floating' }, }, { #YYYYMMDDThhmmZ 19850412T1015 #YYYY-MM-DDThh:mmZ 1985-04-12T10:15 length => [qw( 14 17 )], regex => qr/^ (\d{4}) -?? (\d\d) -?? (\d\d) T (\d\d) :?? (\d\d) Z $/x, params => [qw( year month day hour minute )], extra => { time_zone => 'UTC' }, }, { #YYYYDDDThhmm 1985102T1015 #YYYY-DDDThh:mm 1985-102T10:15 length => [qw( 12 14 )], regex => qr/^ (\d{4}) -?? (\d{3}) T (\d\d) :?? (\d\d) $/x, params => [qw( year day_of_year hour minute )], extra => { time_zone => 'floating' }, constructor => [ 'DateTime', 'from_day_of_year' ], }, { #YYYYDDDThhmmZ 1985102T1015Z #YYYY-DDDThh:mmZ 1985-102T10:15Z length => [qw( 13 15 )], regex => qr/^ (\d{4}) -?? (\d{3}) T (\d\d) :?? (\d\d) Z $/x, params => [qw( year day_of_year hour minute )], extra => { time_zone => 'UTC' }, constructor => [ 'DateTime', 'from_day_of_year' ], }, { #YYYYWwwDThhmm[+-]hhmm 1985W155T1015+0400 #YYYY-Www-DThh:mm[+-]hh 1985-W15-5T10:15+04 length => [qw( 18 19 )], regex => qr/^ (\d{4}) -?? W (\d\d) -?? (\d) T (\d\d) :?? (\d\d) ([+-] \d{2,4}) $/x, params => [qw( year week day_of_week hour minute time_zone)], postprocess => [ \&_normalize_week, \&_normalize_offset ], constructor => [ 'DateTime', 'from_day_of_year' ], }, ], parse_time => [ { #hhmmss 232050 length => [qw( 6 7 )], regex => qr/^ T?? (\d\d) (\d\d) (\d\d) $/x, params => [qw( hour minute second )], postprocess => [ \&_add_year, \&_add_month, \&_add_day, ], }, { #hhmm 2320 length => [qw( 4 5 )], regex => qr/^ T?? (\d\d) (\d\d) $/x, params => [qw( hour minute )], postprocess => [ \&_add_year, \&_add_month, \&_add_day, ], }, { #hh 23 length => [qw( 2 3 )], regex => qr/^ T?? (\d\d) $/x, params => [qw( hour )], postprocess => [ \&_add_year, \&_add_month, \&_add_day, ], }, { #-mmss -2050 length => 5, regex => qr/^ - (\d\d) (\d\d) $/x, params => [qw( minute second )], postprocess => [ \&_add_year, \&_add_month, \&_add_day, \&_add_hour, ], }, { #-mm -20 length => 3, regex => qr/^ - (\d\d) $/x, params => [qw( minute )], postprocess => [ \&_add_year, \&_add_month, \&_add_day, \&_add_hour, ], }, { #--ss --50 length => 4, regex => qr/^ -- (\d\d) $/x, params => [qw( second )], postprocess => [ \&_add_year, \&_add_month, \&_add_day, \&_add_hour, \&_add_minute, ], }, ], } ); sub _fix_1_digit_year { my %p = @_; my $year = _base_dt( $p{self} )->year; $year =~ s/.$//; $p{parsed}{year} = $year . $p{parsed}{year}; return 1; } sub _fix_2_digit_year { my %p = @_; # this is a mess because of the need to support parse_* being called # as a class method if ( ref $p{self} && exists $p{self}{legacy_year} ) { if ( $p{self}{legacy_year} ) { my $cutoff = exists $p{self}{cut_off_year} ? $p{self}{cut_off_year} : $p{self}->DefaultCutOffYear; $p{parsed}{year} += $p{parsed}{year} > $cutoff ? 1900 : 2000; } else { my $century = ( $p{self}{base_datetime} || DateTime->now ) ->strftime('%C'); $p{parsed}{year} += $century * 100; } } else { my $cutoff = ref $p{self} && exists $p{self}{cut_off_year} ? $p{self}{cut_off_year} : $p{self}->DefaultCutOffYear; $p{parsed}{year} += $p{parsed}{year} > $cutoff ? 1900 : 2000; } return 1; } sub _add_minute { my %p = @_; $p{parsed}{minute} = _base_dt( $p{self} )->minute; return 1; } sub _add_hour { my %p = @_; $p{parsed}{hour} = _base_dt( $p{self} )->hour; return 1; } sub _add_day { my %p = @_; $p{parsed}{day} = _base_dt( $p{self} )->day; return 1; } sub _add_week { my %p = @_; $p{parsed}{week} = _base_dt( $p{self} )->week; return 1; } sub _add_month { my %p = @_; $p{parsed}{month} = _base_dt( $p{self} )->month; return 1; } sub _add_year { my %p = @_; $p{parsed}{year} = _base_dt( $p{self} )->year; return 1; } sub _base_dt { return $_[0]{base_datetime} if ref $_[0] && $_[0]{base_datetime}; return DateTime->now; } sub _fractional_second { my %p = @_; ## no critic (ValuesAndExpressions::ProhibitMismatchedOperators) $p{parsed}{nanosecond} = int( ".$p{ parsed }{ nanosecond }" * 10**9 ); return 1; } sub _fractional_minute { my %p = @_; ## no critic (ValuesAndExpressions::ProhibitMismatchedOperators) $p{parsed}{second} = ".$p{ parsed }{ second }" * 60; return 1; } sub _fractional_hour { my %p = @_; ## no critic (ValuesAndExpressions::ProhibitMismatchedOperators) $p{parsed}{minute} = ".$p{ parsed }{ minute }" * 60; return 1; } sub _normalize_offset { my %p = @_; $p{parsed}{time_zone} =~ s/://; if ( length $p{parsed}{time_zone} == 3 ) { $p{parsed}{time_zone} .= '00'; } return 1; } sub _normalize_week { my %p = @_; # See # https://en.wikipedia.org/wiki/ISO_week_date#Calculating_an_ordinal_or_month_date_from_a_week_date # for the algorithm we're using here. my $od = $p{parsed}{week} * 7; $od += ( exists $p{parsed}{day_of_week} ? $p{parsed}{day_of_week} : 1 ); $od -= DateTime->new( year => $p{parsed}{year}, month => 1, day => 4, )->day_of_week + 3; my ( $year, $day_of_year ); if ( $od < 1 ) { $year = $p{parsed}{year} - 1; $day_of_year = DateTime->new( year => $year )->year_length + $od; } else { my $year_length = DateTime->new( year => $p{parsed}{year} )->year_length; if ( $od > $year_length ) { $year = $p{parsed}{year} + 1; $day_of_year = $od - $year_length; } else { $year = $p{parsed}{year}; $day_of_year = $od; } } # We need to leave the references in $p{parsed} as is. We cannot create a # new reference. $p{parsed}{year} = $year; $p{parsed}{day_of_year} = $day_of_year; delete $p{parsed}{week}; delete $p{parsed}{day_of_week}; return 1; } sub _normalize_century { my %p = @_; $p{parsed}{year} .= '01'; return 1; } 1; # ABSTRACT: Parses ISO8601 formats __END__ =pod =encoding UTF-8 =head1 NAME DateTime::Format::ISO8601 - Parses ISO8601 formats =head1 VERSION version 0.17 =head1 SYNOPSIS use DateTime::Format::ISO8601; my $datetime_str = '2020-07-25T11:32:31'; my $dt = DateTime::Format::ISO8601->parse_datetime($datetime_str); say $dt; # This format is ambiguous and could be either a date or time, so use the # parse_time method. my $time_str = '113231'; $dt = DateTime::Format::ISO8601->parse_time($time_str); say $dt; # or my $iso8601 = DateTime::Format::ISO8601->new; $dt = $iso8601->parse_datetime($datetime_str); say $dt; $dt = $iso8601->parse_time($time_str); say $dt; say DateTime::Format::ISO8601->format_datetime($dt); =head1 DESCRIPTION Parses almost all ISO8601 date and time formats. ISO8601 time-intervals will be supported in a later release. =head1 METHODS This class provides the following methods: =head2 Constructors =head3 DateTime::Format::ISO8601->new( ... ) Accepts an optional hash. my $iso8601 = DateTime::Format::ISO8601->new( base_datetime => $dt, cut_off_year => 42, legacy_year => 1, ); =over 4 =item * base_datetime A C object that will be used to fill in missing information from incomplete date/time formats. This key is optional. =item * cut_off_year A integer representing the cut-off point between interpreting 2-digits years as 19xx or 20xx. 2-digit years < cut_off_year will be interpreted as 20xx 2-digit years >= cut_off_year will be untreated as 19xx This key defaults to the value of C. =item * legacy_year A boolean value controlling if a 2-digit year is interpreted as being in the current century (unless a C is set) or if C should be used to place the year in either 20xx or 19xx. If this is true, then the C is used. If this is false, then the year is always interpreted as being in the current century. This key defaults to the value of C. =back =head3 $iso8601->clone Returns a replica of the given object. =head2 Object Methods =head3 $iso8601->base_datetime Returns a C object if a C has been set. =head3 $iso8601->set_base_datetime( object => $object ) Accepts a C object that will be used to fill in missing information from incomplete date/time formats. =head3 $iso8601->cut_off_year Returns a integer representing the cut-off point between interpreting 2-digits years as 19xx or 20xx. =head3 $iso8601->set_cut_off_year($int) Accepts a integer representing the cut-off point between interpreting 2-digits years as 19xx or 20xx. 2-digit years < legacy_year will be interpreted as 20xx 2-digit years >= legacy_year will be interpreted as 19xx =head3 $iso8601->legacy_year Returns a boolean value indicating the 2-digit year handling behavior. =head3 $iso8601->set_legacy_year($bool) Accepts a boolean value controlling if a 2-digit year is interpreted as being in the current century (unless a C is set) or if C should be used to place the year in either 20xx or 19xx. =head2 Class Methods =head3 DateTime::Format::ISO8601->DefaultCutOffYear($int) Accepts a integer representing the cut-off point for 2-digit years when calling C as class methods and the default value for C when creating objects. If called with no parameters this method will return the default value for C. =head3 DateTime::Format::ISO8601->DefaultLegacyYear($bool) Accepts a boolean value controlling the legacy year behavior when calling C as class methods and the default value for C when creating objects. If called with no parameters this method will return the default value for C. =head2 Parser(s) These methods may be called as either class or object methods. =head3 parse_datetime =head3 parse_time Please see the L section. =head2 Formatter This may be called as either class or object method. =head3 format_datetime($dt) Formats the datetime in an ISO8601-compatible format. This differs from L by including nanoseconds/milliseconds and the correct timezone offset. =head1 FORMATS There are 6 strings that can match against date only or time only formats. The C method will attempt to match these ambiguous strings against date only formats. If you want to match against the time only formats use the C method. =head2 Conventions =over 4 =item * Expanded ISO8601 These formats are supported with exactly 6 digits for the year. Support for a variable number of digits will be in a later release. =item * Precision If a format doesn't include a year all larger time unit up to and including the year are filled in using the current date/time or [if set] the C object. =item * Fractional time There is no limit on the expressed precision. =back =head2 Supported via parse_datetime The supported formats are listed by the section of ISO 8601:2000(E) in which they appear. =head3 5.2 Dates =over 4 =item * 5.2.1.1 =over 8 =item YYYYMMDD =item YYYY-MM-DD =back =item * 5.2.1.2 =over 8 =item YYYY-MM =item YYYY =item YY =back =item * 5.2.1.3 =over 8 =item YYMMDD =item YY-MM-DD =item -YYMM =item -YY-MM =item -YY =item --MMDD =item --MM-DD =item --MM =item ---DD =back =item * 5.2.1.4 =over 8 =item +[YY]YYYYMMDD =item +[YY]YYYY-MM-DD =item +[YY]YYYY-MM =item +[YY]YYYY =item +[YY]YY =back =item * 5.2.2.1 =over 8 =item YYYYDDD =item YYYY-DDD =back =item * 5.2.2.2 =over 8 =item YYDDD =item YY-DDD =item -DDD =back =item * 5.2.2.3 =over 8 =item +[YY]YYYYDDD =item +[YY]YYYY-DDD =back =item * 5.2.3.1 =over 8 =item YYYYWwwD =item YYYY-Www-D =back =item * 5.2.3.2 =over 8 =item YYYYWww =item YYYY-Www =item YYWwwD =item YY-Www-D =item YYWww =item YY-Www =item -YWwwD =item -Y-Www-D =item -YWww =item -Y-Www =item -WwwD =item -Www-D =item -Www =item -W-D =back =item * 5.2.3.4 =over 8 =item +[YY]YYYYWwwD =item +[YY]YYYY-Www-D =item +[YY]YYYYWww =item +[YY]YYYY-Www =back =back =head3 5.3 Time of Day =over 4 =item * 5.3.1.1 - 5.3.1.3 Values can optionally be prefixed with 'T'. =item * 5.3.1.1 =over 8 =item hh:mm:ss =back =item * 5.3.1.2 =over 8 =item hh:mm =back =item * 5.3.1.3 - 5.3.1.4 fractional (decimal) separator maybe either ',' or '.' =item * 5.3.1.3 =over 8 =item hhmmss,ss =item hh:mm:ss,ss =item hhmm,mm =item hh:mm,mm =item hh,hh =back =item * 5.3.1.4 =over 8 =item -mm:ss =item -mmss,s =item -mm:ss,s =item -mm,m =item --ss,s =back =item * 5.3.3 - 5.3.4.2 Values can optionally be prefixed with 'T'. =item * 5.3.3 =over 8 =item hhmmssZ =item hh:mm:ssZ =item hhmmZ =item hh:mmZ =item hhZ =item hhmmss.ssZ =item hh:mm:ss.ssZ =back =item * 5.3.4.2 =over 8 =item hhmmss[+-]hhmm =item hh:mm:ss[+-]hh:mm =item hhmmss[+-]hh =item hh:mm:ss[+-]hh =item hhmmss.ss[+-]hhmm =item hh:mm:ss.ss[+-]hh:mm =back =back =head3 5.4 Combinations of date and time of day =over 4 =item * 5.4.1 =over 8 =item YYYYMMDDThhmmss =item YYYY-MM-DDThh:mm:ss =item YYYYMMDDThhmmssZ =item YYYY-MM-DDThh:mm:ssZ =item YYYYMMDDThhmmss[+-]hhmm =item YYYY-MM-DDThh:mm:ss[+-]hh:mm =item YYYYMMDDThhmmss[+-]hh =item YYYY-MM-DDThh:mm:ss[+-]hh =back =item * 5.4.2 =over 8 =item YYYYMMDDThhmmss.ss =item YYYY-MM-DDThh:mm:ss.ss =item YYYYMMDDThhmmss.ss[+-]hh =item YYYY-MM-DDThh:mm:ss.ss[+-]hh =item YYYYMMDDThhmmss.ss[+-]hhmm =item YYYY-MM-DDThh:mm:ss.ss[+-]hh:mm =back =item * 5.4.3 Support for this section is not complete. =over 8 =item YYYYMMDDThhmm =item YYYY-MM-DDThh:mm =item YYYYMMDDThhmmZ =item YYYY-MM-DDThh:mmZ =item YYYYDDDThhmm =item YYYY-DDDThh:mm =item YYYYDDDThhmmZ =item YYYY-DDDThh:mmZ =item YYYYWwwDThhmm[+-]hhmm =item YYYY-Www-DThh:mm[+-]hh =back =back =head3 5.5 Time-Intervals These are not currently supported =head2 Supported via parse_time =head3 5.3.1.1 - 5.3.1.3 Values can optionally be prefixed with 'T'. =over 4 =item * 5.3.1.1 =over 8 =item hhmmss =back =item * 5.3.1.2 =over 8 =item hhmm =item hh =back =item * 5.3.1.4 =over 8 =item -mmss =item -mm =item --ss =back =back =head1 STANDARDS DOCUMENT =head2 Title ISO8601:2000(E) Data elements and interchange formats - information exchange - Representation of dates and times Second edition 2000-12-15 =head2 Reference Number ISO/TC 154 N 362 =head1 CREDITS Iain 'Spoon' Truskett (SPOON) who wrote L. That has grown into I Katana> of date and time parsing. This module was inspired by and conceived in honor of Iain's work. Tom Phoenix (PHOENIX) and PDX.pm for helping me solve the ISO week conversion bug. Not by fixing the code but motivation me to fix it so I could participate in a game of C. Jonathan Leffler (JOHNL) for reporting a test bug. Kelly McCauley for a patch to add 8 missing formats. Alasdair Allan (AALLAN) for complaining about excessive test execution time. Everyone at the DateTime C. =head1 SEE ALSO =over 4 =item * L =item * L =back =head1 SUPPORT Bugs may be submitted at L. =head1 SOURCE The source code repository for DateTime-Format-ISO8601 can be found at L. =head1 AUTHORS =over 4 =item * Joshua Hoblitt =item * Dave Rolsky =back =head1 CONTRIBUTORS =for stopwords Doug Bell joe Liam Widdowson Thomas Klausner William Ricker =over 4 =item * Doug Bell =item * joe =item * Liam Widdowson =item * Thomas Klausner =item * William Ricker =back =head1 COPYRIGHT AND LICENSE This software is copyright (c) 2025 by Joshua Hoblitt. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. The full text of the license can be found in the F file included with this distribution. =cut DateTime-Format-ISO8601-0.17/lib/DateTime/Format/ISO8601/0000775000175000017500000000000014756442575021662 5ustar autarchautarchDateTime-Format-ISO8601-0.17/lib/DateTime/Format/ISO8601/Types.pm0000644000175000017500000000302414756442575023321 0ustar autarchautarchpackage DateTime::Format::ISO8601::Types; use strict; use warnings; use namespace::autoclean; our $VERSION = '0.17'; use parent 'Specio::Exporter'; use DateTime; use Specio 0.18; use Specio::Declare; use Specio::Library::Builtins -reexport; declare( 'CutOffYear', parent => t('Int'), inline => sub { shift; my $value = shift; return "$value >= 0 && $value <= 99",; }, ); object_isa_type( 'DateTime', class => 'DateTime', ); object_can_type( 'DateTimeIsh', methods => ['utc_rd_values'], ); 1; # ABSTRACT: Types used for parameter checking in DateTime __END__ =pod =encoding UTF-8 =head1 NAME DateTime::Format::ISO8601::Types - Types used for parameter checking in DateTime =head1 VERSION version 0.17 =head1 DESCRIPTION This module has no user-facing parts. =for Pod::Coverage .* =head1 SUPPORT Bugs may be submitted at L. =head1 SOURCE The source code repository for DateTime-Format-ISO8601 can be found at L. =head1 AUTHORS =over 4 =item * Joshua Hoblitt =item * Dave Rolsky =back =head1 COPYRIGHT AND LICENSE This software is copyright (c) 2025 by Joshua Hoblitt. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. The full text of the license can be found in the F file included with this distribution. =cut DateTime-Format-ISO8601-0.17/xt/0000775000175000017500000000000014756442575015652 5ustar autarchautarchDateTime-Format-ISO8601-0.17/xt/release/0000775000175000017500000000000014756442575017272 5ustar autarchautarchDateTime-Format-ISO8601-0.17/xt/release/cpan-changes.t0000644000175000017500000000034414756442575022005 0ustar autarchautarchuse strict; use warnings; # this test was generated with Dist::Zilla::Plugin::Test::CPAN::Changes 0.013 use Test::More 0.96 tests => 1; use Test::CPAN::Changes; subtest 'changes_ok' => sub { changes_file_ok('Changes'); }; DateTime-Format-ISO8601-0.17/xt/release/meta-json.t0000644000175000017500000000006414756442575021352 0ustar autarchautarch#!perl use Test::CPAN::Meta::JSON; meta_json_ok(); DateTime-Format-ISO8601-0.17/xt/author/0000775000175000017500000000000014756442575017154 5ustar autarchautarchDateTime-Format-ISO8601-0.17/xt/author/pod-spell.t0000644000175000017500000000133214756442575021235 0ustar autarchautarchuse strict; use warnings; use Test::More; # generated by Dist::Zilla::Plugin::Test::PodSpelling 2.007006 use Test::Spelling 0.17; use Pod::Wordlist; add_stopwords(); all_pod_files_spelling_ok( qw( bin lib ) ); __DATA__ AALLAN Alasdair Bell DDD DROLSKY DROLSKY's DateTime Dave Doug Format Hoblitt ISO8601 Iain JOHNL Joshua Katana Klausner Leffler Liam MMDD McCauley PDX PayPal Ricker Rolsky Rolsky's Thomas Truskett Types Widdowson William Www WwwD YWww YWwwD YY YYDDD YYMM YYMMDD YYWww YYWwwD YYYY YYYYDDD YYYYDDDThhmm YYYYDDDThhmmZ YYYYMMDD YYYYMMDDThhmm YYYYMMDDThhmmZ YYYYMMDDThhmmss YYYYMMDDThhmmssZ YYYYWww YYYYWwwD autarch bill domm doug draxil drolsky hh hhZ hhmm hhmmZ hhmmss hhmmssZ joe josh lbw lib mmss ss ssZ DateTime-Format-ISO8601-0.17/xt/author/synopsis.t0000644000175000017500000000006014756442575021222 0ustar autarchautarch#!perl use Test::Synopsis; all_synopsis_ok(); DateTime-Format-ISO8601-0.17/xt/author/precious.t0000644000175000017500000000105714756442575021173 0ustar autarchautarchuse strict; use warnings; use Test::More; use Capture::Tiny qw( capture ); use Encode qw( decode ); use FindBin qw( $Bin ); binmode $_, ':encoding(utf-8)' for map { Test::More->builder->$_ } qw( output failure_output todo_output ); chdir "$Bin/../.." or die "Cannot chdir to $Bin/../..: $!"; my ( $out, $err ) = capture { system(qw( precious lint -a )) }; $_ = decode( 'UTF-8', $_ ) for grep {defined} $out, $err; is( $? >> 8, 0, 'precious lint -a exited with 0' ) or diag($out); is( $err, q{}, 'no output to stderr' ); done_testing(); DateTime-Format-ISO8601-0.17/xt/author/no-tabs.t0000644000175000017500000000100214756442575020673 0ustar autarchautarchuse strict; use warnings; # this test was generated with Dist::Zilla::Plugin::Test::NoTabs 0.15 use Test::More 0.88; use Test::NoTabs; my @files = ( 'lib/DateTime/Format/ISO8601.pm', 'lib/DateTime/Format/ISO8601/Types.pm', 't/00-report-prereqs.dd', 't/00-report-prereqs.t', 't/bad-formats.t', 't/base-datetime.t', 't/cut-off-year.t', 't/date.t', 't/datetime.t', 't/format-datetime.t', 't/legacy-year.t', 't/time.t' ); notabs_ok($_) foreach @files; done_testing; DateTime-Format-ISO8601-0.17/xt/author/portability.t0000644000175000017500000000013014756442575021673 0ustar autarchautarchuse strict; use warnings; use Test::More; use Test::Portability::Files; run_tests(); DateTime-Format-ISO8601-0.17/xt/author/mojibake.t0000644000175000017500000000015114756442575021115 0ustar autarchautarch#!perl use strict; use warnings qw(all); use Test::More; use Test::Mojibake; all_files_encoding_ok(); DateTime-Format-ISO8601-0.17/xt/author/test-all-my-deps.t0000644000175000017500000000135214756442575022441 0ustar autarchautarchuse strict; use warnings; use Cwd qw( abs_path ); use Test::More; BEGIN { plan skip_all => 'Must set DATETIME_FORMAT_ISO8601_TEST_DEPS to true in order to run these tests' unless $ENV{DATETIME_FORMAT_ISO8601_TEST_DEPS}; } use Test::DependentModules qw( test_all_dependents ); local $ENV{PERL_TEST_DM_LOG_DIR} = abs_path('.'); my %exclude = map { $_ => 1 } ( # Tests hit live MetaCPAN and are very slow 'App-RetroPAN', # undeclared dep on DBD-mysql 'CPAN-Testers-Schema', # Fails tests out of the box 'Marketplace-Rakuten', # Generated Makefile doesn't work 'SReview', ); test_all_dependents( 'DateTime-Format-ISO8601', { filter => sub { !$exclude{ $_[0] } } }, ); DateTime-Format-ISO8601-0.17/xt/author/test-version.t0000644000175000017500000000063714756442575022007 0ustar autarchautarchuse strict; use warnings; use Test::More; # generated by Dist::Zilla::Plugin::Test::Version 1.09 use Test::Version; my @imports = qw( version_all_ok ); my $params = { is_strict => 1, has_version => 1, multiple => 0, }; push @imports, $params if version->parse( $Test::Version::VERSION ) >= version->parse('1.002'); Test::Version->import(@imports); version_all_ok; done_testing; DateTime-Format-ISO8601-0.17/xt/author/pod-coverage.t0000644000175000017500000000172014756442575021712 0ustar autarchautarch#!perl # This file was automatically generated by Dist::Zilla::Plugin::Test::Pod::Coverage::Configurable 0.07. use Test::Pod::Coverage 1.08; use Test::More 0.88; BEGIN { if ( $] <= 5.008008 ) { plan skip_all => 'These tests require Pod::Coverage::TrustPod, which only works with Perl 5.8.9+'; } } use Pod::Coverage::TrustPod; my %skip = map { $_ => 1 } qw( ); my @modules; for my $module ( all_modules() ) { next if $skip{$module}; push @modules, $module; } plan skip_all => 'All the modules we found were excluded from POD coverage test.' unless @modules; plan tests => scalar @modules; my %trustme = (); my @also_private; for my $module ( sort @modules ) { pod_coverage_ok( $module, { coverage_class => 'Pod::Coverage::TrustPod', also_private => \@also_private, trustme => $trustme{$module} || [], }, "pod coverage for $module" ); } done_testing(); DateTime-Format-ISO8601-0.17/xt/author/00-compile.t0000644000175000017500000000262714756442575021213 0ustar autarchautarchuse 5.006; use strict; use warnings; # this test was generated with Dist::Zilla::Plugin::Test::Compile 2.058 use Test::More; plan tests => 3; my @module_files = ( 'DateTime/Format/ISO8601.pm', 'DateTime/Format/ISO8601/Types.pm' ); # no fake home requested my @switches = ( -d 'blib' ? '-Mblib' : '-Ilib', ); use File::Spec; use IPC::Open3; use IO::Handle; open my $stdin, '<', File::Spec->devnull or die "can't open devnull: $!"; my @warnings; for my $lib (@module_files) { # see L my $stderr = IO::Handle->new; diag('Running: ', join(', ', map { my $str = $_; $str =~ s/'/\\'/g; q{'} . $str . q{'} } $^X, @switches, '-e', "require q[$lib]")) if $ENV{PERL_COMPILE_TEST_DEBUG}; my $pid = open3($stdin, '>&STDERR', $stderr, $^X, @switches, '-e', "require q[$lib]"); binmode $stderr, ':crlf' if $^O eq 'MSWin32'; my @_warnings = <$stderr>; waitpid($pid, 0); is($?, 0, "$lib loaded ok"); shift @_warnings if @_warnings and $_warnings[0] =~ /^Using .*\bblib/ and not eval { +require blib; blib->VERSION('1.01') }; if (@_warnings) { warn @_warnings; push @warnings, @_warnings; } } is(scalar(@warnings), 0, 'no warnings found') or diag 'got warnings: ', ( Test::More->can('explain') ? Test::More::explain(\@warnings) : join("\n", '', @warnings) ); DateTime-Format-ISO8601-0.17/xt/author/pod-syntax.t0000644000175000017500000000025214756442575021444 0ustar autarchautarch#!perl # This file was automatically generated by Dist::Zilla::Plugin::PodSyntaxTests. use strict; use warnings; use Test::More; use Test::Pod 1.41; all_pod_files_ok(); DateTime-Format-ISO8601-0.17/xt/author/eol.t0000644000175000017500000000103414756442575020114 0ustar autarchautarchuse strict; use warnings; # this test was generated with Dist::Zilla::Plugin::Test::EOL 0.19 use Test::More 0.88; use Test::EOL; my @files = ( 'lib/DateTime/Format/ISO8601.pm', 'lib/DateTime/Format/ISO8601/Types.pm', 't/00-report-prereqs.dd', 't/00-report-prereqs.t', 't/bad-formats.t', 't/base-datetime.t', 't/cut-off-year.t', 't/date.t', 't/datetime.t', 't/format-datetime.t', 't/legacy-year.t', 't/time.t' ); eol_unix_ok($_, { trailing_whitespace => 1 }) foreach @files; done_testing; DateTime-Format-ISO8601-0.17/perlcriticrc0000644000175000017500000000370514756442575017632 0ustar autarchautarchseverity = 3 verbose = 11 theme = (core && (pbp || bugs || maintenance || cosmetic || complexity || security || tests)) || moose program-extensions = pl psgi t exclude = Subroutines::ProhibitCallsToUndeclaredSubs [BuiltinFunctions::ProhibitStringySplit] severity = 3 [CodeLayout::RequireTrailingCommas] severity = 3 [ControlStructures::ProhibitCStyleForLoops] severity = 3 [InputOutput::RequireCheckedSyscalls] functions = :builtins exclude_functions = sleep severity = 3 [RegularExpressions::ProhibitComplexRegexes] max_characters = 200 [RegularExpressions::ProhibitUnusualDelimiters] severity = 3 [Subroutines::ProhibitUnusedPrivateSubroutines] private_name_regex = _(?!build)\w+ [TestingAndDebugging::ProhibitNoWarnings] allow = redefine [ValuesAndExpressions::ProhibitEmptyQuotes] severity = 3 [ValuesAndExpressions::ProhibitInterpolationOfLiterals] severity = 3 [ValuesAndExpressions::RequireUpperCaseHeredocTerminator] severity = 3 [Variables::ProhibitPackageVars] add_packages = Carp Test::Builder [-Subroutines::RequireFinalReturn] # This incorrectly thinks signatures are prototypes. [-Subroutines::ProhibitSubroutinePrototypes] [-ErrorHandling::RequireCarping] # No need for /xsm everywhere [-RegularExpressions::RequireDotMatchAnything] [-RegularExpressions::RequireExtendedFormatting] [-RegularExpressions::RequireLineBoundaryMatching] # http://stackoverflow.com/questions/2275317/why-does-perlcritic-dislike-using-shift-to-populate-subroutine-variables [-Subroutines::RequireArgUnpacking] # "use v5.14" is more readable than "use 5.014" [-ValuesAndExpressions::ProhibitVersionStrings] # Explicitly returning undef is a _good_ thing in many cases, since it # prevents very common errors when using a sub in list context to construct a # hash and ending up with a missing value or key. [-Subroutines::ProhibitExplicitReturnUndef] # Sometimes I want to write "return unless $x > 4" [-ControlStructures::ProhibitNegativeExpressionsInUnlessAndUntilConditions] DateTime-Format-ISO8601-0.17/cpanfile0000644000175000017500000000356614756442575016733 0ustar autarchautarch# This file is generated by Dist::Zilla::Plugin::CPANFile v6.032 # Do not edit this file directly. To change prereqs, edit the `dist.ini` file. requires "Carp" => "0"; requires "DateTime" => "1.45"; requires "DateTime::Format::Builder" => "0.77"; requires "Params::ValidationCompiler" => "0.26"; requires "Specio" => "0.18"; requires "Specio::Declare" => "0"; requires "Specio::Exporter" => "0"; requires "Specio::Library::Builtins" => "0"; requires "namespace::autoclean" => "0"; requires "parent" => "0"; requires "strict" => "0"; requires "warnings" => "0"; on 'test' => sub { requires "ExtUtils::MakeMaker" => "0"; requires "File::Spec" => "0"; requires "Test2::V0" => "0"; requires "Test::More" => "1.302015"; }; on 'test' => sub { recommends "CPAN::Meta" => "2.120900"; }; on 'configure' => sub { requires "ExtUtils::MakeMaker" => "0"; }; on 'develop' => sub { requires "Capture::Tiny" => "0"; requires "Cwd" => "0"; requires "Encode" => "0"; requires "File::Spec" => "0"; requires "FindBin" => "0"; requires "IO::Handle" => "0"; requires "IPC::Open3" => "0"; requires "Perl::Critic" => "1.138"; requires "Perl::Critic::Moose" => "1.05"; requires "Perl::Tidy" => "20210111"; requires "Pod::Checker" => "1.74"; requires "Pod::Coverage::TrustPod" => "0"; requires "Pod::Tidy" => "0.10"; requires "Pod::Wordlist" => "0"; requires "Test::CPAN::Changes" => "0.19"; requires "Test::CPAN::Meta::JSON" => "0.16"; requires "Test::DependentModules" => "0"; requires "Test::EOL" => "0"; requires "Test::Mojibake" => "0"; requires "Test::More" => "0.96"; requires "Test::NoTabs" => "0"; requires "Test::Pod" => "1.41"; requires "Test::Pod::Coverage" => "1.08"; requires "Test::Portability::Files" => "0"; requires "Test::Spelling" => "0.17"; requires "Test::Synopsis" => "0"; requires "Test::Version" => "2.05"; requires "perl" => "5.006"; }; DateTime-Format-ISO8601-0.17/t/0000775000175000017500000000000014756442575015462 5ustar autarchautarchDateTime-Format-ISO8601-0.17/t/00-report-prereqs.dd0000644000175000017500000000665214756442575021211 0ustar autarchautarchdo { my $x = { 'configure' => { 'requires' => { 'ExtUtils::MakeMaker' => '0' } }, 'develop' => { 'requires' => { 'Capture::Tiny' => '0', 'Cwd' => '0', 'Encode' => '0', 'File::Spec' => '0', 'FindBin' => '0', 'IO::Handle' => '0', 'IPC::Open3' => '0', 'Perl::Critic' => '1.138', 'Perl::Critic::Moose' => '1.05', 'Perl::Tidy' => '20210111', 'Pod::Checker' => '1.74', 'Pod::Coverage::TrustPod' => '0', 'Pod::Tidy' => '0.10', 'Pod::Wordlist' => '0', 'Test::CPAN::Changes' => '0.19', 'Test::CPAN::Meta::JSON' => '0.16', 'Test::DependentModules' => '0', 'Test::EOL' => '0', 'Test::Mojibake' => '0', 'Test::More' => '0.96', 'Test::NoTabs' => '0', 'Test::Pod' => '1.41', 'Test::Pod::Coverage' => '1.08', 'Test::Portability::Files' => '0', 'Test::Spelling' => '0.17', 'Test::Synopsis' => '0', 'Test::Version' => '2.05', 'perl' => '5.006' } }, 'runtime' => { 'requires' => { 'Carp' => '0', 'DateTime' => '1.45', 'DateTime::Format::Builder' => '0.77', 'Params::ValidationCompiler' => '0.26', 'Specio' => '0.18', 'Specio::Declare' => '0', 'Specio::Exporter' => '0', 'Specio::Library::Builtins' => '0', 'namespace::autoclean' => '0', 'parent' => '0', 'strict' => '0', 'warnings' => '0' } }, 'test' => { 'recommends' => { 'CPAN::Meta' => '2.120900' }, 'requires' => { 'ExtUtils::MakeMaker' => '0', 'File::Spec' => '0', 'Test2::V0' => '0', 'Test::More' => '1.302015' } } }; $x; }DateTime-Format-ISO8601-0.17/t/legacy-year.t0000644000175000017500000000450314756442575020051 0ustar autarchautarch# Copyright (C) 2005 Joshua Hoblitt use strict; use warnings; use Test2::V0; use DateTime::Format::ISO8601; { is( DateTime::Format::ISO8601->DefaultLegacyYear, 1, 'default legacy year is 1' ); my $iso_parser = DateTime::Format::ISO8601->new; is( $iso_parser->legacy_year, 1, 'legacy_year is 1' ); } for my $n ( 0, 1, undef ) { DateTime::Format::ISO8601->DefaultLegacyYear($n); is( DateTime::Format::ISO8601->DefaultLegacyYear, $n, 'default legacy was set' ); my $iso_parser = DateTime::Format::ISO8601->new; is( $iso_parser->legacy_year, $n, 'set legacy year' ); } for my $n ( -3 .. -1, 2 .. 4 ) { like( dies { DateTime::Format::ISO8601->DefaultLegacyYear($n) }, qr/Validation failed for type named Bool/, 'set legacy year to invalid value', ); } # restore default legacy year behavior DateTime::Format::ISO8601->DefaultLegacyYear(1); for my $n ( 0, 1, undef ) { my $iso_parser = DateTime::Format::ISO8601->new( legacy_year => $n ); isa_ok( $iso_parser, 'DateTime::Format::ISO8601' ); is( $iso_parser->legacy_year, $n, 'pass legacy year to constructor' ); $iso_parser = DateTime::Format::ISO8601->new->set_legacy_year($n); is( $iso_parser->legacy_year, $n, 'call set_legacy_year on object' ); } for my $n ( -3 .. -1, 2 .. 4 ) { like( dies { DateTime::Format::ISO8601->new( legacy_year => $n ) }, qr/Validation failed for type named Bool/, 'pass invalid legacy year to constructor', ); like( dies { DateTime::Format::ISO8601->new->set_legacy_year($n) }, qr/Validation failed for type named Bool/, 'pass invalid legacy year to set_legacy_year', ); } for my $year ( 0 .. 99 ) { $year *= 100; # [0, 9900], step 100 my $iso_parser = DateTime::Format::ISO8601->new( legacy_year => 0, base_datetime => DateTime->new( year => $year ), ); for my $tdy ( 0 .. 9 ) { $tdy *= 10; # [0, 90], step 10 $tdy = sprintf( '%02d', $tdy ); my $dt = $iso_parser->parse_datetime("-$tdy"); is( $dt->year, sprintf( '%d', $iso_parser->base_datetime->strftime('%C') . $tdy ), "parses $tdy based on base_datetime with year $year", ); } } done_testing(); DateTime-Format-ISO8601-0.17/t/base-datetime.t0000644000175000017500000000513114756442575020351 0ustar autarchautarch# Copyright (C) 2005 Joshua Hoblitt use strict; use warnings; use Test2::V0; use DateTime; use DateTime::Format::ISO8601; my @good_bases = ( { year => 0 }, { year => 1 }, { year => 2500 }, { year => 5000 }, { year => 7500 }, { year => 9998 }, { year => 9999, month => 12, day => 12, hour => 23, minute => 59, second => 59, nanosecond => 999_999_999, }, ); my @test_bases = ( [ '1945-09-02T09:04', '1945-W35' ], [ '1987-12-18T02:03', '1987-W51' ], [ '1988-05-05T04:05', '1988-W18' ], [ '1989-10-18T06:07', '1989-W42' ], [ '1991-03-21T08:09', '1991-W12' ], ); my @bad_bases = ( { year => -2 }, { year => -1 }, { year => -1, month => 12, day => 31, hour => 23, minute => 59, second => 59, nanosecond => 999_999_999 }, { year => 10_000 }, { year => 10_001 }, { year => 10_002 }, ); for my $params (@good_bases) { my $dt = DateTime->new(%$params); { my $iso_parser = DateTime::Format::ISO8601->new( base_datetime => $dt, ); isa_ok( $iso_parser, 'DateTime::Format::ISO8601' ); } { my $iso_parser = DateTime::Format::ISO8601->new->set_base_datetime( object => $dt, ); isa_ok( $iso_parser, 'DateTime::Format::ISO8601' ); } } for (@test_bases) { my $iso_parser = DateTime::Format::ISO8601->new( base_datetime => DateTime::Format::ISO8601->parse_datetime( $_->[0] ), ); { #tests... #_add_minute #_add_hour #_add_day #_add_month #_add_year #--ss,s --50,5 my $dt = $iso_parser->parse_datetime('--50,5'); is( $dt->strftime('%Y-%m-%dT%H:%M'), $_->[0] ); } { #tests... #_add_week #_add_year #-W-D -W-5 my $dt = $iso_parser->parse_datetime('-W-5'); is( $dt->strftime('%Y-W%V'), $_->[1] ); } } for my $params (@bad_bases) { my $dt = DateTime->new(%$params); like( dies { DateTime::Format::ISO8601->new( base_datetime => $dt, ); }, qr/base_datetime must be (greater|less) then/, 'invalid base_datetime', ); like( dies { DateTime::Format::ISO8601->new->set_base_datetime( object => $dt, ); }, qr/base_datetime must be (greater|less) then/, 'invalid base_datetime', ); } done_testing(); DateTime-Format-ISO8601-0.17/t/date.t0000644000175000017500000001360614756442575016570 0ustar autarchautarchuse strict; use warnings; use Test2::V0; use DateTime::Format::ISO8601; my $base_year = 2000; my $base_month = '01'; my $base_dt = DateTime->new( year => $base_year, month => $base_month ); my $default_expect_date = '1985-04-12'; my @tests = ( [qw( YYYYMMDD 19850412 )], [qw( YYYY-MM-DD 1985-04-12 )], [qw( YYYY-MM 1985-04 1985-04-01 )], [qw( YYYY 1985 1985-01-01 )], [qw( YY 19 1901-01-01 )], [qw( YYMMDD 850412 )], [qw( YY-MM-DD 85-04-12 )], [qw( -YYMM -8504 1985-04-01 )], [qw( -YY-MM -85-04 1985-04-01 )], [qw( -YY -85 1985-01-01 )], [ qw( --MM-DD --04-12 ), "${base_year}-04-12" ], [ qw( --MM --04 ), "${base_year}-04-01" ], [ qw( ---DD ---12 ), "${base_year}-${base_month}-12" ], [qw( +[YY]YYYYMMDD +0019850412 )], [qw( +[YY]YYYY-MM-DD +001985-04-12 )], [qw( +[YY]YYYY-MM +001985-04 1985-04-01 )], [qw( +[YY]YYYY +001985 1985-01-01 )], [qw( +[YY]YY +0019 1901-01-01 )], [qw( YYYYDDD 1985102 )], [qw( YYYY-DDD 1985-102 )], [qw( YYDDD 85102 )], [qw( YY-DDD 85-102 )], [qw( -DDD -103 2000-04-12 )], [qw( +[YY]YYYYDDD +001985102 )], [qw( +[YY]YYYY-DDD +001985-102 )], [qw( YYYYWwwD 1985W155 )], [qw( YYYY-Www-D 1985-W15-5 )], [qw( YYYYWww 1985W15 1985-04-08 )], [qw( YYYY-Www 1985-W15 1985-04-08 )], [qw( YYWwwD 85W155 )], [qw( YY-Www-D 85-W15-5 )], [qw( YYWww 85W15 1985-04-08 )], [qw( YY-Www 85-W15 1985-04-08 )], [qw( -YWwwD -5W155 2005-04-15 )], [qw( -Y-Www-D -5-W15-5 2005-04-15 )], [qw( -YWww -5W15 2005-04-11 )], [qw( -Y-Www -5-W15 2005-04-11 )], [qw( -WwwD -W155 2000-04-14 )], [qw( -Www-D -W15-5 2000-04-14 )], [qw( -W-D -W-5 2000-12-29 )], [qw( +[YY]YYYYWwwD +001985W155 )], [qw( +[YY]YYYY-Www-D +001985-W15-5 )], [qw( +[YY]YYYYWww +001985W15 1985-04-08 )], [qw( +[YY]YYYY-Www +001985-W15 1985-04-08 )], ); subtest( 'date formats with base_datetime' => sub { my $iso8601 = DateTime::Format::ISO8601->new( base_datetime => $base_dt ); for my $t (@tests) { my ( $format, $to_parse, $expect ) = @{$t}; $expect ||= $default_expect_date; subtest( $format => sub { is( $iso8601->parse_datetime($to_parse)->ymd, $expect, "$to_parse = $expect", ); } ); } } ); subtest( 'date formats without base_datetime' => sub { my $epoch = DateTime->new( year => 2000, month => 1, time_zone => 'UTC' ) ->epoch; no warnings 'redefine'; ## no critic (Variables::ProtectPrivateVars) local *DateTime::_core_time = sub {$epoch}; my $iso8601 = DateTime::Format::ISO8601->new; for my $parser ( $iso8601, 'DateTime::Format::ISO8601' ) { my $st = 'parse with ' . ( ref $parser ? 'object' : 'class' ); subtest( $st => sub { for my $t (@tests) { my ( $format, $to_parse, $expect ) = @{$t}; $expect ||= $default_expect_date; subtest( $format => sub { is( $parser->parse_datetime($to_parse)->ymd, $expect, "$to_parse = $expect", ); } ); } } ); } } ); subtest( 'ISO week of year parsing', sub { my $iso8601 = DateTime::Format::ISO8601->new; my %week_formats = ( 'YYYY-Www' => q{YYYY'-W'ww}, 'YYYY-Www-D' => q{YYYY'-W'ww'-'c}, 'YYYYWww' => q{YYYY'W'ww}, 'YYYYWwwD' => q{YYYY'W'wwc}, ); # This makes sure we cover the entire last week of one year and one # more entire year. my $dt = DateTime->new( year => 1991, month => 12, day => 22 ); # This tests many possible cases, visiting every week in each year at # least once. while ( $dt->year < 2000 ) { $dt->add( days => 3 ); subtest( $dt->ymd, sub { for my $iso_format ( sort keys %week_formats ) { subtest( $iso_format => sub { my $expect; if ( $iso_format =~ /d$/i ) { $expect = $dt->ymd; } else { $expect = $dt->clone->truncate( to => 'week' ) ->ymd; } my $to_parse = $dt->format_cldr( $week_formats{$iso_format} ); is( $iso8601->parse_datetime($to_parse)->ymd, $expect, "$to_parse = $expect", ); } ); } } ); } } ); subtest( '1 digit year in 2015', sub { my $epoch = DateTime->new( year => 2015, month => 1, day => 1 )->epoch; no warnings 'redefine'; ## no critic (Variables::ProtectPrivateVars) local *DateTime::_core_time = sub {$epoch}; my $parser = DateTime::Format::ISO8601->new; my $dt = $parser->parse_datetime('-6W155'); is( $dt->ymd, '2016-04-15' ); } ); done_testing(); DateTime-Format-ISO8601-0.17/t/cut-off-year.t0000644000175000017500000000607714756442575020160 0ustar autarchautarch# Copyright (C) 2005 Joshua Hoblitt use strict; use warnings; use Test2::V0; use DateTime::Format::ISO8601; # DefaultCutOffYear() { is( DateTime::Format::ISO8601->DefaultCutOffYear, 49, 'class default DefaultCutOffYear()' ); is( DateTime::Format::ISO8601->new->cut_off_year, 49, 'object default DefaultCutOffYear()' ); } for my $n ( 0 .. 99 ) { DateTime::Format::ISO8601->DefaultCutOffYear($n); is( DateTime::Format::ISO8601->DefaultCutOffYear, $n, "DefaultCutOffYear == $n", ); is( DateTime::Format::ISO8601->new->cut_off_year, $n, "new->cut_off_year == $n", ); } for my $n ( -3 .. -1, 100 .. 102 ) { like( dies { DateTime::Format::ISO8601->DefaultCutOffYear($n) }, qr/Validation failed for type named CutOffYear/, 'invalid cutoff year', ); } # restore default cut off year behavior DateTime::Format::ISO8601->DefaultCutOffYear(49); # set_cut_off_year() for my $n ( 0 .. 99 ) { { my $iso_parser = DateTime::Format::ISO8601->new( cut_off_year => $n ); isa_ok( $iso_parser, ['DateTime::Format::ISO8601'], "made object with cut_off_year = $n" ); is( $iso_parser->cut_off_year, $n, "cut_off_year returns $n" ); } { my $iso_parser = DateTime::Format::ISO8601->new->set_cut_off_year($n); is( $iso_parser->cut_off_year, $n, "set_cut_off_year to $n" ); } } for my $n ( -3 .. -1, 100 .. 102 ) { like( dies { DateTime::Format::ISO8601->new( cut_off_year => $n ) }, qr/Validation failed for type named CutOffYear/, 'cut_off_year value out of range', ); like( dies { DateTime::Format::ISO8601->new->set_cut_off_year($n) }, qr/Validation failed for type named CutOffYear/, 'set_cut_off_year() value out of range', ); } # parse_datetime() as a class method for my $n ( 0 .. 99 ) { DateTime::Format::ISO8601->DefaultCutOffYear($n); for my $i ( 0 .. DateTime::Format::ISO8601->DefaultCutOffYear ) { my $tdy = sprintf( '%02d', $i ); my $dt = DateTime::Format::ISO8601->parse_datetime("-$tdy"); is( $dt->year, "20$tdy", "year is 20$tdy" ); } for my $i ( ( DateTime::Format::ISO8601->DefaultCutOffYear + 1 ) .. 99 ) { my $tdy = sprintf( '%02d', $i ); my $dt = DateTime::Format::ISO8601->parse_datetime("-$tdy"); is( $dt->year, "19$tdy", "year is 19$tdy" ); } } # parse_datetime() as an object method for my $n ( 0 .. 99 ) { my $iso_parser = DateTime::Format::ISO8601->new( cut_off_year => $n ); for my $i ( 0 .. $iso_parser->cut_off_year ) { my $tdy = sprintf( '%02d', $i ); my $dt = $iso_parser->parse_datetime("-$tdy"); is( $dt->year, "20$tdy", "year is 20$tdy" ); } for my $i ( ( $iso_parser->cut_off_year + 1 ) .. 99 ) { my $tdy = sprintf( '%02d', $i ); my $dt = $iso_parser->parse_datetime("-$tdy"); is( $dt->year, "19$tdy", "year is 19$tdy" ); } } done_testing(); DateTime-Format-ISO8601-0.17/t/00-report-prereqs.t0000644000175000017500000001360114756442575021055 0ustar autarchautarch#!perl use strict; use warnings; # This test was generated by Dist::Zilla::Plugin::Test::ReportPrereqs 0.029 use Test::More tests => 1; use ExtUtils::MakeMaker; use File::Spec; # from $version::LAX my $lax_version_re = qr/(?: undef | (?: (?:[0-9]+) (?: \. | (?:\.[0-9]+) (?:_[0-9]+)? )? | (?:\.[0-9]+) (?:_[0-9]+)? ) | (?: v (?:[0-9]+) (?: (?:\.[0-9]+)+ (?:_[0-9]+)? )? | (?:[0-9]+)? (?:\.[0-9]+){2,} (?:_[0-9]+)? ) )/x; # hide optional CPAN::Meta modules from prereq scanner # and check if they are available my $cpan_meta = "CPAN::Meta"; my $cpan_meta_pre = "CPAN::Meta::Prereqs"; my $HAS_CPAN_META = eval "require $cpan_meta; $cpan_meta->VERSION('2.120900')" && eval "require $cpan_meta_pre"; ## no critic # Verify requirements? my $DO_VERIFY_PREREQS = 1; sub _max { my $max = shift; $max = ( $_ > $max ) ? $_ : $max for @_; return $max; } sub _merge_prereqs { my ($collector, $prereqs) = @_; # CPAN::Meta::Prereqs object if (ref $collector eq $cpan_meta_pre) { return $collector->with_merged_prereqs( CPAN::Meta::Prereqs->new( $prereqs ) ); } # Raw hashrefs for my $phase ( keys %$prereqs ) { for my $type ( keys %{ $prereqs->{$phase} } ) { for my $module ( keys %{ $prereqs->{$phase}{$type} } ) { $collector->{$phase}{$type}{$module} = $prereqs->{$phase}{$type}{$module}; } } } return $collector; } my @include = qw( ); my @exclude = qw( ); # Add static prereqs to the included modules list my $static_prereqs = do './t/00-report-prereqs.dd'; # Merge all prereqs (either with ::Prereqs or a hashref) my $full_prereqs = _merge_prereqs( ( $HAS_CPAN_META ? $cpan_meta_pre->new : {} ), $static_prereqs ); # Add dynamic prereqs to the included modules list (if we can) my ($source) = grep { -f } 'MYMETA.json', 'MYMETA.yml'; my $cpan_meta_error; if ( $source && $HAS_CPAN_META && (my $meta = eval { CPAN::Meta->load_file($source) } ) ) { $full_prereqs = _merge_prereqs($full_prereqs, $meta->prereqs); } else { $cpan_meta_error = $@; # capture error from CPAN::Meta->load_file($source) $source = 'static metadata'; } my @full_reports; my @dep_errors; my $req_hash = $HAS_CPAN_META ? $full_prereqs->as_string_hash : $full_prereqs; # Add static includes into a fake section for my $mod (@include) { $req_hash->{other}{modules}{$mod} = 0; } for my $phase ( qw(configure build test runtime develop other) ) { next unless $req_hash->{$phase}; next if ($phase eq 'develop' and not $ENV{AUTHOR_TESTING}); for my $type ( qw(requires recommends suggests conflicts modules) ) { next unless $req_hash->{$phase}{$type}; my $title = ucfirst($phase).' '.ucfirst($type); my @reports = [qw/Module Want Have/]; for my $mod ( sort keys %{ $req_hash->{$phase}{$type} } ) { next if grep { $_ eq $mod } @exclude; my $want = $req_hash->{$phase}{$type}{$mod}; $want = "undef" unless defined $want; $want = "any" if !$want && $want == 0; if ($mod eq 'perl') { push @reports, ['perl', $want, $]]; next; } my $req_string = $want eq 'any' ? 'any version required' : "version '$want' required"; my $file = $mod; $file =~ s{::}{/}g; $file .= ".pm"; my ($prefix) = grep { -e File::Spec->catfile($_, $file) } @INC; if ($prefix) { my $have = MM->parse_version( File::Spec->catfile($prefix, $file) ); $have = "undef" unless defined $have; push @reports, [$mod, $want, $have]; if ( $DO_VERIFY_PREREQS && $HAS_CPAN_META && $type eq 'requires' ) { if ( $have !~ /\A$lax_version_re\z/ ) { push @dep_errors, "$mod version '$have' cannot be parsed ($req_string)"; } elsif ( ! $full_prereqs->requirements_for( $phase, $type )->accepts_module( $mod => $have ) ) { push @dep_errors, "$mod version '$have' is not in required range '$want'"; } } } else { push @reports, [$mod, $want, "missing"]; if ( $DO_VERIFY_PREREQS && $type eq 'requires' ) { push @dep_errors, "$mod is not installed ($req_string)"; } } } if ( @reports ) { push @full_reports, "=== $title ===\n\n"; my $ml = _max( map { length $_->[0] } @reports ); my $wl = _max( map { length $_->[1] } @reports ); my $hl = _max( map { length $_->[2] } @reports ); if ($type eq 'modules') { splice @reports, 1, 0, ["-" x $ml, "", "-" x $hl]; push @full_reports, map { sprintf(" %*s %*s\n", -$ml, $_->[0], $hl, $_->[2]) } @reports; } else { splice @reports, 1, 0, ["-" x $ml, "-" x $wl, "-" x $hl]; push @full_reports, map { sprintf(" %*s %*s %*s\n", -$ml, $_->[0], $wl, $_->[1], $hl, $_->[2]) } @reports; } push @full_reports, "\n"; } } } if ( @full_reports ) { diag "\nVersions for all modules listed in $source (including optional ones):\n\n", @full_reports; } if ( $cpan_meta_error || @dep_errors ) { diag "\n*** WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING ***\n"; } if ( $cpan_meta_error ) { my ($orig_source) = grep { -f } 'MYMETA.json', 'MYMETA.yml'; diag "\nCPAN::Meta->load_file('$orig_source') failed with: $cpan_meta_error\n"; } if ( @dep_errors ) { diag join("\n", "\nThe following REQUIRED prerequisites were not satisfied:\n", @dep_errors, "\n" ); } pass('Reported prereqs'); # vim: ts=4 sts=4 sw=4 et: DateTime-Format-ISO8601-0.17/t/datetime.t0000644000175000017500000001337114756442575017446 0ustar autarchautarchuse strict; use warnings; use Test2::V0; use DateTime::Format::ISO8601; my $base_year = 2000; my $base_month = '01'; my $base_dt = DateTime->new( year => $base_year, month => $base_month ); my $default_expect_datetime = '1985-04-12T10:15:30'; my @tests = ( [qw( YYYYMMDDThhmmss 19850412T101530 )], [qw( YYYY-MM-DDThh:mm:ss 1985-04-12T10:15:30 )], [ qw( YYYYMMDDThhmmss.ss 19850412T101530.5 ), { nanosecond => 500_000_000 } ], [ qw( YYYY-MM-DDThh:mm:ss.ss 1985-04-12T10:15:30.5 ), { nanosecond => 500_000_000 } ], [ qw ( YYYYMMDDThhmmssZ 19850412T101530Z ), { time_zone => 'UTC' } ], [ qw( YYYY-MM-DDThh:mm:ssZ 1985-04-12T10:15:30Z ), { time_zone => 'UTC' } ], [ qw( YYYYMMDDThhmmss.ssZ 19850412T101530.5Z ), { nanosecond => 500_000_000, time_zone => 'UTC', } ], [ qw( YYYY-MM-DDThh:mm:ss.ssZ 1985-04-12T10:15:30.5Z ), { nanosecond => 500_000_000, time_zone => 'UTC', } ], [ qw( YYYYMMDDThhmmss+hhmm 19850412T101530+0400 ), { time_zone => '+0400' } ], [ qw( YYYY-MM-DDThh:mm+hh:mm 1985-04-12T10:15+04:00 1985-04-12T10:15:00 ), { time_zone => '+0400' } ], [ qw( YYYY-MM-DDThh:mm+hh:mm 1985-04-12T10:15-04:00 1985-04-12T10:15:00 ), { time_zone => '-0400' } ], [ qw( YYYYMMDDThhmm+hhmm 19850412T1015+0400 1985-04-12T10:15:00 ), { time_zone => '+0400' } ], [ qw( YYYYMMDDThhmm+hhmm 19850412T1015-0400 1985-04-12T10:15:00 ), { time_zone => '-0400' } ], [ qw( YYYY-MM-DDThh:mm:ss+hh:mm 1985-04-12T10:15:30+04:00 ), { time_zone => '+0400' } ], [ qw( YYYY-MM-DDThh:mm:ss.ss+hh 1985-04-12T10:15:30.5+04 ), { nanosecond => 500_000_000, time_zone => '+0400', } ], [ qw( YYYYMMDDThhmmss.ss+hh 19850412T101530.5+04 ), { nanosecond => 500_000_000, time_zone => '+0400', } ], [ qw( YYYYMMDDThhmmss.ss+hhmm 19850412T101530.5+0400 ), { nanosecond => 500_000_000, time_zone => '+0400', } ], [ qw( YYYY-MM-DDThh:mm:ss.ss+hh:mm 1985-04-12T10:15:30.5+04:00 ), { nanosecond => 500_000_000, time_zone => '+0400', } ], [ qw( YYYYMMDDThhmmss+hh 19850412T101530+04 ), { time_zone => '+0400' } ], [ qw( YYYY-MM-DDThh:mm:ss+hh 1985-04-12T10:15:30+04 ), { time_zone => '+0400' } ], [qw( YYYYMMDDThhmm 19850412T1015 1985-04-12T10:15:00 )], [qw( YYYY-MM-DDThh:mm 1985-04-12T10:15 1985-04-12T10:15:00 )], [qw( YYYYMMDDThhmmZ 19850412T1015Z 1985-04-12T10:15:00 )], [qw( YYYY-MM-DDThh:mmZ 1985-04-12T10:15Z 1985-04-12T10:15:00 )], [qw( YYYYDDDThhmm 1985102T1015Z 1985-04-12T10:15:00 )], [qw( YYYY-DDDThh:mm 1985-102T10:15Z 1985-04-12T10:15:00 )], [ qw( YYYYDDDThhmmZ 1985102T1015Z 1985-04-12T10:15:00 ), { time_zone => 'UTC' } ], [ qw( YYYY-DDDThh:mmZ 1985-102T10:15Z 1985-04-12T10:15:00 ), { time_zone => 'UTC' } ], [ qw( YYYYWwwDThhmm+hhmm 1985W155T1015+0400 1985-04-12T10:15:00 ), { time_zone => '+0400' } ], [ qw( YYYY-Www-DThh:mm+hh 1985-W15-5T10:15+04 1985-04-12T10:15:00 ), { time_zone => '+0400' } ], [ # Expect for DT GH #145 HGuillemet = DTFI GH #22 qw( YYYYMMDDThhmmss.ssZ 2025-02-17T11:14:00.065341560Z ), '2025-02-17T11:14:00', { nanosecond => 65_341_560, time_zone => 'UTC', }, ], ); subtest( 'datetime formats with base_datetime' => sub { my $iso8601 = DateTime::Format::ISO8601->new( base_datetime => $base_dt ); for my $t (@tests) { my @copy = @{$t}; my $format = shift @copy; subtest( $format => sub { _test_time( $iso8601, @copy ); } ); } } ); subtest( 'datetime formats without base_datetime' => sub { my $epoch = DateTime->new( year => 2000, month => 1, time_zone => 'UTC' ) ->epoch; ## no critic (Variables::ProtectPrivateVars) no warnings 'redefine'; local *DateTime::_core_time = sub {$epoch}; my $iso8601 = DateTime::Format::ISO8601->new; for my $parser ( $iso8601, 'DateTime::Format::ISO8601' ) { my $st = 'parse with ' . ( ref $parser ? 'object' : 'class' ); subtest( $st, sub { for my $t (@tests) { my @copy = @{$t}; my $format = shift @copy; subtest( $format => sub { _test_time( $iso8601, @copy ); } ); } } ); } } ); sub _test_time { my $parser = shift; my $to_parse = shift; my @rest = @_; my $expect = $default_expect_datetime; if ( @rest && !ref $rest[0] ) { $expect = shift @rest; } my $extra = shift @rest; my $dt = $parser->parse_datetime($to_parse); is( $dt->datetime, $expect, "$to_parse = $expect", ); return unless $extra; if ( $extra->{nanosecond} ) { is( $dt->nanosecond, $extra->{nanosecond}, "nanosecond = $extra->{nanosecond}", ); } if ( $extra->{time_zone} ) { is( $dt->time_zone->name, $extra->{time_zone}, "tz = $extra->{time_zone}" ); } } done_testing(); DateTime-Format-ISO8601-0.17/t/bad-formats.t0000644000175000017500000000240114756442575020041 0ustar autarchautarch# Copyright (C) 2003-2012 Joshua Hoblitt use strict; use warnings; use Test2::V0; use DateTime::Format::ISO8601; # parse_datetime my $base_year = 2000; my $base_month = '01'; my $iso8601 = DateTime::Format::ISO8601->new( base_datetime => DateTime->new( year => $base_year, month => $base_month ), ); # examples from https://rt.cpan.org/Ticket/Update.html?id=5264 # Section 4.2.5.1 says "Expressions of the difference between local time and # UTC of day are a component in the representations defined in 4.2.5.2; they # shall not be used as self-standing expressions.". Which means the UTC offset # is considered part of the time format so you get to use the extended # formation (the ':') or not but you can't mix and match the two. like( dies { my $dt = $iso8601->parse_datetime('2009-12-10T09:00:00.00+0100'); }, qr/Invalid date format/, 'extended format with TZ', ); # more "colon or not" coverage like( dies { my $dt = $iso8601->parse_datetime('20091210T090000.00+01:00'); }, qr/Invalid date format/, 'extended format with TZ', ); like( dies { my $dt = $iso8601->parse_datetime('20110704T205023+02:00'); }, qr/Invalid date format/, 'extended format with TZ', ); done_testing(); DateTime-Format-ISO8601-0.17/t/format-datetime.t0000644000175000017500000000341214756442575020727 0ustar autarchautarchuse strict; use warnings; use Test2::V0; use DateTime; use DateTime::Format::ISO8601; my $dt = DateTime->new( year => 2016, month => 2, day => 2, hour => 5, minute => 6, second => 7, time_zone => 'UTC', formatter => 'DateTime::Format::ISO8601', ); is( "$dt", '2016-02-02T05:06:07Z', 'default format in UTC' ); $dt = DateTime->new( year => 2016, month => 2, day => 2, hour => 5, minute => 6, second => 7, time_zone => 'America/Chicago', formatter => 'DateTime::Format::ISO8601', ); is( "$dt", '2016-02-02T05:06:07-06:00', 'default format in America/Chicago DST', ); $dt = DateTime->new( year => 2016, month => 2, day => 2, hour => 5, minute => 6, second => 7, nanosecond => 123, time_zone => 'America/Chicago', formatter => 'DateTime::Format::ISO8601', ); is( "$dt", '2016-02-02T05:06:07.000000123-06:00', 'default format with nanoseconds in America/Chicago DST', ); $dt = DateTime->new( year => 2016, month => 2, day => 2, hour => 5, minute => 6, second => 7, nanosecond => 123000000, time_zone => 'America/Chicago', formatter => 'DateTime::Format::ISO8601', ); is( "$dt", '2016-02-02T05:06:07.123-06:00', 'default format with milliseconds in America/Chicago DST', ); $dt = DateTime->new( year => 2016, month => 2, day => 2, hour => 5, minute => 6, second => 7, time_zone => 'UTC', ); is( +DateTime::Format::ISO8601->format_datetime($dt), '2016-02-02T05:06:07Z', 'default format in UTC, called as class method', ); done_testing(); DateTime-Format-ISO8601-0.17/t/time.t0000644000175000017500000001365414756442575016614 0ustar autarchautarchuse strict; use warnings; use Test2::V0; use DateTime::Format::ISO8601; my $base_year = 2000; my $base_month = '01'; my $base_dt = DateTime->new( year => $base_year, month => $base_month ); my $default_expect_time = '23:20:50'; my %tests = ( # These formats are unambiguous and are parsed as times by parse_datetime parse_datetime => [ [qw( hh:mm:ss 23:20:50 )], [qw( hh:mm 23:20 23:20:00 )], [ 'hhmmss,ss', '232050,5', { nanosecond => 500_000_000 } ], [ 'hh:mm:ss,ss', '23:20:50,5', { nanosecond => 500_000_000 } ], [ 'hhmm,mm', '2320,8', '23:20:48' ], [ 'hh:mm,mm', '23:20,8', '23:20:48' ], [ 'hh,hh', '23,3', '23:18:00' ], [qw( -mm:ss -20:50 00:20:50 )], [ '-mmss,s', '-2050,5', '00:20:50', { nanosecond => 500_000_000 } ], [ '-mm:ss,s', '-20:50,5', '00:20:50', { nanosecond => 500_000_000 } ], [ '-mm,m', '-20,8', '00:20:48' ], [ '--ss,s', '--50,5', '00:00:50', { nanosecond => 500_000_000 } ], [ qw( hhmmssZ 232050Z ), { time_zone => 'UTC' } ], [ qw( hhmmss.ssZ 232050.5Z ), { nanosecond => 500_000_000, time_zone => 'UTC', } ], [qw( hh:mm:ssZ 23:20:50Z )], [ qw( hhmmssZ 23:20:50.5Z ), { nanosecond => 500_000_000, time_zone => 'UTC', } ], [ qw( hhmmZ 2320Z 23:20:00 ), { time_zone => 'UTC' } ], [ qw( hh:mmZ 23:20Z 23:20:00 ), { time_zone => 'UTC' } ], [ qw( hhZ 23Z 23:00:00 ), { time_zone => 'UTC' } ], [ qw( hhmmss[+/-]hhmm 152746+0100 15:27:46 ), { time_zone => '+0100' } ], [ qw( hhmmss[+/-]hhmm 152746-0500 15:27:46 ), { time_zone => '-0500' } ], [ qw( hh:mm:ss[+/-]hhmm 15:27:46+01:00 15:27:46 ), { time_zone => '+0100' } ], [ qw( hh:mm:ss[+/-]hhmm 15:27:46-05:00 15:27:46 ), { time_zone => '-0500' } ], [ qw( hhmmss[+/-]hh 152746+01 15:27:46 ), { time_zone => '+0100' } ], [ qw( hhmmss[+/-]hh 152746-05 15:27:46 ), { time_zone => '-0500' } ], [ qw( hh:mm:ss[+/-]hh 15:27:46+01 15:27:46 ), { time_zone => '+0100' } ], [ qw( hh:mm:ss[+/-]hh 15:27:46-05 15:27:46 ), { time_zone => '-0500' } ], [ qw( hhmmss.ss[+/-]hhmm 152746.5+0100 15:27:46 ), { nano_second => 500_000_000, time_zone => '+0100', } ], [ qw( hhmmss.ss[+/-]hhmm 152746.5-0500 15:27:46 ), { nano_second => 500_000_000, time_zone => '-0500', } ], [ qw( hh:mm:ss.ss[+/-]hh:mm 15:27:46.5+01:00 15:27:46 ), { nano_second => 500_000_000, time_zone => '+0100', } ], [ qw( hh:mm:ss.ss[+/-]hh:mm 15:27:46.5-05:00 15:27:46 ), { nano_second => 500_000_000, time_zone => '-0500', } ], ], # These formats are ambiguous and would be parsed as dates by parse_datetime. parse_time => [ [qw( hhmmss 232050 )], [qw( hhmm 2320 23:20:00 )], [qw( hh 23 23:00:00 )], [qw( -mmss -2050 00:20:50 )], [qw( -mm -20 00:20:00 )], [qw( --ss --50 00:00:50 )], ], ); subtest( 'time formats with base_datetime' => sub { my $iso8601 = DateTime::Format::ISO8601->new( base_datetime => $base_dt ); for my $method ( sort keys %tests ) { for my $t ( @{ $tests{$method} } ) { my @copy = @{$t}; my $format = shift @copy; subtest( $format => sub { _test_time( $iso8601, $method, @copy ); } ); } } } ); subtest( 'time formats without base_datetime' => sub { my $epoch = DateTime->new( year => 2000, month => 1, time_zone => 'UTC' ) ->epoch; no warnings 'redefine'; ## no critic (Variables::ProtectPrivateVars) local *DateTime::_core_time = sub {$epoch}; my $iso8601 = DateTime::Format::ISO8601->new; for my $parser ( $iso8601, 'DateTime::Format::ISO8601' ) { my $st = 'parse with ' . ( ref $parser ? 'object' : 'class' ); subtest( $st, sub { for my $method ( sort keys %tests ) { for my $t ( @{ $tests{$method} } ) { my @copy = @{$t}; my $format = shift @copy; subtest( $format => sub { _test_time( $iso8601, $method, @copy ); } ); } } } ); } } ); sub _test_time { my $parser = shift; my $method = shift; my $to_parse = shift; my @rest = @_; my $expect = $default_expect_time; if ( @rest && !ref $rest[0] ) { $expect = shift @rest; } my $extra = shift @rest; my $dt = $parser->$method($to_parse); is( $dt->hms, $expect, "$to_parse = $expect", ); return unless $extra; if ( $extra->{nanosecond} ) { is( $dt->nanosecond, $extra->{nanosecond}, "nanosecond = $extra->{nanosecond}", ); } if ( $extra->{time_zone} ) { is( $dt->time_zone->name, $extra->{time_zone}, "tz = $extra->{time_zone}" ); } } done_testing(); DateTime-Format-ISO8601-0.17/MANIFEST0000644000175000017500000000156614756442575016356 0ustar autarchautarch# This file was automatically generated by Dist::Zilla::Plugin::Manifest v6.032. CODE_OF_CONDUCT.md CONTRIBUTING.md Changes INSTALL LICENSE MANIFEST META.json META.yml Makefile.PL README.md Todo azure-pipelines.yml cpanfile dev-bin/install-xt-tools.sh dist.ini git/hooks/pre-commit.sh git/setup.pl lib/DateTime/Format/ISO8601.pm lib/DateTime/Format/ISO8601/Types.pm perlcriticrc perltidyrc precious.toml t/00-report-prereqs.dd t/00-report-prereqs.t t/bad-formats.t t/base-datetime.t t/cut-off-year.t t/date.t t/datetime.t t/format-datetime.t t/legacy-year.t t/time.t xt/author/00-compile.t xt/author/eol.t xt/author/mojibake.t xt/author/no-tabs.t xt/author/pod-coverage.t xt/author/pod-spell.t xt/author/pod-syntax.t xt/author/portability.t xt/author/precious.t xt/author/synopsis.t xt/author/test-all-my-deps.t xt/author/test-version.t xt/release/cpan-changes.t xt/release/meta-json.t DateTime-Format-ISO8601-0.17/INSTALL0000644000175000017500000000467414756442575016261 0ustar autarchautarchThis is the Perl distribution DateTime-Format-ISO8601. Installing DateTime-Format-ISO8601 is straightforward. ## Installation with cpanm If you have cpanm, you only need one line: % cpanm DateTime::Format::ISO8601 If it does not have permission to install modules to the current perl, cpanm will automatically set up and install to a local::lib in your home directory. See the local::lib documentation (https://metacpan.org/pod/local::lib) for details on enabling it in your environment. ## Installing with the CPAN shell Alternatively, if your CPAN shell is set up, you should just be able to do: % cpan DateTime::Format::ISO8601 ## Manual installation As a last resort, you can manually install it. If you have not already downloaded the release tarball, you can find the download link on the module's MetaCPAN page: https://metacpan.org/pod/DateTime::Format::ISO8601 Untar the tarball, install configure prerequisites (see below), then build it: % perl Makefile.PL % make && make test Then install it: % make install On Windows platforms, you should use `dmake` or `nmake`, instead of `make`. If your perl is system-managed, you can create a local::lib in your home directory to install modules to. For details, see the local::lib documentation: https://metacpan.org/pod/local::lib The prerequisites of this distribution will also have to be installed manually. The prerequisites are listed in one of the files: `MYMETA.yml` or `MYMETA.json` generated by running the manual build process described above. ## Configure Prerequisites This distribution requires other modules to be installed before this distribution's installer can be run. They can be found under the "configure_requires" key of META.yml or the "{prereqs}{configure}{requires}" key of META.json. ## Other Prerequisites This distribution may require additional modules to be installed after running Makefile.PL. Look for prerequisites in the following phases: * to run make, PHASE = build * to use the module code itself, PHASE = runtime * to run tests, PHASE = test They can all be found in the "PHASE_requires" key of MYMETA.yml or the "{prereqs}{PHASE}{requires}" key of MYMETA.json. ## Documentation DateTime-Format-ISO8601 documentation is available as POD. You can run `perldoc` from a shell to read the documentation: % perldoc DateTime::Format::ISO8601 For more information on installing Perl modules via CPAN, please see: https://www.cpan.org/modules/INSTALL.html DateTime-Format-ISO8601-0.17/dist.ini0000644000175000017500000000211314756442575016656 0ustar autarchautarchname = DateTime-Format-ISO8601 author = Joshua Hoblitt author = Dave Rolsky license = Perl_5 copyright_holder = Joshua Hoblitt ; authordep Dist::Zilla::PluginBundle::DROLSKY = 1.22 [@DROLSKY] dist = DateTime-HiRes use_github_issues = 1 -remove = Test::CleanNamespaces stopwords = AALLAN stopwords = Alasdair stopwords = DDD stopwords = hh stopwords = hhmm stopwords = hhmmss stopwords = hhmmssZ stopwords = hhmmZ stopwords = hhZ stopwords = Iain stopwords = JOHNL stopwords = Katana stopwords = Leffler stopwords = McCauley stopwords = MMDD stopwords = mmss stopwords = PDX stopwords = ss stopwords = ssZ stopwords = Truskett stopwords = Www stopwords = WwwD stopwords = YWww stopwords = YWwwD stopwords = YY stopwords = YYDDD stopwords = YYMM stopwords = YYMMDD stopwords = YYWww stopwords = YYWwwD stopwords = YYYY stopwords = YYYYDDD stopwords = YYYYDDDThhmm stopwords = YYYYDDDThhmmZ stopwords = YYYYMMDD stopwords = YYYYMMDDThhmm stopwords = YYYYMMDDThhmmss stopwords = YYYYMMDDThhmmssZ stopwords = YYYYMMDDThhmmZ stopwords = YYYYWww stopwords = YYYYWwwD DateTime-Format-ISO8601-0.17/precious.toml0000644000175000017500000000243214756442575017744 0ustar autarchautarchexclude = [ ".build/**/*", "DateTime-Format-ISO8601-*/**/*", "blib/**/*", "t/00-*", "t/author-*", "t/release-*", "t/zzz-*", "xt/**/*", ] [commands.omegasort-gitignore] type = "both" include = "**/.gitignore" cmd = [ "omegasort", "--sort=path" ] lint_flags = "--check" tidy_flags = "--in-place" ok_exit_codes = 0 lint_failure_exit_codes = 1 expect_stderr = true [commands.perlcritic] type = "lint" include = [ "**/*.{pl,pm,t,psgi}" ] cmd = [ "perlcritic", "--profile=$PRECIOUS_ROOT/perlcriticrc" ] ok_exit_codes = 0 lint_failure_exit_codes = 2 [commands.perltidy] type = "both" include = [ "**/*.{pl,pm,t,psgi}" ] cmd = [ "perltidy", "--profile=$PRECIOUS_ROOT/perltidyrc" ] lint_flags = [ "--assert-tidy", "--no-standard-output", "--outfile=/dev/null" ] tidy_flags = [ "--backup-and-modify-in-place", "--backup-file-extension=/" ] ok_exit_codes = 0 lint_failure_exit_codes = 2 expect_stderr = true [commands.podchecker] type = "lint" include = [ "**/*.{pl,pm,pod}" ] cmd = [ "podchecker", "--warnings", "--warnings" ] ok_exit_codes = [ 0, 2 ] lint_failure_exit_codes = 1 expect_stderr = true [commands.podtidy] type = "tidy" include = [ "**/*.{pl,pm,pod}" ] cmd = [ "podtidy", "--columns", "80", "--inplace", "--nobackup" ] ok_exit_codes = 0 lint_failure_exit_codes = 1 DateTime-Format-ISO8601-0.17/azure-pipelines.yml0000644000175000017500000000123414756442575021054 0ustar autarchautarchresources: repositories: - repository: ci-perl-helpers type: github name: houseabsolute/ci-perl-helpers endpoint: houseabsolute stages: - template: templates/helpers/build.yml@ci-perl-helpers parameters: debug: true - template: templates/helpers/linux.yml@ci-perl-helpers parameters: coverage: codecov debug: true test_xt: true use_default_perls: true - template: templates/helpers/macos.yml@ci-perl-helpers parameters: debug: true use_default_perls: true - template: templates/helpers/windows.yml@ci-perl-helpers parameters: debug: true use_default_perls: true DateTime-Format-ISO8601-0.17/dev-bin/0000775000175000017500000000000014756442575016543 5ustar autarchautarchDateTime-Format-ISO8601-0.17/dev-bin/install-xt-tools.sh0000755000175000017500000000075614756442575022345 0ustar autarchautarch#!/bin/sh set -e TARGET="$HOME/bin" if [ $(id -u) -eq 0 ]; then TARGET="/usr/local/bin" fi echo "Installing dev tools to $TARGET" mkdir -p $TARGET curl --silent --location \ https://raw.githubusercontent.com/houseabsolute/ubi/master/bootstrap/bootstrap-ubi.sh | sh "$TARGET/ubi" --project houseabsolute/precious --in "$TARGET" "$TARGET/ubi" --project houseabsolute/omegasort --in "$TARGET" echo "Add $TARGET to your PATH in order to use precious for linting and tidying"