Skip Menu |

This queue is for tickets about the Date-Manip CPAN distribution.

Report information
The Basics
Id: 74130
Status: resolved
Priority: 0/
Queue: Date-Manip

People
Owner: Nobody in particular
Requestors: keithm [...] tlo.com
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: Feature Request: Multiple Holidays on the Same Date
Date: Wed, 18 Jan 2012 16:29:13 -0500
To: bug-Date-Manip [...] rt.cpan.org
From: Keith Minkler <keithm [...] tlo.com>
Sometimes holidays can fall on the same date, since there are fixed holidays (e.g. new years is Jan 1 each year), and holidays which move around from year to year, such as father's day. While trying to get a list of all the holidays in particular years, I noticed that those holidays which move around were sometimes being lost in the output, since the library returns only a single holiday per date. There is a work-around to get all the holidays, which is to have separate configuration files for static-date holidays and variable date holidays, and to load them separately, which looks something like this: my %holidays; # fixed date holidays my $date = Date::Manip::Date->new(); $date->config( "configfile", "$Bin/../lib/TLO/Article/ChartParser2/holidays"); %holidays = map { ( $_->holiday() => $_->printf( "%m/%d/%Y" ) ) } $date->list_holidays([2012]); # have to re-create the object so it doesn't share config with the other dates. $date = Date::Manip::Date->new(); $date->config( "configfile", "$Bin/../lib/TLO/Article/ChartParser2/holidays_floating", @forcedate ); %holidays = (%holidays, map { ( $_->holiday() => $_->printf( "%m/%d/%Y" ) ) } $date->list_holidays([2012])); Some examples of issue... --- config file *HOLIDAYS Nov 2 = Day of the Dead Jun 17 = Bunker Hill Day # first tuesday after the first monday in november 1*11:1:1:0:0:0*FD1 = Election Day 3rd Sunday in June = Father's Day --- Election Day fell on the same day as the Day of the Dead in 2010 Father's Day fell on the same day as Bunker Hill Day in 2012 I'm using Date::Manip 6.30 $ perl -V Summary of my perl5 (revision 5 version 10 subversion 1) configuration: Platform: osname=linux, osvers=2.6.24-28-server, archname=x86_64-linux-gnu-thread-multi uname='linux allspice 2.6.24-28-server #1 smp wed aug 18 21:17:51 utc 2010 x86_64 gnulinux ' config_args='-Dusethreads -Duselargefiles -Dccflags=-DDEBIAN -Dcccdlflags=-fPIC -Darchname=x86_64-linux-gnu -Dprefix=/usr -Dprivlib=/usr/share/perl/5.10 -Darchlib=/usr/lib/perl/5.10 -Dvendorprefix=/usr -Dvendorlib=/usr/share/perl5 -Dvendorarch=/usr/lib/perl5 -Dsiteprefix=/usr/local -Dsitelib=/usr/local/share/perl/5.10.1 -Dsitearch=/usr/local/lib/perl/5.10.1 -Dman1dir=/usr/share/man/man1 -Dman3dir=/usr/share/man/man3 -Dsiteman1dir=/usr/local/man/man1 -Dsiteman3dir=/usr/local/man/man3 -Dman1ext=1 -Dman3ext=3perl -Dpager=/usr/bin/sensible-pager -Uafs -Ud_csh -Ud_ualarm -Uusesfio -Uusenm -DDEBUGGING=-g -Doptimize=-O2 -Duseshrplib -Dlibperl=libperl.so.5.10.1 -Dd_dosuid -des' hint=recommended, useposix=true, d_sigaction=define useithreads=define, usemultiplicity=define useperlio=define, d_sfio=undef, uselargefiles=define, usesocks=undef use64bitint=define, use64bitall=define, uselongdouble=undef usemymalloc=n, bincompat5005=undef Compiler: cc='cc', ccflags ='-D_REENTRANT -D_GNU_SOURCE -DDEBIAN -fno-strict-aliasing -pipe -fstack-protector -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64', optimize='-O2 -g', cppflags='-D_REENTRANT -D_GNU_SOURCE -DDEBIAN -fno-strict-aliasing -pipe -fstack-protector -I/usr/local/include' ccversion='', gccversion='4.4.3', gccosandvers='' intsize=4, longsize=8, ptrsize=8, doublesize=8, byteorder=12345678 d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=16 ivtype='long', ivsize=8, nvtype='double', nvsize=8, Off_t='off_t', lseeksize=8 alignbytes=8, prototype=define Linker and Libraries: ld='cc', ldflags =' -fstack-protector -L/usr/local/lib' libpth=/usr/local/lib /lib /usr/lib /lib64 /usr/lib64 libs=-lgdbm -lgdbm_compat -ldb -ldl -lm -lpthread -lc -lcrypt perllibs=-ldl -lm -lpthread -lc -lcrypt libc=/lib/libc-2.11.1.so, so=so, useshrplib=true, libperl=libperl.so.5.10.1 gnulibc_version='2.11.1' Dynamic Linking: dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-Wl,-E' cccdlflags='-fPIC', lddlflags='-shared -O2 -g -L/usr/local/lib -fstack-protector' Characteristics of this binary (from libperl): Compile-time options: MULTIPLICITY PERL_DONT_CREATE_GVSV PERL_IMPLICIT_CONTEXT PERL_MALLOC_WRAP USE_64_BIT_ALL USE_64_BIT_INT USE_ITHREADS USE_LARGE_FILES USE_PERLIO USE_REENTRANT_API Built under linux Compiled at Apr 22 2011 18:54:26 @INC: /etc/perl /usr/local/lib/perl/5.10.1 /usr/local/share/perl/5.10.1 /usr/lib/perl5 /usr/share/perl5 /usr/lib/perl/5.10 /usr/share/perl/5.10 /usr/local/lib/site_perl .
Good suggestion. It's added and will be in the next release. You can get a development copy at: http://sullybeck.com/Date-Manip-6.31.tar.gz