1 package HTML::CalendarMonth::DateTool::DateCalc;
3 $HTML::CalendarMonth::DateTool::DateCalc::VERSION = '1.26';
6 # Interface to Date::Calc
12 use base qw( HTML::CalendarMonth::DateTool );
24 sub dow1st_and_lastday {
25 my($self, $month, $year) = @_;
26 $month ||= $self->month;
27 $year ||= $self->year;
28 ($self->dow(1), Days_in_Month($year, $month));
32 my($self, $day, $month, $year) = @_;
33 $month ||= $self->month;
34 $year ||= $self->year;
35 Mktime($year, $month, $day, 0, 0, 0);
39 my($self, $day, $month, $year) = @_;
40 $day || croak "day required.\n";
41 $month ||= $self->month;
42 $year ||= $self->year;
43 # Date::Calc uses 1..7 as indicies in the week, starting with Monday.
44 # Convert to 0..6, starting with Sunday.
45 Day_of_Week($year, $month, $day) % 7;
49 my($self, $delta, $day, $month, $year) = @_;
50 defined $delta || croak "delta (in days) required.\n";
51 $day || croak "day required.\n";
52 $month ||= $self->month;
53 $year ||= $self->year;
54 my($y, $m, $d) = Add_Delta_Days($year, $month, $day, $delta);
59 my($self, $day, $month, $year) = @_;
60 $day || croak "day required.\n";
61 $month ||= $self->month;
62 $year ||= $self->year;
64 ($week, $year) = Week_of_Year($year, $month, $day);