diff --git a/lib/Date/Format.pm b/lib/Date/Format.pm index 00dca5c..20bdf10 100644 --- a/lib/Date/Format.pm +++ b/lib/Date/Format.pm @@ -173,9 +173,10 @@ with C, e.g. C<%OY> will output the year as roman numerals. =head1 LIMITATION -The functions in this module are limited to the time range that can be -represented by the time_t data type, i.e. 1901-12-13 20:45:53 GMT to -2038-01-19 03:14:07 GMT. +On Perl 5.12 and later with a 64-bit integer (the common case on modern +systems), dates far beyond 2038 are supported. On older 32-bit builds of +Perl, the functions in this module are limited to the range of the +C data type: 1901-12-13 20:45:53 GMT to 2038-01-19 03:14:07 GMT. =head1 AUTHOR diff --git a/lib/Date/Parse.pm b/lib/Date/Parse.pm index fd6cef2..5071a14 100644 --- a/lib/Date/Parse.pm +++ b/lib/Date/Parse.pm @@ -472,6 +472,17 @@ Below is a sample list of dates that are known to be parsable with Date::Parse 1999 10:02:18 "GMT" 16 Nov 94 22:28:20 PST +=head1 MISSING YEAR INFERENCE + +When the input date string does not contain a year, C assumes the +date refers to the most recent past occurrence. If the month (and day) have +not yet occurred in the current year, the previous year is used. For example, +parsing C<"25 Dec"> in June will return December 25 of the previous year, while +parsing C<"15 Mar"> in June will return March 15 of the current year. + +The reference time used for this inference defaults to C but can be +overridden with the optional C parameter. + =head1 BUGS When both the month and the date are specified in the date as numbers diff --git a/t/gh10.t b/t/gh10.t index 449fe61..cac9699 100644 --- a/t/gh10.t +++ b/t/gh10.t @@ -27,15 +27,18 @@ BEGIN { use POSIX qw(); use Test::More; +use Time::Zone qw(); use Date::Format qw(time2str); # Skip the whole file if the platform does not support IANA timezone names. -# Use epoch 1352019262 (2012-11-04 01:04:22 PDT): DST=1 in America/Los_Angeles -# but DST=0 in UTC, so this check actually distinguishes the two and won't -# produce a false-positive on a UTC-only system. +# We verify that TZ='America/Los_Angeles' actually took effect by checking +# both the DST flag AND the UTC offset for a known PDT epoch. Checking only +# the DST flag can false-positive on systems where TZ assignment fails but +# the host's native timezone happens to have DST at this epoch (GH#99). my $has_la_tz = eval { my @lt = localtime(1352019262); # 2012-11-04 01:04:22 PDT (before fall-back) - $lt[8] == 1; # Expect DST flag = 1 in PDT + $lt[8] == 1 # Expect DST flag = 1 in PDT + && Time::Zone::calc_off(1352019262) == -7*3600; # Expect UTC-7 (PDT offset) }; plan( skip_all => "system does not support America/Los_Angeles timezone" ) unless $has_la_tz;