Date-ISO

 view release on metacpan or  search on metacpan

lib/Date/ISO.pm  view on Meta::CPAN

}

sub iso_week     {
    my $self = shift;
    return (to_iso( $self->year, $self->month, $self->day ))[1];
}

sub iso_week_day     {
    my $self = shift;
    return (to_iso( $self->year, $self->month, $self->day ))[2];
}
sub iso_day{iso_week_day(@_)}

#}}}

# Testing other methods inherited from ICal #{{{

=begin testing

my $t3 = Date::ISO->new( iso => '1973-W12-4' );
is( $t3->iso, '1973-W12-4', 'Return the ISO string we started with');
$t3->offset(0);
is ( $t3->ical, '19730322Z', 'ical()');
$t3->add( week => 2 );
is( $t3->ical, '19730405Z', 'ical()');
is( $t3->iso_week, 14, 'Two weeks later' );
is( $t3->iso_week_day, 4, 'Should be the same dow' );
is($t3->iso, '1973-W14-4', 'Adding 2 weeks');

=end testing

=cut

#}}}

=head1 Backwards compatibiilty methods

The following functional interface is provided for backwards
compatibility with former versions.

=head2 iso

 $iso = iso($year, $month, $day);

=cut

1;

# Documentation {{{

=head1 AUTHOR

Rich Bowen (rbowen@rcbowen.com)

=head1 DATE

$Date: 2003/01/21 15:36:59 $

=head1 Additional comments

For more information about this calendar, please see:

http://personal.ecu.edu/mccartyr/ISOwdALG.txt

http://personal.ecu.edu/mccartyr/isowdcal.html

http://personal.ecu.edu/mccartyr/aboutwdc.htm

http://www.cl.cam.ac.uk/~mgk25/iso-time.html

http://www.fourmilab.ch/documents/calendar/

Finally, many many many thanks to Rick McCarty who provided me with
the algorithms that I'm using for conversions to and from ISO dates.
All the errors in previous versions of this module were entirely my
fault for miscopying something from his algorithm.

=head1 To Do, Bugs

Need to flesh out test suite some more. Particularly need to test some dates
immediately before and after the first day of the year - days in which you
might be in a different Gregorian and ISO years.

ISO date format also supports a variety of time formats. I suppose I should
accept those as valid arguments.

Creating a Date::ISO object with an ISO string, and then immediately
getting the ISO string representation of that object, is not giving
back what we started with. I'm not at all sure what is going on.

=cut

# }}}

# CVS History #{{{

=head1 Version History

    $Log: ISO.pm,v $
    Revision 1.30  2003/01/21 15:36:59  rbowen
    Patch submitted by Winifred Plapper for a stupid typo.

    Revision 1.29  2002/11/08 12:57:28  rbowen
    Patch by Martijn van Beers to make it possible to construct objects with
    a week number and week day, as per the spec.

    Revision 1.28  2002/01/21 02:13:57  rbowen
    Patch from Jesse Vincent, to permit the setting of times in ISO dates.

    Revision 1.27  2001/11/29 18:03:16  rbowen
    If offsets are not specified, use GMT. This fixes a problem that has
    been in the last several releases. Need to add additional tests to test
    in the system's local time zone.

    Revision 1.26  2001/11/28 22:36:42  rbowen
    Jesse's patch to make offsets work as passed in, rather than setting to
    0.

    Revision 1.25  2001/11/27 02:44:43  rbowen
    If an offset is not provided, explicitly set to 0. We are dealing with
    dates, not times.

    Revision 1.24  2001/11/27 02:15:15  rbowen
    Explicitly set offset to 0 always.

    Revision 1.23  2001/11/25 03:55:23  rbowen
    Code fold. Nothing to see here.

    Revision 1.22  2001/11/24 16:03:11  rbowen
    Offsets must be explicitly set to 0 in order to get the right epoch
    time. See Date::ICal for details



( run in 1.514 second using v1.01-cache-2.11-cpan-39bf76dae61 )