Home : Products : Gossamer Links : Development, Plugins and Globals :

Products: Gossamer Links: Development, Plugins and Globals: Re: [klauslovgreen] Date challange: Edit Log

Here is the list of edits for this post
Re: [klauslovgreen] Date challange
Hi,

really simple....

Add

use lib 'path/to/admin' to the top of the subroutine.

Then, use this subroutine, I mis-interpreted the date calls:

Code:
sub {
## not actually tested, but should work.
## takes into account the meeting date for the current month may have already passed.
##
use lib '/path/to/admin';
use Plugins::Date::Pcalc qw( Today Date_to_Text_Long Date_to_Days Add_Delta_YMD Nth_Weekday_of_Month_Year Delta_Days );
my ($year,$month,$day) = Today();
my $dow = 2; # 2 = Tuesday
my $n = 3; # 3 = Third of that day of week
my ($year1,$month1,$day1) = Nth_Weekday_of_Month_Year($year,$month,$dow,$n); ## we want to capture the values for this month
my $meeting_this_month = Date_to_Text_Long($year1,$month1,$day1);
## print "Meeting this month is: (early) ", $meeting_this_month ;
## then format a date string
if ( Delta_Days ($year,$month,$day, $year1,$month1,$day1) >= 0) {
## print "meeting is in ", Delta_Days ($year,$month,$day, $year1,$month1,$day1);
## if the meeting has not happened this month
return ( $meeting_this_month); ## this should insert the date at the point you called the subroutine
} else {
## return the date for next month's meeting.
## print "meeting is in ", Delta_Days ($year,$month,$day, $year1,$month1,$day1);
my ($year2,$month2,$day2) = Add_Delta_YMD($year1,$month1,$day1, 0,1,0);
## we have to add a month to the current meeting date
my $meeting_next_month = Date_to_Text_Long( Nth_Weekday_of_Month_Year($year2,$month2,$dow,$n) ); ## adjust for day of week/week of month
return ( $meeting_next_month); ## this should insert the date at the point you called the subroutine
}
}

This *IS* working on my site.


You *might* be able to use:

use lib $CFG->{'admin_root_path'};

but I haven't tested this. ... just tested it, it does work, and will make the subroutine more generalized.


PUGDOG� Enterprises, Inc.

The best way to contact me is to NOT use Email.
Please leave a PM here.

Last edited by:

pugdog: Apr 24, 2003, 9:07 PM

Edit Log: