Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions lib/Date/Format.pm
Original file line number Diff line number Diff line change
Expand Up @@ -173,9 +173,10 @@ with C<O>, 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<time_t> data type: 1901-12-13 20:45:53 GMT to 2038-01-19 03:14:07 GMT.

=head1 AUTHOR

Expand Down
11 changes: 11 additions & 0 deletions lib/Date/Parse.pm
Original file line number Diff line number Diff line change
Expand Up @@ -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<str2time> 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<time()> but can be
overridden with the optional C<EPOCH> parameter.

=head1 BUGS

When both the month and the date are specified in the date as numbers
Expand Down
11 changes: 7 additions & 4 deletions t/gh10.t
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Loading