I am currently working an alternative work schedule, or a 9/80 work schedule. Not sure how well-known that is, but basically, one week I work 44 hours (9, 9, 9, 9, 8), and the next I work 36 (9, 9, 9, 9, 0).
I've often found myself wondering if I have a certain Friday off, so I go to a calendar and figure it out by counting up from a week that I know I have the Friday off. This is a pain, so I put together this little script that sort of does it for me.
#!/usr/bin/perl
use strict;
use warnings;
use Date::Calc qw(check_date Add_Delta_Days Monday_of_Week Week_of_Yea
+r Compress Today Date_to_Text);
if (check_date(@ARGV)) {
my @friday = Add_Delta_Days(Monday_of_Week(Week_of_Year(@ARGV)), 4
+);
my ($week, $year) = Week_of_Year(@friday);
my $present = Compress(@friday) > Compress(Today());
# It is an odd week, so I have Friday off.
if ($week % 2) {
my $do_verb = $present ? "DO" : "DID";
print "You $do_verb have " . Date_to_Text(@friday) . " off.\n"
+;
}
else {
my $dont_verb = $present ? "DON'T" : "DIDN'T";
print "You $dont_verb have " . Date_to_Text(@friday) . " off.\
+n";
}
}
else {
print "Usage.\n";
}
This isn't terribly useful for anyone in particular, unless they are in the same exact situation as myself, but I figured I'd share it anyway.