DateTime-Calendar-Julian-0.107/000755 000765 000024 00000000000 14175516661 016122 5ustar00tomstaff000000 000000 DateTime-Calendar-Julian-0.107/LICENSE000644 000765 000024 00000050101 14172543246 017120 0ustar00tomstaff000000 000000 Terms of Perl 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 General Public License (GPL) Version 2, June 1991 Copyright (C) 1989, 1991 Free Software Foundation, Inc. 675 Mass Ave, Cambridge, MA 02139, USA. Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU 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. This General Public License applies to most of the Free Software Foundation's software and to any other program whose authors commit to using it. (Some other Free Software Foundation software is covered by the GNU Library General Public License instead.) You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish), 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 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 show them these terms so they know 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. Finally, any free program is threatened constantly by software patents. We wish to avoid the danger that redistributors of a free program will individually obtain patent licenses, in effect making the program proprietary. To prevent this, we have made it clear that any patent must be licensed for everyone's free use or not licensed at all. 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 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 derivative work under copyright law: that is to say, a work containing the Program or a portion of it, either verbatim or with modifications and/or translated into another language. (Hereinafter, translation is included without limitation in the term "modification".) Each licensee is addressed as "you". Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running the Program is not restricted, and the output from the Program is covered only if its contents constitute a work based on the Program (independent of having been made by running the Program). Whether that is true depends on what the Program does. 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 License and to the absence of any warranty; and give any other recipients of the Program a copy of this License along with the Program. 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. 2. You may modify your copy or copies of the Program or any portion of it, thus forming a work based on the Program, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: a) You must cause the modified files to carry prominent notices stating that you changed the files and the date of any change. b) You must cause any work that you distribute or publish, that in whole or in part contains or is derived from the Program or any part thereof, to be licensed as a whole at no charge to all third parties under the terms of this License. c) If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the most ordinary 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 License. (Exception: if the Program itself is interactive but does not normally print such an announcement, your work based on the Program is not required to print an announcement.) These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Program, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Program, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Program. In addition, mere aggregation of another work not based on the Program with the Program (or with a work based on the Program) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. 3. You may copy and distribute the Program (or a work based on it, under Section 2) in object code or executable form under the terms of Sections 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 Sections 1 and 2 above on a medium customarily used for software interchange; or, b) Accompany it with a written offer, valid for at least three years, to give any third party, for a charge no more than your cost of physically performing source distribution, a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, c) Accompany it with the information you received as to the offer to distribute corresponding source code. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form with such an offer, in accord with Subsection b above.) The source code for a work means the preferred form of the work for making modifications to it. For an executable work, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the executable. However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. If distribution of executable or object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place counts as distribution of the source code, even though third parties are not compelled to copy the source along with the object code. 4. You may not copy, modify, sublicense, or distribute the Program except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense or distribute the Program is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. 5. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Program or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing 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 for copying, distributing or modifying the Program or works based on it. 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. You are not responsible for enforcing compliance by third parties to this License. 7. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Program at all. For example, if a patent license would not permit royalty-free redistribution of the Program by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Program. If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply and the section as a whole is intended to apply in other circumstances. It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system, which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. 8. If the distribution and/or use of the Program is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Program under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. 9. 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 this 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 this License, you may choose any version ever published by the Free Software Foundation. 10. 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 11. 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. 12. 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 --------------------------------------------------------------------------- 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. - "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 ftp.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) accompany any non-standard executables with their corresponding Standard Version executables, giving the non-standard executables non-standard names, and clearly documenting 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. 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 whomever generated them, and may be sold commercially, and may be aggregated with this Package. 7. C or perl subroutines supplied by you and linked into this Package shall not be considered part of this Package. 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 MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. The End DateTime-Calendar-Julian-0.107/Changes000644 000765 000024 00000006120 14175516636 017416 0ustar00tomstaff000000 000000 0.107 2022-01-30 T. R. Wyant Add method calendar_name(), which returns 'Julian'. Require DateTime 1.48 for is_last_day_of_quarter(). This is a significant bump, since the previous was 0.08. Update Perl requirement in metadata to 5.008004. It was always this in fact, since DateTime requires this, as does Makefile.PL. Add support for quarters. 0.106 2021-09-25 T. R. Wyant Correct repository links in metadata. Thanks to Keith Thompson for finding and reporting this. 0.105 2021-09-05 T. R. Wyant Correct generation of 'provides' metadata. Thanks to Favio Poletti for blogging https://github.polettix.it/ETOOBUSY/2021/06/15/the-real-pause-workaround/, and ultimately to Joel Berger for the pointer to https://metacpan.org/pod/CPAN::Meta::Spec#no_index 0.104 2021-03-15 T. R. Wyant Add rt.cpan.org back to bug reporting methods. Long live RT! Correct GitHub ticket link. Get prerequisites up to snuff and add xt/author/prereq.t to ensure they stay that way. 0.103 2021-01-10 T. R. Wyant Add Travis CI testing. Use GitHub as bug tracker. R.I.P. rt.cpan.org. 0.102 2019-11-09 T. R. Wyant - Add optional separator arg to datetime(). This tracks the same change in DateTime version 1.43 dated 2017-05-29. Thanks to Jean Forget for finding, isolating, and reporting this. - NOTE that the above change restores the 'T' separator in stringification, as it was before DateTime 1.43. - Add tests for datetime() method. - Eliminate redirections in POD URL links 0.101 2019-08-14 T. R. Wyant - Fix broken POD links, and add test to ensure they stay fixed. 0.100 2018-12-21 T. R. Wyant - Update author and copyright information. - Add author tests - Update metadata 0.04 2003-03-13 Eugene van der Pijll - changed output of datetime() to 2000-01-01J00:00:00, to be different from Gregorian dates. - removed bug in day_of_year calculation - removed "use Params::Validate", which was superfluous after v0.03 0.03 2003-03-08 Eugene van der Pijll - removed a bug: adding years now works correctly - added gregorian_deviation() function - changed module source to the development standards of the DateTime project - changed required version of DateTime to 0.08, and removed some workarounds that were necessary for version 0.07 (last_day_of_month, _greg2rd, _rd2greg) 0.02 2003-02-16 Eugene van der Pijll - replaced POSIX::floor with a homegrown version - renamed _greg2rd and _rd2greg to _ymd2rd and _rd2ymd, in anticipation of a possible change in DateTime. The old names will still be available for a while for backward compatibility. - corrected the POD documentation on from_object (reported by Dave Rolsky) - removed some bugs in the test script (patch by Tatsuhiko Miyagawa) - perhaps most importantly, changed comment in t/1.t: -4712/1/1 is not JD 1, but JD 0 0.01 2003-02-14 Eugene van der Pijll - original version; the methods that are inherited from DateTime are not well tested yet DateTime-Calendar-Julian-0.107/MANIFEST000644 000765 000024 00000000632 14172125471 017244 0ustar00tomstaff000000 000000 Changes lib/DateTime/Calendar/Julian.pm LICENSE Makefile.PL MANIFEST META.json META.yml README t/1.t t/4doy.t t/5week.t t/6quarter.t xt/author/basic.t xt/author/changes.t xt/author/critic.t xt/author/executable.t xt/author/kwalitee.t xt/author/manifest.t xt/author/minimum_perl.t xt/author/perlcriticrc xt/author/pod.t xt/author/pod_coverage.t xt/author/pod_links.t xt/author/pod_spelling.t xt/author/prereq.t DateTime-Calendar-Julian-0.107/t/000755 000765 000024 00000000000 14175516660 016364 5ustar00tomstaff000000 000000 DateTime-Calendar-Julian-0.107/xt/000755 000765 000024 00000000000 14175516660 016554 5ustar00tomstaff000000 000000 DateTime-Calendar-Julian-0.107/README000644 000765 000024 00000000537 14172543246 017003 0ustar00tomstaff000000 000000 DateTime/Calendar/Julian ======================== This is a companion module to DateTime.pm. It implements the Julian calendar. It supports everything that DateTime.pm supports and more: about one day per century more, to be precise. INSTALLATION To install this module type the following: perl Makefile.PL make make test make install DateTime-Calendar-Julian-0.107/META.yml000644 000765 000024 00000001770 14175516660 017377 0ustar00tomstaff000000 000000 --- abstract: 'DateTime object in the Julian calendar' author: - 'Eugene van der Pijll ' - 'Thomas R. Wyant, III ' build_requires: Test::More: '0.88' configure_requires: ExtUtils::MakeMaker: '0' dynamic_config: 1 generated_by: 'ExtUtils::MakeMaker version 7.64, 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-Calendar-Julian no_index: directory: - inc - t - xt provides: DateTime::Calendar::Julian: file: lib/DateTime/Calendar/Julian.pm version: '0.107' requires: DateTime: '1.48' perl: '5.008004' strict: '0' vars: '0' warnings: '0' resources: bugtracker: https://rt.cpan.org/Public/Dist/Display.html?Name=DateTime-Calendar-Julian license: http://dev.perl.org/licenses/ repository: git://github.com/trwyant/perl-DateTime-Calendar-Julian.git version: '0.107' x_serialization_backend: 'CPAN::Meta::YAML version 0.018' DateTime-Calendar-Julian-0.107/lib/000755 000765 000024 00000000000 14175516660 016667 5ustar00tomstaff000000 000000 DateTime-Calendar-Julian-0.107/Makefile.PL000644 000765 000024 00000007537 14172543270 020101 0ustar00tomstaff000000 000000 use 5.008004; use strict; use warnings; use ExtUtils::MakeMaker; ( my $mmv = ExtUtils::MakeMaker->VERSION ) =~ s/_//g; my %args = ( NAME => 'DateTime::Calendar::Julian', VERSION_FROM => 'lib/DateTime/Calendar/Julian.pm', PREREQ_PM => { DateTime => 1.48, # For is_last_day_of_{quarter,year} strict => 0, vars => 0, warnings => 0, }, ABSTRACT => 'DateTime object in the Julian calendar', AUTHOR => [ 'Eugene van der Pijll ', 'Thomas R. Wyant, III ', ], PL_FILES => {}, # Prevent old MakeMaker from running Build.PL realclean => { FILES => 'cover_db', }, ); $mmv >= 6.31 and $args{LICENSE} = 'perl'; if ( $mmv >= 6.4501 ) { $args{META_ADD} = { no_index => no_index(), provides(), }; $args{META_MERGE} = { 'meta-spec' => { version => 2, }, resources => { bugtracker => { web => 'https://rt.cpan.org/Public/Dist/Display.html?Name=DateTime-Calendar-Julian', # web => 'https://github.com/trwyant/perl-DateTime-Calendar-Julian/issues', mailto => 'wyant@cpan.org', }, license => 'http://dev.perl.org/licenses/', repository => { type => 'git', url => 'git://github.com/trwyant/perl-DateTime-Calendar-Julian.git', web => 'https://github.com/trwyant/perl-DateTime-Calendar-Julian', }, }, provides(), }; } $mmv >= 6.4701 and $args{MIN_PERL_VERSION} = 5.008004; $mmv >= 6.5702 or $args{AUTHOR} = join ', ', @{ $args{AUTHOR} }; my $build_requires = { 'Test::More' => 0.88, }; my $configure_requires = { 'ExtUtils::MakeMaker' => 0, }; if ( $mmv >= 6.52 ) { $args{BUILD_REQUIRES} = $build_requires; $args{CONFIGURE_REQUIRES} = $configure_requires; } elsif ( $mmv >= 6.5501 ) { $args{BUILD_REQUIRES} = $build_requires; $args{META_MERGE}{configure_requires} = $configure_requires; } elsif ( $mmv >= 6.4501 ) { $args{META_MERGE}{build_requires} = $build_requires; $args{META_MERGE}{configure_requires} = $configure_requires; } else { foreach my $req ( $build_requires, $configure_requires ) { foreach my $key ( keys %{ $req } ) { exists $args{PREREQ_PM}{$key} or $args{PREREQ_PM}{$key} = $req->{$key}; } } } WriteMakefile( %args ); sub MY::postamble { my ( $self, @args ) = @_; my $authortest = $self->test_via_harness( '$(FULLPERLRUN)', '$(AUTHORTEST_FILES)' ); $authortest =~ s/ \s+ \z //smx; $authortest =~ s/ \A \s+ //smx; chomp $authortest; return <<"EOD"; AUTHORTEST_FILES = t/*.t xt/author/*.t authortest :: pure_all AUTHOR_TESTING=1 $authortest testcover :: pure_all cover -test -ignore_re=inc/ -ignore_re=eg/ EOD } sub no_index { return +{ directory => [ qw{ inc t xt } ], }; } sub provides { my $provides; local $@ = undef; eval { require CPAN::Meta; require ExtUtils::Manifest; require Module::Metadata; my $manifest; { local $SIG{__WARN__} = sub {}; $manifest = ExtUtils::Manifest::maniread(); } keys %{ $manifest || {} } or return; # Skeleton so we can use should_index_file() and # should_index_package(). my $meta = CPAN::Meta->new( { name => 'Euler', version => 2.71828, no_index => no_index(), }, ); # The Module::Metadata docs say not to use # package_versions_from_directory() directly, but the 'files =>' # version of provides() is broken, and has been known to be so # since 2014, so it's not getting fixed any time soon. So: foreach my $fn ( sort keys %{ $manifest } ) { $fn =~ m/ [.] pm \z /smx or next; my $pvd = Module::Metadata->package_versions_from_directory( undef, [ $fn ] ); foreach my $pkg ( keys %{ $pvd } ) { $meta->should_index_package( $pkg ) and $meta->should_index_file( $pvd->{$pkg}{file} ) and $provides->{$pkg} = $pvd->{$pkg}; } } 1; } or return; return ( provides => $provides ); } # ex: set textwidth=72 : DateTime-Calendar-Julian-0.107/META.json000644 000765 000024 00000003341 14175516661 017544 0ustar00tomstaff000000 000000 { "abstract" : "DateTime object in the Julian calendar", "author" : [ "Eugene van der Pijll ", "Thomas R. Wyant, III " ], "dynamic_config" : 1, "generated_by" : "ExtUtils::MakeMaker version 7.64, CPAN::Meta::Converter version 2.150010", "license" : [ "perl_5" ], "meta-spec" : { "url" : "http://search.cpan.org/perldoc?CPAN::Meta::Spec", "version" : 2 }, "name" : "DateTime-Calendar-Julian", "no_index" : { "directory" : [ "inc", "t", "xt" ] }, "prereqs" : { "build" : { "requires" : { "Test::More" : "0.88" } }, "configure" : { "requires" : { "ExtUtils::MakeMaker" : "0" } }, "runtime" : { "requires" : { "DateTime" : "1.48", "perl" : "5.008004", "strict" : "0", "vars" : "0", "warnings" : "0" } } }, "provides" : { "DateTime::Calendar::Julian" : { "file" : "lib/DateTime/Calendar/Julian.pm", "version" : "0.107" } }, "release_status" : "stable", "resources" : { "bugtracker" : { "mailto" : "wyant@cpan.org", "web" : "https://rt.cpan.org/Public/Dist/Display.html?Name=DateTime-Calendar-Julian" }, "license" : [ "http://dev.perl.org/licenses/" ], "repository" : { "type" : "git", "url" : "git://github.com/trwyant/perl-DateTime-Calendar-Julian.git", "web" : "https://github.com/trwyant/perl-DateTime-Calendar-Julian" } }, "version" : "0.107", "x_serialization_backend" : "JSON::PP version 4.07" } DateTime-Calendar-Julian-0.107/lib/DateTime/000755 000765 000024 00000000000 14175516660 020363 5ustar00tomstaff000000 000000 DateTime-Calendar-Julian-0.107/lib/DateTime/Calendar/000755 000765 000024 00000000000 14175516660 022074 5ustar00tomstaff000000 000000 DateTime-Calendar-Julian-0.107/lib/DateTime/Calendar/Julian.pm000644 000765 000024 00000015113 14175516636 023660 0ustar00tomstaff000000 000000 package DateTime::Calendar::Julian; use strict; use warnings; use vars qw($VERSION @ISA); $VERSION = '0.107'; use DateTime 0.08; @ISA = 'DateTime'; sub _floor { my $x = shift; my $ix = int $x; if ($ix <= $x) { return $ix; } else { return $ix - 1; } } my @start_of_month = (0, 31, 61, 92, 122, 153, 184, 214, 245, 275, 306, 337); # Julian dates are formatted in exactly the same way as Gregorian dates, # so we use most of the DateTime methods. # This is the difference between Julian and Gregorian calendar: sub _is_leap_year { my (undef, $year) = @_; # Invocant unused return ($year % 4 == 0); } # Algorithms from http://home.capecod.net/~pbaum/date/date0.htm sub _ymd2rd { ## no critic (ProhibitUnusedPrivateSubroutines) my (undef, $y, $m, $d) = @_; # Invocant unused my $adj = _floor( ($m-3)/12 ); $m -= 12 * $adj; $y += $adj; my $rd = $d + $start_of_month[$m-3] + 365*$y + _floor($y/4) - 308; return $rd; } { my @QuarterStart = my @LeapYearQuarterStart = ( 0, 90, 181, 273 ); $LeapYearQuarterStart[$_] += 1 for 1 .. 3; sub _rd2ymd { ## no critic (ProhibitUnusedPrivateSubroutines) my ($class, $rd, $extra) = @_; my $z = $rd + 308; my $y = _floor(($z*100-25)/36525); my $c = $z - _floor(365.25*$y); my $m = int((5*$c + 456)/153); my $d = $c - $start_of_month[$m-3]; if ($m > 12) { $m -= 12; $y++; } if ($extra) { # day_of_week, day_of_year my $doy = ($c + 31 + 28 - 1)%365 + 1 + ($class->_is_leap_year($y) && $m > 2); my $dow = (($rd + 6)%7) + 1; # quarter -- see DateTime::PP->rd2ymd() my $quarter = int( ( 1 / 3.1 ) * $m ) + 1; my $doq = $doy - ( $class->_is_leap_year( $y ) ? $LeapYearQuarterStart[ $quarter - 1 ] : $QuarterStart[ $quarter - 1 ] ); return $y, $m, $d, $dow, $doy, $quarter, $doq; } return $y, $m, $d; } } sub calendar_name { return 'Julian'; } sub epoch { my $self = shift; my $greg = DateTime->from_object( object => $self ); return $greg->epoch; } sub from_epoch { my $class = shift; my $greg = DateTime->from_epoch( @_ ); return $class->from_object( object => $greg ); } sub gregorian_deviation { my $self = shift; my $year = $self->{local_c}{year}; $year-- if $self->{local_c}{month} <= 2; return _floor($year/100)-_floor($year/400)-2; } # NOTE: Do NOT just default the separator to 'J' and delegate to SUPER. # This will not work before DateTime 1.43 because before that the # datetime() method did not have an argument. sub datetime { my ( $self, $sep ) = @_; $sep = 'J' unless defined $sep; return join $sep, $self->ymd( '-' ), $self->hms( ':' ); } 1; __END__ =head1 NAME DateTime::Calendar::Julian - Dates in the Julian calendar =head1 SYNOPSIS use DateTime::Calendar::Julian; $dt = DateTime::Calendar::Julian->new( year => 964, month => 10, day => 16, ); # convert Julian->Gregorian... $dtgreg = DateTime->from_object( object => $dt ); print $dtgreg->datetime; # prints '0964-10-21T00:00:00' # ... and back again $dtjul = DateTime::Calendar::Julian->from_object( object => $dtgreg ); print $dtjul->datetime; # prints '0964-10-16J00:00:00' =head1 DESCRIPTION DateTime::Calendar::Julian implements the Julian Calendar. This module implements all methods of DateTime; see the DateTime(3) manpage for all methods. =head1 METHODS This module implements one additional method besides the ones from DateTime, and changes the output of one other method. =over 4 =item * calendar_name Returns C<'Julian'>. =item * gregorian_deviation Returns the difference in days between the Gregorian and the Julian calendar. =item * datetime print $dt->datetime( $sep ), "\n"; This method is equivalent to join $sep, $dt->ymd( '-' ), $dt->hms( ':' ); The C<$sep> argument defaults to C<'J'>. B the optional argument was added to this method in version 1.02, to belatedly track a change made in L version 1.43 released 2017-05-29. Fixing this restores the original stringification behavior of this class, which was to return an ISO-8601 string unless a formatter was set. Before this change, the stringification separated date and time with either a C<'T'> or a C<'J'>, depending on which version of L was installed. =back B that as of version C<0.106_01>, methods related to quarters should work. =head1 BACKGROUND The Julian calendar was introduced by Julius Caesar in 46BC. It featured a twelve-month year of 365 days, with a leap year in February every fourth year. This calendar was adopted by the Christian church in 325AD. Around 532AD, Dionysius Exiguus moved the starting point of the Julian calendar to the calculated moment of birth of Jesus Christ. Apart from differing opinions about the start of the year (often January 1st, but also Christmas, Easter, March 25th and other dates), this calendar remained unchanged until the calendar reform of pope Gregory XIII in 1582. Some backward countries, however, used the Julian calendar until the 18th century or later. This module uses the proleptic Julian calendar for years before 532AD, or even 46BC. This means that dates are calculated as if this calendar had existed unchanged from the beginning of time. The assumption is made that January 1st is the first day of the year. Note that BC years are given as negative numbers, with 0 denoting the year 1BC (there was no year 0AD!), -1 the year 2BC, etc. =head1 SUPPORT Support for this module is provided via the F email list. See L for more details. Please report bugs to L, L, or in electronic mail to F. =head1 AUTHOR Eugene van der Pijll Thomas R. Wyant, III F =head1 COPYRIGHT AND LICENSE Copyright (c) 2003 Eugene van der Pijll. All rights reserved. Copyright (C) 2018-2022 Thomas R. Wyant, III This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. 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. =head1 SEE ALSO L L datetime@perl.org mailing list L =cut # ex: set textwidth=72 : DateTime-Calendar-Julian-0.107/xt/author/000755 000765 000024 00000000000 14175516660 020056 5ustar00tomstaff000000 000000 DateTime-Calendar-Julian-0.107/xt/author/pod.t000644 000765 000024 00000000505 14172543246 021022 0ustar00tomstaff000000 000000 package main; use strict; use warnings; use Test::More 0.88; BEGIN { eval { require Test::Pod; Test::Pod->VERSION (1.00); Test::Pod->import(); 1; } or do { print < 'Test::Prereq::Meta not available'; my $tpm = Test::Prereq::Meta->new( accept => [ qw{ CPAN::Meta ExtUtils::Manifest Module::Metadata } ], ); $tpm->all_prereq_ok(); $tpm->all_prereqs_used(); done_testing; 1; # ex: set textwidth=72 : DateTime-Calendar-Julian-0.107/xt/author/perlcriticrc000644 000765 000024 00000004727 14172543246 022475 0ustar00tomstaff000000 000000 severity = stern theme = core [Perl::Critic::Policy::BuiltinFunctions::ProhibitStringyEval] allow_includes = 1 [Perl::Critic::Policy::CodeLayout::ProhibitHardTabs] # I don't intend to comply with this at this point. severity = 2 [Perl::Critic::Policy::Documentation::PodSpelling] spell_command = aspell list [Perl::Critic::Policy::ErrorHandling::RequireCheckingReturnValueOfEval] # The default is 3 ('harsh'), but I think this is more severe than that. severity = stern [Perl::Critic::Policy::InputOutput::ProhibitInteractiveTest] # Perl::Critic and Perl Best Practices prefer the IO::Interactive # is_interactive() subroutine to -T STDIN. But that assumes that # ARGV is used for input, and that you don't want to be interactive # if output goes to a pipe. I do not want these assumptions, but # rather than disable them in the code I am simply assigning them # a severity slightly higher than I currently use. severity = cruel [Perl::Critic::Policy::InputOutput::RequireCheckedOpen] # For some reason the default is 3 ('harsh'). But IM(NS)HO this # kind of thing should be a 5. So: severity = gentle [Perl::Critic::Policy::Miscellanea::ProhibitUselessNoCritic] severity = stern [Perl::Critic::Policy::Subroutines::ProhibitUnusedPrivateSubroutines] severity = stern private_name_regex = _(?!_)\w+ [Perl::Critic::Policy::Subroutines::RequireArgUnpacking] allow_delegation_to = __arguments _arguments grep map short_subroutine_statements = 3 [Perl::Critic::Policy::Subroutines::RequireFinalReturn] terminal_funcs = CORE::exit [Perl::Critic::Policy::TestingAndDebugging::ProhibitNoStrict] allow = refs [Perl::Critic::Policy::TestingAndDebugging::ProhibitNoWarnings] allow = exiting once substr uninitialized [Perl::Critic::Policy::ValuesAndExpressions::ProhibitConstantPragma] # Perl::Critic and Perl Best Practices do not like the 'constant' # pragma because it does not interpolate. It really does, the # syntax is just different. Rather than disable the things in the # source, I'm just assigning them a severity slightly greater than # I customarily use. severity = cruel [Perl::Critic::Policy::ValuesAndExpressions::ProhibitInterpolationOfLiterals] # This policy is severity 1 by default, but because of the desire to # localize messages I want it severe enough that I get output. severity = gentle [Perl::Critic::Policy::Variables::ProhibitUnusedVarsStricter] add_themes = core allow_if_computed_by = __arguments _arguments allow_unused_subroutine_arguments = 0 severity = stern DateTime-Calendar-Julian-0.107/xt/author/manifest.t000644 000765 000024 00000000623 14172543246 022047 0ustar00tomstaff000000 000000 package main; use strict; use warnings; use Test::More 0.88; BEGIN { eval { require ExtUtils::Manifest; 1; } or do { plan skip_all => 'Can not load ExtUtils::Manifest'; exit; }; } my @got = ExtUtils::Manifest->manicheck(); ok @got == 0, 'Missing files per MANIFEST'; @got = ExtUtils::Manifest->filecheck(); ok @got == 0, 'Files not in MANIFEST or MANIFEST.SKIP'; done_testing; 1; DateTime-Calendar-Julian-0.107/xt/author/kwalitee.t000644 000765 000024 00000000532 14172543246 022045 0ustar00tomstaff000000 000000 package main; use 5.008004; use strict; use warnings; use Test::More 0.88; eval { require Test::Kwalitee; Test::Kwalitee->import(); -f 'Debian_CPANTS.txt' # Don't know what this is, and unlink 'Debian_CPANTS.txt'; # but _I_ didn't order it. 1; } or plan skip_all => 'Test::Kwalitee not found'; 1; # ex: set textwidth=72 : DateTime-Calendar-Julian-0.107/xt/author/critic.t000644 000765 000024 00000001060 14172543246 021512 0ustar00tomstaff000000 000000 package main; use strict; use warnings; use File::Spec; use Test::More 0.88; BEGIN { eval { require PPI; PPI->VERSION( 1.215 ); 1; } or do { print "1..0 # skip PPI 1.215 or greater required to criticize code.\n"; exit; }; eval { require Test::Perl::Critic; # TODO package profile. Test::Perl::Critic->import( -profile => File::Spec->catfile(qw{xt author perlcriticrc}), ); 1; } or do { print "1..0 # skip Test::Perl::Critic required to criticize code.\n"; exit; }; } all_critic_ok(); 1; # ex: set textwidth=72 : DateTime-Calendar-Julian-0.107/xt/author/minimum_perl.t000644 000765 000024 00000002530 14172543246 022735 0ustar00tomstaff000000 000000 package main; use 5.008004; use strict; use warnings; use Test::More 0.88; # Because of done_testing(); eval { require ExtUtils::Manifest; 1; } or plan skip_all => 'Unable to load ExtUtils::Manifest'; eval { require Perl::MinimumVersion; 1; } or plan skip_all => 'Unable to load Perl::MinimumVersion'; eval { require version; 1; } or plan skip_all => 'Unable to load version'; my $min_perl = '5.008004'; my $min_perl_vers = version->parse( $min_perl ); my $manifest = ExtUtils::Manifest::maniread(); foreach my $fn ( sort keys %{ $manifest } ) { $fn =~ m{ \A xt/ }smx and next; is_perl( $fn ) or next; my $doc = Perl::MinimumVersion->new( $fn ); cmp_ok $doc->minimum_version(), 'le', $min_perl, "$fn works under Perl $min_perl"; my $ppi_doc = $doc->Document(); foreach my $inc ( @{ $ppi_doc->find( 'PPI::Statement::Include' ) || [] } ) { my $vers = $inc->version() or next; cmp_ok( version->parse( $vers ), '==', $min_perl_vers, "$fn has use $min_perl, rather than some other version" ); last; } } done_testing; sub is_perl { my ( $fn ) = @_; $fn =~ m/ [.] (?: pm | t | pod | (?i: pl ) ) \z /smx and return 1; -f $fn and -T _ or return 0; open my $fh, '<', $fn or return 0; local $_ = <$fh>; close $fh; return m/ perl /smx; } 1; # ex: set textwidth=72 : DateTime-Calendar-Julian-0.107/xt/author/basic.t000644 000765 000024 00000000600 14172543246 021315 0ustar00tomstaff000000 000000 package main; use 5.008004; use strict; use warnings; use Test::More 0.88; # Because of done_testing(); note 'Modules required for development'; require_ok 'ExtUtils::Manifest'; require_ok 'Perl::MinimumVersion'; require_ok 'Test::CPAN::Changes'; require_ok 'Test::Kwalitee'; require_ok 'Test::Pod'; require_ok 'Test::Spelling'; done_testing; 1; # ex: set textwidth=72 : DateTime-Calendar-Julian-0.107/xt/author/pod_links.t000644 000765 000024 00000001071 14172543246 022221 0ustar00tomstaff000000 000000 package main; use 5.008; use strict; use warnings; use Test::More 0.88; # Because of done_testing(); BEGIN { local $@ = undef; eval { require Test::Pod::LinkCheck::Lite; Test::Pod::LinkCheck::Lite->import( ':const' ); 1; } or plan skip_all => 'Unable to load Test::Pod::LinkCheck::Lite'; } Test::Pod::LinkCheck::Lite->new( prohibit_redirect => sub { my ( undef, undef, $url ) = @_; 'http://datetime.perl.org/' eq $url and return; return ALLOW_REDIRECT_TO_INDEX; }, )->all_pod_files_ok(); done_testing; 1; # ex: set textwidth=72 : DateTime-Calendar-Julian-0.107/xt/author/pod_spelling.t000644 000765 000024 00000000550 14172543246 022717 0ustar00tomstaff000000 000000 package main; # ex: set textwidth=72 : use strict; use warnings; BEGIN { eval { require Test::Spelling; Test::Spelling->import(); 1; } or do { print "1..0 # skip Test::Spelling not available.\n"; exit; }; } add_stopwords (); all_pod_files_spelling_ok (); 1; __DATA__ der Dionysius Exiguus merchantability Pijll proleptic th Wyant DateTime-Calendar-Julian-0.107/xt/author/changes.t000644 000765 000024 00000000605 14172543246 021651 0ustar00tomstaff000000 000000 package main; use 5.008004; use strict; use warnings; use Test::More 0.88; # Because of done_testing(); BEGIN { eval { require Test::CPAN::Changes; Test::CPAN::Changes->import(); 1; } or do { plan skip_all => 'Unable to load Test::CPAN::Changes'; exit; }; } changes_file_ok( Changes => { next_token => 'next_release' } ); done_testing; 1; # ex: set textwidth=72 : DateTime-Calendar-Julian-0.107/xt/author/pod_coverage.t000644 000765 000024 00000002730 14172543246 022677 0ustar00tomstaff000000 000000 package main; use strict; use warnings; use Test::More 0.88; BEGIN { eval { require Test::Pod::Coverage; Test::Pod::Coverage->VERSION(1.00); Test::Pod::Coverage->import(); 1; } or do { print < [ qr{ \A [[:upper:]\d_]+ \z }smx, ], # The following are DateTime methods not documented by that # module in any way that Pod::Coverage recognizes trustme => [ qr{ \A day_0 \z }smx, qr{ \A day_of_ (?: month (?: _0 )? | week_0 | quarter_0 | year_0 ) \Z }smx, qr{ \A do [qwy] (?: _0 )? \z }smx, qr{ \A era \z }smx, qr{ \A iso8601 \z }smx, qr{ \A local_rd_as_seconds \Z }smx, qr{ \A mday (?: _0 )? \z }smx, qr{ \A min \z }smx, qr{ \A mon (?: (?: th )? _0 )? \z }smx, qr{ \A quarter_0 \z }smx, qr{ \A sec \z }smx, qr{ \A STORABLE_ (?: freeze | thaw ) \z }smx, qr{ \A utc_year \z }smx, qr{ \A wday (?: _0 )? \z }smx, ], coverage_class => 'Pod::Coverage::CountParents' }); } 1; # ex: set textwidth=72 : DateTime-Calendar-Julian-0.107/xt/author/executable.t000644 000765 000024 00000001114 14172543246 022356 0ustar00tomstaff000000 000000 package main; use strict; use warnings; use ExtUtils::Manifest qw{maniread}; use Test::More 0.88; my $manifest = maniread(); foreach ( sort keys %{ $manifest } ) { m{ \A bin / }smx and next; m{ \A eg / }smx and next; m{ \A tools / }smx and next; ok ! is_executable(), "$_ should not be executable"; } done_testing; sub is_executable { my @stat = stat $_; $stat[2] & oct(111) and return 1; open my $fh, '<', $_ or die "Unable to open $_: $!\n"; local $_ = <$fh>; close $fh; return m{ \A [#]! .* perl }smx; } 1; # ex: set textwidth=72 : DateTime-Calendar-Julian-0.107/t/1.t000644 000765 000024 00000006404 14173142721 016704 0ustar00tomstaff000000 000000 # Before `make install' is performed this script should be runnable with # `make test'. After `make install' it should work as `perl 1.t' ######################### use strict; use warnings; use Test::More tests => 43; BEGIN { use_ok('DateTime::Calendar::Julian') }; ######################### my $d = DateTime::Calendar::Julian->new( year => 1582, month => 10, day => 5, time_zone => 'floating'); ok($d, 'creation of date'); is(($d->utc_rd_values)[0], 2299160-1721424, 'rata die'); use DateTime; foreach my $date ( # Julian date , Gregorian , diff [ '1582/10/05', '1582/10/15', 10 ], # Jul => Greg reform date [ '1752/09/03', '1752/09/14', 11 ], # English reform date [ '1900/02/29', '1900/03/13', 12 ], # Julian leap year [ '1918/02/01', '1918/02/14', 13 ], # Russian reform date [ '0000/01/03', '0000/01/01', -2 ], # 1 BC ['-4712/01/01','-4713/11/24',-38 ], # Julian Day 0 ) { my ($y, $m, $day) = split '/', $date->[0]; # time_zone to work around a bug(?) in early DateTime versions my $d = DateTime::Calendar::Julian->new(year => $y, month => $m, day => $day, hour => 0, # for minute => 0, # datetime() second => 0, # test time_zone => 'floating' ); my $str = sprintf( '%04d-%02d-%02d', $y, $m, $day ); is( $d->datetime(), "${str}J00:00:00", "datetime() of $date->[0]" ); is( "$d", "${str}T00:00:00", "stringification of $date->[0]" ); my $dt = DateTime->from_object( object => $d ); is($dt->ymd('/'), $date->[1], "converting $date->[0] to Gregorian"); $d = DateTime::Calendar::Julian->from_object( object => $dt ); is($d->ymd('/'), $date->[0], "converting $date->[1] to Julian"); is($d->gregorian_deviation, $date->[2], "gregorian dev. on $date->[0]"); } $d = DateTime::Calendar::Julian->new(year => 2003); ok(!($d->is_leap_year), 'non-leap year'); $d = DateTime::Calendar::Julian->new(year => 2004); ok($d->is_leap_year, 'ordinary leap year'); $d = DateTime::Calendar::Julian->new(year => 2000); ok($d->is_leap_year, 'leap year (multiple of 400)'); $d = DateTime::Calendar::Julian->new(year => 1900); ok($d->is_leap_year, 'leap year (multiple of 100)'); $d = DateTime::Calendar::Julian->new( year => 1900, month => 2, day => 29, time_zone => 'floating'); is($d->ymd, '1900-02-29', 'leap day 1900-02-29 exists'); $d = DateTime::Calendar::Julian->last_day_of_month( year => 1900, month => 2, time_zone => 'floating'); is($d->ymd, '1900-02-29', 'leap day 1900 is last of the month'); SKIP: { skip 'epoch not UNIX', 2 unless gmtime(0) eq 'Thu Jan 1 00:00:00 1970'; $d = DateTime::Calendar::Julian->from_epoch( epoch => 0 ); is( $d->epoch, 0, 'epoch 0' ); is( $d->ymd, '1969-12-19', 'epoch is correct' ); } $d = DateTime::Calendar::Julian->new( year => 1900, month => 10, day => 1, time_zone => 'floating'); $d->add( years => 1 ); is($d->ymd, '1901-10-01', 'adding a year'); is( $d->calendar_name, 'Julian', 'Calendar name' ); DateTime-Calendar-Julian-0.107/t/5week.t000644 000765 000024 00000002001 14172543246 017557 0ustar00tomstaff000000 000000 use strict; use warnings; use Test::More tests => 8; use DateTime::Calendar::Julian; ######################### sub test_dates { foreach my $test ( @_ ) { my @args = @{ $test->[0] }; my @results = @{ $test->[1] }; my $dt = DateTime::Calendar::Julian->new( year => $args[0], month => $args[1], day => $args[2], ); my ($year, $week) = $dt->week(); is( "$year-W$week", "$results[0]-W$results[1]" ); } } my @tests = ( [ [ 1749, 12, 31 ], [ 1749, 52 ] ], [ [ 1750, 1, 1 ], [ 1750, 1 ] ], [ [ 1750, 1, 7 ], [ 1750, 1 ] ], [ [ 1750, 1, 8 ], [ 1750, 2 ] ], [ [ 1750, 3, 26 ], [ 1750, 13 ] ], [ [ 1750, 12, 30 ], [ 1750, 52 ] ], [ [ 1750, 12, 31 ], [ 1751, 1 ] ], [ [ 1751, 1, 1 ], [ 1751, 1 ] ], ); test_dates( @tests ); DateTime-Calendar-Julian-0.107/t/6quarter.t000644 000765 000024 00000012217 14172543246 020322 0ustar00tomstaff000000 000000 package main; use 5.008004; use strict; use warnings; use DateTime::Calendar::Julian; use Test::More 0.88; # Because of done_testing(); note <<'EOD'; The following from DateTime t/03components.t EOD { my $d = DateTime::Calendar::Julian->new( year => 2001, month => 7, day => 5, hour => 2, minute => 12, second => 50, time_zone => 'UTC', ); is( $d->quarter, 3, '->quarter' ); is( $d->day_of_quarter, 5, '->day_of_quarter' ); is( $d->day_of_quarter_0, 4, '->day_of_quarter_0' ); ok( !$d->is_last_day_of_quarter, '->is_last_day_of_quarter' ); is( $d->quarter_length, 92, '->quarter_length' ); is( $d->quarter_abbr, 'Q3', '->quarter_abbr' ); is( $d->quarter_name, '3rd quarter', '->quarter_name' ); } { my @tests = ( { year => 2017, month => 8, day => 19, expect => 0 }, { year => 2017, month => 3, day => 31, expect => 1 }, { year => 2017, month => 6, day => 30, expect => 1 }, { year => 2017, month => 9, day => 30, expect => 1 }, { year => 2017, month => 12, day => 31, expect => 1 }, ); for my $t (@tests) { my $expect = delete $t->{expect}; my $dt = DateTime::Calendar::Julian->new($t); my $is = $dt->is_last_day_of_quarter; ok( ( $expect ? $is : !$is ), '->is_last_day_of_quarter' ); } } { my $dt = DateTime::Calendar::Julian->new( year => 1995, month => 2, day => 1 ); is( $dt->quarter, 1, '->quarter is 1' ); is( $dt->day_of_quarter, 32, '->day_of_quarter' ); is( $dt->quarter_length, 90, '->quarter_length' ); } { my $dt = DateTime::Calendar::Julian->new( year => 1995, month => 2, day => 1 ); is( $dt->quarter, 1, '->quarter is 1' ); is( $dt->day_of_quarter, 32, '->day_of_quarter' ); is( $dt->quarter_length, 90, '->quarter_length' ); } { my $dt = DateTime::Calendar::Julian->new( year => 1995, month => 5, day => 1 ); is( $dt->quarter, 2, '->quarter is 2' ); is( $dt->day_of_quarter, 31, '->day_of_quarter' ); is( $dt->quarter_length, 91, '->quarter_length' ); } { my $dt = DateTime::Calendar::Julian->new( year => 1995, month => 8, day => 1 ); is( $dt->quarter, 3, '->quarter is 3' ); is( $dt->day_of_quarter, 32, '->day_of_quarter' ); is( $dt->quarter_length, 92, '->quarter_length' ); } { my $dt = DateTime::Calendar::Julian->new( year => 1995, month => 11, day => 1 ); is( $dt->quarter, 4, '->quarter is 4' ); is( $dt->day_of_quarter, 32, '->day_of_quarter' ); is( $dt->quarter_length, 92, '->quarter_length' ); } { my $dt = DateTime::Calendar::Julian->new( year => 1996, month => 2, day => 1 ); is( $dt->quarter, 1, '->quarter is 1' ); is( $dt->day_of_quarter, 32, '->day_of_quarter' ); is( $dt->quarter_length, 91, '->quarter_length' ); } { my $dt = DateTime::Calendar::Julian->new( year => 1996, month => 5, day => 1 ); is( $dt->quarter, 2, '->quarter is 2' ); is( $dt->day_of_quarter, 31, '->day_of_quarter' ); is( $dt->quarter_length, 91, '->quarter_length' ); } { my $dt = DateTime::Calendar::Julian->new( year => 1996, month => 8, day => 1 ); is( $dt->quarter, 3, '->quarter is 3' ); is( $dt->day_of_quarter, 32, '->day_of_quarter' ); is( $dt->quarter_length, 92, '->quarter_length' ); } { my $dt = DateTime::Calendar::Julian->new( year => 1996, month => 11, day => 1 ); is( $dt->quarter, 4, '->quarter is 4' ); is( $dt->day_of_quarter, 32, '->day_of_quarter' ); is( $dt->quarter_length, 92, '->quarter_length' ); } note <<'EOD'; The following are Julian-specific EOD foreach my $info ( { year => 1500, # A leap year Julian, but not Gregorian month => 1, day => 22, quarter => 1, day_of_quarter => 22, quarter_length => 91, }, { year => 1500, # A leap year Julian, but not Gregorian month => 3, day => 1, quarter => 1, day_of_quarter => 61, quarter_length => 91, }, { year => 1500, # A leap year Julian, but not Gregorian month => 4, day => 1, quarter => 2, day_of_quarter => 1, quarter_length => 91, }, { year => 1501, # Not a leap year month => 1, day => 22, quarter => 1, day_of_quarter => 22, quarter_length => 90, }, { year => 1501, # Not a leap year month => 3, day => 1, quarter => 1, day_of_quarter => 60, quarter_length => 90, }, { year => 1501, # Not a leap year month => 4, day => 1, quarter => 2, day_of_quarter => 1, quarter_length => 91, }, ) { my $dt = DateTime::Calendar::Julian->new( year => $info->{year}, month => $info->{month} || 1, day => $info->{day} || 1, ); cmp_ok $dt->quarter, '==', $info->{quarter}, sprintf '%s (Julian) quarter is %d', $dt->ymd, $info->{quarter}; cmp_ok $dt->day_of_quarter, '==', $info->{day_of_quarter}, sprintf '%s (Julian) day_of_quarter is %d', $dt->ymd, $info->{day_of_quarter}; cmp_ok $dt->quarter_length, '==', $info->{quarter_length}, sprintf '%s (Julian) quarter_length is %d', $dt->ymd, $info->{quarter_length}; } done_testing; 1; # ex: set textwidth=72 : DateTime-Calendar-Julian-0.107/t/4doy.t000644 000765 000024 00000002125 14172543246 017425 0ustar00tomstaff000000 000000 use strict; use warnings; use Test::More tests => 11; use DateTime::Calendar::Julian; ######################### sub test_dates { foreach my $test ( @_ ) { my @args = @{ $test->[0] }; my @results = @{ $test->[1] }; my $dt = DateTime::Calendar::Julian->new( year => $args[0], month => $args[1], day => $args[2], ); my $doy = $dt->day_of_year(); is( $doy, $results[0], "doy of @args" ); } } my @tests = ( [ [ 2003, 1, 1 ], [ 1 ] ], [ [ 2003, 1, 31 ], [ 31 ] ], [ [ 2003, 2, 28 ], [ 59 ] ], [ [ 2003, 3, 1 ], [ 60 ] ], [ [ 2003, 12, 31 ], [ 365 ] ], [ [ 1900, 1, 1 ], [ 1 ] ], [ [ 1900, 1, 31 ], [ 31 ] ], [ [ 1900, 2, 28 ], [ 59 ] ], [ [ 1900, 2, 29 ], [ 60 ] ], [ [ 1900, 3, 1 ], [ 61 ] ], [ [ 1900, 12, 31 ], [ 366 ] ], ); test_dates( @tests );